Is it possible to install packages using pip from the local filesystem?
I have run python setup.py sdist
for my package, which has created the appropriate tar.gz file. This file is stored on my system at /srv/pkg/mypackage/mypackage-0.1.0.tar.gz
.
Now in a virtual environment I would like to install packages either coming from pypi or from the specific local location /srv/pkg
.
Is this possible?
PS
I know that I can specify pip install /srv/pkg/mypackage/mypackage-0.1.0.tar.gz
. That will work, but I am talking about using the /srv/pkg
location as another place for pip to search if I typed pip install mypackage
.
This is very simple. The command you need is:
Note that the directory must have a
setup.py
file in itWhat about::
eg,
pip install -e /srv/pkg
where /srv/pkg is the top-level directory where 'setup.py' can be found.
I am pretty sure that what you are looking for is called
--find-links
option.Though you might need to generate a dummy
index.html
for your local package index which lists the links to all packages. This tool helps:https://github.com/wolever/pip2pi
I am installing
pyfuzzy
but is is not in PyPI; it returns the message:No matching distribution found for pyfuzzy
.I tried the accepted answer
But it does not work either and returns the following error:
At last , I have found a simple good way there: https://pip.pypa.io/en/latest/reference/pip_install.html
So the following command worked for me:
Hope it can help you.
Having requirements in
requirements.txt
andegg_dir
as a directoryyou can build your local cache:
$ pip download -r requirements.txt -d eggs_dir
then, using that "cache" is simple like:
$ pip install -r requirements.txt --find-links=eggs_dir
An option --find-links does the job and it works from
requirements.txt
file!You can put package archives in some folder and take the latest one without changing the requirements file, for example
requirements
:Now in
requirements/base.txt
put:A neat way to update proprietary packages, just drop new one in the folder
In this way you can install packages from
local folder
ANDpypi
with the same single call:pip install -r requirements/production.txt
PS. See my cookiecutter-djangopackage fork to see how to split requirements and use folder based requirements organization.