13

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?

phd
  • 82,685
  • 13
  • 120
  • 165
vefejer
  • 153
  • 1
  • 1
  • 5

1 Answers1

21
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
phd
  • 82,685
  • 13
  • 120
  • 165
  • Ok but how do you find the wheel directory programmatically? – cowlinator Jan 12 '22 at 21:22
  • @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 Jan 12 '22 at 23:10
  • On Windows, Python 3.6.8 I had to remove the `--find-links` option in order for it to work. – jewbix.cube May 20 '22 at 19:42