21

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

33
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
Sign up to request clarification or add additional context in comments.

3 Comments

Ok but how do you find the wheel directory programmatically?
@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.
On Windows, Python 3.6.8 I had to remove the --find-links option in order for it to work.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.