I'm trying to figure out the best approach to install a Python package and all its dependencies on a computer that's offline. I've already implemented a method that worked well for me. Here's what I did:
1. I created a virtual environment using `python -m venv .` in a specific directory.
2. Then, I activated it with `.Scriptsactivate`.
3. After that, I installed the package using `pip install `.
4. I saved the dependencies with `pip freeze > requirements.txt`.
5. Next, I created a folder called 'wheel' and used `pip download -r requirements.txt` to fetch the wheels.
6. Finally, I moved the 'wheel' folder to the offline PC, created a new virtual environment there, and installed the packages using the wheels.
This method works great as long as all required files are available as wheel files. However, I've recently encountered packages that also need dependencies built from source, resulting in `tar.gz` files instead. These sources can't be built on the offline PC due to missing dependencies or issues with build tools and setuptools. Does anyone have a solution to get this working?
3 Answers
Honestly, this sounds like a perfect use case for Docker or containerization. You can create an image with your entire environment set up and then run it on any computer without worrying about dependency issues.
Have you tried using Nuitka? It's a really helpful tool that can compile your code into a standalone application, and it might help with those pesky dependencies that need building from source.
I prefer to package my scripts into standalone executables. Sure, it makes the file size larger, but it simplifies deployment and keeps everything contained.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically