Skip to content Skip to sidebar Skip to footer

Can Pip Install First Search Wheel In A Specified Local Dir And Then The Pypi?

Can pip install first search wheel in a specified local dir and then the pypi? If the specified local dir doesn't contain the want wheel, it will search the pypi. Especially when u

Solution 1:

Sure is. Add

--find-links some/local/directory/with/wheels

to the command line.

If you also add --no-index, it won't consult the online index.

If that doesn't work for you, try

--index-url=/some/local/directory --extra-index-url=https://pypi.org/simple

instead.

Solution 2:

pip is not intended for such usage. If you wanna use said local dir as a cache pip doesn't really use it because pip has its own cache. pip fills the cache during installation — it caches downloaded or built wheel files so the next time you run pip install -r requirements.txt with the same requirements.txt it uses wheels from the cache. But pip anyway contacts PyPI (or any configured index URLs) to check if there are newer versions.

If you insist on using your local dir as the cache you can do it in two steps:

One — update your cache with absent wheels:

pip download -r requirements.txt --dest=local/dir

This makes pip to download dependencies that are not in the local dir. Wheels that are already there are not re-downloaded.

Two — install:

pip install -r requirements.txt --find-links=local/dir --no-index

Post a Comment for "Can Pip Install First Search Wheel In A Specified Local Dir And Then The Pypi?"