This question already has answers here:
How to install packages offline?
(12 answers)
installing python packages without internet and using source code as .tar.gz and .whl
(7 answers)
Closed 1 year ago.
I have two linux servers, one can be connected to the Internet, and the other can't. I downloaded some libraries using pip install library on a server that can be connected to the Internet, and I want to transfer it to another server. But how to set install paths? And how do I know which files are installed by pip? Or is there a better way to achieve this?
Thanks
I would utilize wheel in this case, which can make packages that you can bring to your offline machine. For example with numpy
pip wheel numpy
Collecting numpy
Downloading numpy-1.20.2-cp37-cp37m-win_amd64.whl (13.6 MB)
Saved c:\numpy-1.20.2-cp37-cp37m-win_amd64.whl
Then on your other machine copy these wheels and use pip
pip install numpy-1.20.2-cp37-cp37m-win_amd64.whl
You can do a similar thing with requirements.txt to gather a number of wheels at once.
I think the easiest thing to do would be to install the modules in a virtual environment, e.g. python3 -m venv .venv followed by your pip install <module> and then copy the entire .venv directory to the remote machine.
Cory Kramer suggests using wheels which a good alternative option too. Either method should work.
Related
This question already has answers here:
How to install packages offline?
(12 answers)
Closed 2 years ago.
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?
Is there any reason you are not using a python packager?
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
This question already has answers here:
List dependencies of Python wheel file
(7 answers)
Closed 3 years ago.
I want to install many packages on an offline computer, I download and install manually using the following code:
pip install XXXXX.whl --user
Although the code above does the offline installation, the package needs other packages so it tries to connect to the internet. I can see what package it is looking for. So, I will download manually and again install that. If there are a lot of packages required, it becomes overwhelming.
Any better solution? Can I know from the beginning that what packages have to be downloaded for installing my package?
Do you use anaconda?
Make a conda environment on your online pc and install all your packages you need.
Then check with
'''
conda list
'''
What packages you need.
This question already has answers here:
installing python packages without internet and using source code as .tar.gz and .whl
(7 answers)
Closed 4 years ago.
On my job, I need to install pymysql on several secured servers. They do not allow internet access, so I can not use pip. I did download the pymysql egg, but this requires cryprography. So I downloaded the cryptography wheel, but when running pip install on that it tries to get additional data from the web.
I'm using python3.7. Any way to get the whole pymysql package including all dependencies off line?
install pipmysql without internet
To install pmyssql on a system with no internet connectivity, you first download pymssql to a system.
Follow these steps:
1) Download the Windows installer for the Python version and processor
that is compatible with your system from the following website:
https://pypi.python.org/pypi/pymssql/2.1.1#downloads.
2) Copy the file to the CA Strong Authentication or CA Risk
Authentication server.
3) Run the installer and follow the prompts.
#zappfinger. I would suggest you download your main package and its dependencies to a local directory. Then use pip install -r requirements.txt to perform your task. For more information read link and have a look at pip help install. You should normally get your work done after carefully consulting all these help.
With the wheel's for both pymysql and cryptography in the same folder on your server, try:
pip install --find-links DIR --no-index pymysql
--find-links and --no-index will force pip to resolve the dependency only using the files in the directory DIR.
See:
https://pip.pypa.io/en/stable/user_guide/#installing-from-local-packages
installing python packages without internet and using source code as .tar.gz and .whl
And check out: https://pythonhosted.org/Basket/ for a way to put together a "basket" of packages w/ dependencies for this type of situation.
This question already has answers here:
How to install PyPi packages using anaconda conda command
(3 answers)
Closed 4 years ago.
I use Anaconda as the main source of python packages and also my main interpreter in PyCharm. If I want to install any package, I go to Anaconda Cloud and find it immediately something like this. Now, I want to install a package that only exists in Python Package Index here. I cannot find it in Anaconda Cloud so I don't know how to install it. Do I just need to include the package folder in the project directory in this case?
Thank you
You can install non-conda packages using pip:
pip install python-nonblock
This question already has answers here:
Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?
(2 answers)
Closed 9 years ago.
I am using virtualenv version 1.7.1.2 with python 2.7.3 to create virtual python ennvironments. But when I create such an environment and activate it, I can see the following packages are installed (using pip freeze):
argparse==1.2.1
distribute==0.6.24
wsgiref==0.1.2
Why is that? What does that mean?
These are the standard packages, and will always follow with that version of Python and Virtualenv.
distribute is pretty self-explainatory. It's necessary for pip. Distribute also contains setuptools, but inside the package so not recognized with pip freeze. For more information about what it actually does check out your env/lib/python2.7/site-packages/distribute-0.6.31-py2.7.egg.
wsgiref is actually a part of the standard library, but isn't recognized as so. There's a bug report on it, and it's fixed in Python 3.3+. Read more about it in Why does pip freeze report some packages in a fresh virtualenv created with --no-site-packages?
I can't find out why argparse is there though, but my guess is because it's a dependency or something like wsgiref. Finding package dependencies in Python can be a bit hacky/painful though, especially if it's already installed in your virtualenv.