Giter Site home page Giter Site logo

Pip ignoring "numpy<2" requirement about pip HOT 9 CLOSED

jontwo avatar jontwo commented on July 30, 2024 1
Pip ignoring "numpy<2" requirement

from pip.

Comments (9)

henryiii avatar henryiii commented on July 30, 2024 3

The environment variable is PIP_CONSTRAINT, not PIP_CONSTRAINTS. Otherwise that would have worked.

from pip.

jontwo avatar jontwo commented on July 30, 2024 1

That didn't work, but I've figured it out - the build requirements are coming from the pyproject.toml file. If I change the numpy requirement to <2 then it builds OK.

[build-system]
requires = ["setuptools", "wheel", "Cython", "numpy<2"]
build-backend = "setuptools.build_meta"

from pip.

jontwo avatar jontwo commented on July 30, 2024

It might be possible to use the --config-settings parameter to pass the no isolation flag to the backend, but I haven't been able to get that to work. Something along these lines, maybe:

pip install . -C="--build-option=bdist_wheel"  -C="--build_option=--no-isolation"

from pip.

notatallshaw avatar notatallshaw commented on July 30, 2024

I assume this is the build process failing, build time requirements are defined by the package being built, and pip does not have very many options for directly controlling them. There is, however, one way:

Create a file called constraints.txt that has numpy<2 in it. Then export an environmental variable PIP_CONSTRAINTS PIP_CONSTRAINT that points to that file. Then rerun your command.

Constraints force pip to resolve within the bounds of the constraints specified, but does not have to install them, by setting it as an environmental variable it will apply to both your requirements and build requirements.

from pip.

notatallshaw avatar notatallshaw commented on July 30, 2024

Ah yes, I thought you had no control over the build requirements, if you do that should be the first approach.

from pip.

henryiii avatar henryiii commented on July 30, 2024

The flag is --no-build-isolation for pip. Build isolation is not handled by the backend, it's handled by build or pip. Build's flag is --no-isolation since it is always building.

You don't need wheel in your requirements most likely. Also, be sure to fix this to support numpy 2 as soon as possible, as your output wheel won't support numpy 2 if it's built with numpy 1, while a numpy 2 wheel also supports numpy 1.

from pip.

jontwo avatar jontwo commented on July 30, 2024

So close!

from pip.

WrathOfChris avatar WrathOfChris commented on July 30, 2024

Sharing a synthesis snippit for all who arrive here with similar issues on other packages, like myself a few hours ago:

echo "numpy<2" >/tmp/constraint.txt
export PIP_CONSTRAINT=/tmp/constraint.txt
pip install pandas==1.2.3     # <-- change to your package/version

from pip.

notatallshaw avatar notatallshaw commented on July 30, 2024

Both ways of restricting build dependencies have been explained (directly updating build dependencies or using PIP_CONSTRAINT), closing issue.

from pip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.