I want to install packages on a computer which does not have internet (connect via ssh) from a computer which does.
My idea is that instead of uploading the individual pip packages for each project + python version (same reasons why you'd want to use a virtual environment), I'd like to install the target package in an empty virtual environment on the machine with internet access and then scp
all dependencies from my_env/lib/python3.6/site-packages
to the remote machine.
Then I'd pip install
from there.
Ideal scenario:
Machine with internet
$ python -m venv my_env
$ source ./my_env/bin/activate
(my_env) $ pip install lime
Then send my_env/lib/python3.6/site-packages
to the remote machine (let's name itsource_packages/
)
Machine without internet
$ sudo pip install lime --find-everything-in ./source_packages
I have tried
pip install lime --no-index --find-links path/to/my_env/lib/python3.6/site-packages/
But this raises an error:
Collecting lime
Could not find a version that satisfies the requirement lime (from >versions: ) No matching distribution found for lime
EDIT
The proposed solutions (see comments) are close to working except I have platform compatibility issues. Internet machine is a Mac, remote server is CentOS.
I'm therefore afraid that unzipping site-packages/ in the server's lib/python3.6/ directory would fail in some cases.
Regarding the pip download
solution, it is also partial as default behavior is to download according to current platform but the --platform
flag only works with binaries. A package as lime
can't therefore be downloaded specifying the platform.
A workaround would be to be able to run something in the likes of
pip download --only-binary=:all: --platform=linux_x86_64 lime
but with a fallback to download the source if the binary asked for is not available