Reputation: 260
I am working in an offline Linux env. (RedHat 7.6) until today I've used the full path to install the files with pip, and it works great. (still, do)
Now on automated testing, I want to create a virtual environment and pip install a requirements file.
The problem is, it keeps searching the web,
even though I've used --prefix
, and tried --target
I can't get it to install from a certain folder,
always try to search the web
requirements file:
numpy==1.16.4
folder:
/custom_dev/install/
inside the folder:
numpy-1.16.4-cp37-37m-manylinux_x86_64.whl
tried:
pip3 install -r requirements.txt --target=/custom_dev/install/
pip3 install -r requirements.txt --prefix=/custom_dev/install/
and other stuff from StackOverflow, I've yet to find a solution to my problem, or a thread with the same one, suggestions?
ty!
Upvotes: 1
Views: 744
Reputation: 94483
pip3 install -r requirements.txt --find-links=/custom_dev/install/ --no-index
The keyword to prevent pip
to connect to PyPI via the network is --no-index
.
Upvotes: 0
Reputation: 27311
Our pip-local
does that:
c:\srv\bin> cat pip-local.bat
@echo off
rem pip install with `--upgrade --no-deps --no-index --find-links=file:///%SRV%/wheelhouse`
pip %* --upgrade --no-deps --no-index --find-links=file:///%SRV%/wheelhouse
the linux version uses $*
instead of %*
and $SRV
instead of %SRV%
:
pip $* --upgrade --no-deps --no-index --find-links=file:///${SRV}/wheelhouse
You can remove the --no-deps
if you want dependencies to be found as well (although it will search the web if it can't find a wheel satisfying a dependency in your wheelhouse).
The companion tool is getwheel
c:\srv\bin> cat getwheel.bat
@echo off
rem
rem Download wheel file for package (getwheel foo==1.4.1)
rem
pip wheel --wheel-dir=%SRV%\wheelhouse %*
linux version:
pip wheel --wheel-dir=${SRV}/wheelhouse $*
which is used like:
getwheel numpy==1.16.4
or
getwheel -r requirements.txt
which causes the wheels of the package and its dependencies to be placed in the wheelhouse folder.
Upvotes: 2