-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using --no-binary disables reuse of locally compiled wheels #9162
Comments
I'm pretty sure that it's expected since cache stores binary wheels and you're telling pip not to use those. |
Correct. Using locally cached and built wheels in spite of For context, remember that building from source can (in theory) result in a different wheel every time you build. That's clearly not the intended way builds should work, but |
@Kirill888 if for some reason you want to build certain packages from sdist, you could create a wheelhouse dir with |
Thanks everyone I guess my interpretation of what For certain library X do not use manylinux wheels that are published on pypi, but instead compile on a local machine, but don't recompile it every time (as this can be really slow, tens of minutes). This is particularly true for numpy, as it is a common build time dependency for all the other numeric libraries out there. My issue is that I can not easily force installation of locally compiled numpy as a build dependency for other libraries. So my options are
I maintain a largish Python environment used for scientific workflows, and while I love the fact that most hard to compile modules now ship with easy to install binary wheels, they are not great for "production". Awesome for experimentation, you can try out new library without investing time into understanding build requirements, not so great for production where you want best performance. For numeric code using more modern compiler alone can give you ~20% performance gain, easy (manylinux GCC is rather old one). But the main gains are from linking to performance libraries of course. Other reason to compile locally is to avoid binary dependency version conflicts, say Other than maintaining |
Agree, I realize that almost no compiled software these days support reproducible builds, and I know how insanely hard it is to achieve that. What's worse, you can get very different functionality, not just different hash, for a compiled wheel depending on what libraries were installed at the time of compilation. But that's not a reason to disable caching, it's a reason to be aware of the cache, but not to disable it altogether. What is the behaviour for a module that requires compilation, but only ships source code? Something like say What I'm after is essentially "for library X pretend that there are no wheels for your platform, so fetch sources, compile them, cache the wheels, reuse the wheels". |
I thought manylinux had a mechanism for declaring what manylinux versions you supported? Sorry, I'm not a linux specialist, so I don'yt have details. A quick search says that you want a
|
This is why they say cache invalidation is one of the two most difficult things in programming 😉 Wheel tags are limited and cannot capture all the possible compile-time variants, and pip has no way to know a previously-built wheel in cache is actually compatible with what you’re trying to do. So when you say The |
Thanks for the link to PEP 513, I was not aware of this, it might prove useful. I was not looking for that because I do not want to disable ALL manylinux wheels, just binary wheels for those libraries that ship mutually incompatible binaries or problematic for other reasons, for example libs that link to
Yet, for modules that do not ship wheels, but only sources, locally compiled wheels are cached and do get reused.
In the python environment I have, there are ~70 python modules that depend on We can probably close this issue, as I clearly misinterpreted what |
I don’t think this is the case, and would consider it a bug if it is. |
builds |
Is numpy a build requirement for scipy and pandas? That's very different than if it's a runtime dependency. If you want to avoid setting up multiple build environments, you should be using |
It is unfortunate that
@Kirill888 's arguments resonate with me, and I believe disentangling cache control from |
Environment
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 ofpip 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
Above works as expected, downloads and caches source distribution for Cython, compiles it, stores compiled wheel in cache and copies into current working directory.
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.
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
andnumpy
which are commonly needed as a dependency for building other packages, but can also benefit from being compiled locally rather than usingmanylinux
wheels. If you do something likepip wheel --no-binary :all: pandas scipy numpy
you'll be recompilingnumpy
andCython
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.
The text was updated successfully, but these errors were encountered: