This question already has answers here:
How to install packages offline?
(12 answers)
Closed 5 months ago.
I am not able to use PIP on this device, so I need to install a module manually. The only problem is that I have to install like 30 dependencies of this module. I would have to download, unzip, include and install them all one by one.
Is there any faster way, like downloading a module with all its dependencies included?
If all requirements are pip packages, a quick solution might involve creating a lean python environment on another machine, installing the package using pip, and then copying over all of the resultant wheel files to the restricted machine either via SSH or another method.
Related
This question already has answers here:
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings
(22 answers)
Closed 1 year ago.
F:\Hacking\GitHub\sherlock>python3 -m pip install -r requirements.txt
Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.
You provided limited information
First off check if you have installed python: I suggest using Anaconda. It's quite straightforward.
After that create a conda (Anaconda) environment (imagine it as a space that you can have different versions of packages- Python packages tend to be very dependent on the version of related packages, conda usually check the compatibility of them when you are installing them)
Using pip and conda together can be tricky. I suggest first install the main packages then go for more specialized one, maybe using pip
Try to have an issue on the github page of the project. If the package is popular or fresh, they usually respond fast.
This question already has answers here:
Is there a way to list pip dependencies/requirements?
(10 answers)
How to list dependencies for a python library without installing? [duplicate]
(3 answers)
List Python packages that will be installed from requirements.txt
(2 answers)
Closed 1 year ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
Let's say I have a setup.cfg (or setup.py) file with all the packages listed.
Now, if I run pip install . it'll install all packages and it's dependencies listed in install_requires. Is there a way to only get the list of packages and dependencies without downloading or installing them, like in a requirements.txt format?
This command I'm looking for ideally would also work for pip install '.[tests]', which would list packages defined for tests under extras_require in setup.cfg.
What this question is NOT asking:
I'm not asking for pip freeze or pip list type of command which lists all the packages installed in an environment. Rather I want the same type of list, just not of the packages already installed but of the packages that will be installed by the defined configuration in setup.cfg.
I'm not asking about how to generate this list by downloading these packages either, but only to collect them. I don't see why pip would need to download these packages when what I need is only the list of the packages and dependencies with their versions.
SOLUTION
stackoverflow marked this question as a duplicate which it is NOT. I have found a solution however because this question is closed I won't be able to submit it as an answer, but will post it here in the question instead.
To generate requirements.txt for packages listed in install_requires in your setup.cfg or setup.py, you would need to install pip-tools.
pip install pip-tools
pip-compile
To generate a requirements.txt file that includes packages specified under extras_requires for tests and dev:
pip-compile --extra tests --extra devrequirements.txt file with packages listed under
This question already has answers here:
How to install packages offline?
(12 answers)
Closed 3 years ago.
I want to install a python3 package (in this specific case is torch and torchvision) on a cluster that is not connected to the external world. I have tried to do pip3 download <package> and then I move the file to the cluster and run pip3 install <downloaded-file> -t /custom/folder (because I am installing in one of the folders in my personal account, and not on the entire cluster).
When I run the install command, pip3 is trying to download numpy package -- for some reason (it is actually already installed and working on ipython3, I do not know why it is trying to download that).
Of course, the installation fails because there is no connection to the external world. Can I force python to download everything with any flags?
Moreover, I would like to be sure I am downloading the proper thing: the location from which I am downloading the file is different from the location where I want to install, the first it is a regular CPU and the second runs GPU and has CUDA installed.
Formal answer here. Pip is attempting to install a different version of numpy specified in your package's requirements. You can easily compare the version installed with pip freeze and the version it is attempting to download (before it fails).
To make the download and installation fool-proof you probably should create a requirements.txt file and then run pip download -r requirements.txt in the environment that is connected to the internet and then transfer to the non-connected environment and carry on with the installation.
Regarding the GPU/CPU difference between the packages, it is hard to tell without actually knowing which package this is, but if it's similar to tensorflow where you have completely different package names when using pip the lack of GPU should not affect the download process. See pip download documentation for more information.
This question already has answers here:
How to install packages offline?
(12 answers)
Closed 3 years ago.
I'm an experienced programmer, but very new to python. My company requires us to do development on a private network for some of our projects. There is a pypi index on the private network which can be used to install packages using pip. Recently, while needing to install a package, the pypi index when down and was down for several hours. Although it did come back up eventually, the situation begs the question, how do I install packages (maybe manually without pip) in the absense of an index? I've tried to google this, but came up empty. I'm sure there's a way, but I'm probably not searching for the right phrase. Thanks for any help with.
You can manually install Python packages if you have read access to the package repositories. Every Python package has a setup.py file in the root directory and you can do something like
python setup.py sdist
This creates a subdirectory called dist which contains a compressed archived file, tar.gz or .zip depending in your OS. You can pass this archived file to pip and install the package
pip3 install some-python-package.tar.gz
I would download the wheel and install that. For this to you do need to install the wheel package:
pip install wheel
You can then tell pip to install the project (and it'll download the wheel if available), or the wheel file directly:
pip install project_name # download and install
pip install wheel_file.whl # directly install the wheel
The wheel module is also runnable from the command line and you can use it to install already-downloaded wheels:
python -m wheel install wheel_file.whl
There are a few ways you can get around this issue. The two that I know of are:
Use a proxy to get to the standard PyPI. If your company permits it, then you can tunnel your traffic through their proxy and install packages from PyPA's standard locations.
Use a locally hosted index. All you need is a directory structured like https://pypi.org/simple/, and you can then pip install -i ~/my/personal/index/path and packages will be installed from there.
This question already has answers here:
How to install Python packages from the tar.gz file without using pip install
(7 answers)
Closed 5 years ago.
I have downloaded the tar file of the Python geohash package
I import functions from this package to use them inside my python programs. It works completely fine, but only inside its own folder, where it is extracted.
If I intend to use this package in any other location, it doesn't simply import that package.
What should I do if I want to use it anywhere in my system ?
(the package is only available through this tarfile, not through pip/sudo apt-get)
Simply untar/unzip the file and make sure you have setup.py visible. From you command prompt in windows or linux. Go to the dir of the package which you just unzipped/untarred and dir/ls to make sure that setup.py is there and then do the following:
If you are using virtualenv:
/path-to-your-venv/venv/bin/python setup.py install
If you are not using virtualenv
python setup.py install