18

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?

1 Answer 1

29
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
3
  • 1
    Ok but how do you find the wheel directory programmatically?
    – cowlinator
    Commented Jan 12, 2022 at 21:22
  • 1
    @cowlinator Why would you want to do that? Sorry, cannot resist. ;-) The OP already has the wheel in a directory. If you want to download wheels use pip download. If you have another question please ask it separately; comments are for discussion of existing question and answers.
    – phd
    Commented Jan 12, 2022 at 23:10
  • On Windows, Python 3.6.8 I had to remove the --find-links option in order for it to work. Commented May 20, 2022 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.