Skip to content

Using --no-binary disables reuse of locally compiled wheels #9162

@Kirill888

Description

@Kirill888

Environment

  • pip version: 20.2.4
  • Python version: 3.8.5
  • OS: Ubuntu 20.04

Description

Using --no-binary=<some-lib> flag disables re-use of locally compiled and cached wheels for that library.

Expected behavior

When using --no-binary flag I expect locally compiled wheels to be cached and reused between invocations of pip wheel|install commands, but instead those get recompiled on every invocation.

How to Reproduce

Starting with empty cache, let's fetch and compile from source Cython package

pip wheel --verbose --no-deps --no-binary=Cython Cython

Above works as expected, downloads and caches source distribution for Cython, compiles it, stores compiled wheel in cache and copies into current working directory.

Stored in directory: /home/ubuntu/.cache/pip/wheels/82/f9/1a/ff4ade708988218648847e0438b632ce876aee8fa3c9b5fc6e

If we run this command again, I expect the cached version of the locally compiled wheel to be copied from cache, but instead Cython is re-compiled.

pip wheel --verbose --no-deps --no-binary=Cython Cython

So the locally compiled wheel is cached, but can never be extracted from the cache other than manually.

The impact of this is particularly noticeable for things like Cython and numpy which are commonly needed as a dependency for building other packages, but can also benefit from being compiled locally rather than using manylinux wheels. If you do something like pip wheel --no-binary :all: pandas scipy numpy you'll be recompiling numpy and Cython over and over again.

I have used constraints to work around this problem in the past, using paths to locally compiled wheels as constraints, but that is being deprecated as constraints are meant for versions only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: build logicStuff related to metadata generation / wheel generationC: cacheDealing with cache and files in itUX: functionality research epicTemporary label to link tickets to #8516

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions