Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python: pip install wheel dependencies from a folder

I know that I can create a wheel by first writing a setup.py and then typing

python setup.py bdist_wheel

If my wheels depend only on packages in pypi I know that I can install them by doing:

pip install mypkg.whl

Question: if my wheels depend on other of my wheels, can I have pip automatically install them from a folder? Essentially using a folder as a poor man's private pypi

To be more specific, if in pkg1 I have a setup.py:

from setuptools import setup
setup(
    ...
    name = "pkg1",
    install_requires = ["requests"],
    ...
)

And in pkg2 I have:

from setuptools import setup
setup(
    ...
    name = "pkg2",
    install_requires = ["pkg1"],
    ...
)

This will fail on installation because pip will try to look for pkg1 in pypi. Is it possible to tell it to just look in a folder?

like image 892
vefejer Avatar asked Jun 13 '20 18:06

vefejer


1 Answers

pip install --find-links /path/to/wheel/dir/ pkg2

If you want to completely disable access to PyPI add --no-index:

pip install --no-index --find-links /path/to/wheel/dir/ pkg2
like image 148
phd Avatar answered Nov 09 '22 01:11

phd