0

I am building a standard virtual environment for a project that is not connected to the Internet. I therefore need to download all the wheel files and make an install script (CMD file). One thing that is a real pain is the process of figuring out dependencies so I install them in the right order. Is there something like pip freeze, but that lists the versions in the order they need to be installed?

elbillaf
  • 1,952
  • 10
  • 37
  • 73
  • Perhaps https://pypi.org/project/pipdeptree/ can help you. –  Jan 12 '21 at 16:55
  • https://stackoverflow.com/a/14447068/7976758 Found in https://stackoverflow.com/search?q=%5Bpip%5D+offline – phd Jan 12 '21 at 17:20
  • `pip download -r requirements.txt` downloads all listed packages and all their requirements. The command must be run on the same architecture and Python version the packages will be installed. Then move the downloaded wheels to the target host and run `pip install --no-index --find-links /path/to/download/dir/ -r requirements.txt` – phd Jan 12 '21 at 17:22

1 Answers1

0
  1. Is there any reason you are not using a python packager?
  2. If you still want to do it yourself you could just create a virtual environment, pip install -r requirements.txt and then zip the entire parent directory.
    But there are issues here- if any of the requirements have compiled dependencies, they are not guaranteed to work on the hardware running the code in the end
OranShuster
  • 476
  • 2
  • 12