I have a server (RHEL) that I need to install specific python packages on. However, my server is firewalled off from internet access so I am not able to install any packages using pip. Is there a way to "manually" download packages to my local workstation and then push them and install them to my isolated RHEL system. Is this possible? Is it possible to manually push python packages and install them onto a system without internet access?
Asked
Active
Viewed 5.3k times
3 Answers
6
from a pc that connected to internet :
pip download yourpackage
copy "yourpackage.tar.gz" to server in server :
pip install "path/yourpackage.tar.gz"
if package have ".whl" file :
pip install "path/yourpackage-version.whl"
Phonix
- 159
-
1I think "pip download" only works in Python 3. For those who happen to still be in Python 2, "pip install --download . yourpackage" may be the equivalent. – Paul Brinkley Sep 03 '19 at 17:03
-
How to do this for Anaconda? – Murtaza Haji Aug 09 '20 at 21:10
1
Solved it...all that really needs to be done is to tar up the "site-packages" directory from a server that has the packages installed and then restore that on the desired target server.
GregH
- 891
0
Yes. You can download a package from PyPI, untar it and run setup.py:
python setup.py
gronostaj
- 57,004
-
Shouldn't that be:
tar -zxvf packagename.tar.gz ; cd packagename; python setup.py- you may well need to take care of dependencies first though. – Hannu Jul 22 '15 at 19:16 -
Does this handle all of the dependent packages as well? So if I had pip installed a package, can I package up my software along with the package that I installed using pip so it can be deployed to other servers? – GregH Jul 22 '15 at 20:27
-
setup.pyis a regular Python file, it will do whatever you put in it. It's just a convention to put package installation routine in a file calledsetup.py, you could as well use arpm-s,deb-s or atarfile with installation procedure described in a README file - it doesn't matter as long as all files are placed where they should be. You definitely can include all dependencies, but it's not the smartest thing to do - they will become outdated quickly. – gronostaj Jul 22 '15 at 21:36 -
Solved it...all that really needs to be done is to tar up the "site-packages" directory from a server that has the packages installed and then restore that on the desired target server. – GregH Jul 24 '15 at 05:23