On 2 November 2017 at 07:17, Chris Angelico <ros...@gmail.com> wrote: > On Thu, Nov 2, 2017 at 5:50 PM, Noah <noah-l...@enabled.com> wrote: >> Hi, >> >> I am trying to install a python package with about 80 dependencies on a >> server that is not connected to the internet and has no local proxy. I can >> ssh to it via VPN. >> >> I was able to find python bundle and download the tarballs for all the main >> python package and all the tarballs for the subsequent dependencies. They >> reside in the same directory on the isolated server. >> >> Does anybody have some recommendations on how to install the main package >> and that process triggers the installation of all the dependencies from >> their corresponding tar.gz file? I cant seem to figure out how to do that >> easily with pip. > > Hmm. The first thing that comes to my mind is a virtual environment. > I'm assuming here that you have a local system that has the same CPU > architecture and Python as the main server, and which *does* have an > internet connection; if that's not the case, it'll be more > complicated. But in theory, this should work: > > local$ python3 -m venv env > local$ source env/bin/activate > local$ pip install -r requirements.txt > > At this point, you have a directory called "env" which contains all > the packages listed in your requirements.txt file (you DO have one of > those, right?) and everything those packages depend on. Then SSH to > your server, and set up an equivalent environment: > > server$ python3 -m venv env > server$ source env/bin/activate > > Copy in the contents of env/lib/pythonX.Y/site-packages (where X.Y is > your Python version, eg python3.7 on my system), and then try > importing stuff. In theory, you should be able to load everything in > just fine. > > If that doesn't work, you might have to manually run setup.py for each > of your eighty dependencies, and possibly all of their dependencies > too. I'd definitely try the venv transfer before going to that level > of tedium.
Alternatively, you can do (on your internet-connected system) mkdir wheels pip wheel --wheel-directory wheels -r requirements.txt This will create a set of .whl files in the directory "wheels". You can copy that directory to the target machine and (assuming the two machines do have the same architecture/OS) on that machine do pip install --no-index --find-links wheels -r requirements.txt This will tell pip to not use PyPI (and so not need the internet) and to satisfy the requirements using only the wheel files in the "wheels" directory. Paul -- https://mail.python.org/mailman/listinfo/python-list