Skip to content

Feature request: ability to override pep425 checks #5355

@lorencarvalho

Description

@lorencarvalho

(relevant pypa-dev thread)

Hello! I have a use case where I'd like to download wheels, install them into a specific directory, then zip that directory up and move it to a different machine. More details can be found here & here.

I'm currently unable to "install" wheels that are not supported by my current arch/py-version/etc due to the PEP 425 check done via pip._internal.wheel.Wheel.supported.

Would it be possible to expose a way to override this check? I realize this is a bit of an edge case, but my only current alternative is to manually rename wheel files to "appear" supported so they pass the check. What I'd like to propose is either a command line arg (such as --force or --ignore-pep425) or (more preferably) an environment variable to influence this checking.

Here's a (very) simple example that seems to achieve what I'm proposing:

the diff

(venv) lcarvalh-mn1 ~/src/pip git:master ± ❱❱❱ git diff
diff --git a/src/pip/_internal/wheel.py b/src/pip/_internal/wheel.py
index 8dfe2d66..ddc31a8c 100644
--- a/src/pip/_internal/wheel.py
+++ b/src/pip/_internal/wheel.py
@@ -603,6 +603,8 @@ class Wheel(object):

     def supported(self, tags=None):
         """Is this wheel supported on this system?"""
+        if os.environ.get('PIP_IGNORE_PEP425', None):
+            return True
         if tags is None:  # for mock
             tags = pep425tags.get_supported()
         return bool(set(tags).intersection(self.file_tags))

Step 1: download a manylinux wheel of numpy on my Darwin workstation

(venv) lcarvalh-mn1 ~/src/pip git:master ± ❱❱❱ pip download --python-version 36 --platform manylinux1_x86_64 --abi cp36m --implementation cp --only-binary=:all: numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/71/90/ca61e203e0080a8cef7ac21eca199829fa8d997f7c4da3e985b49d0a107d/numpy-1.14.3-cp36-cp36m-manylinux1_x86_64.whl
  Saved ./numpy-1.14.3-cp36-cp36m-manylinux1_x86_64.whl
Successfully downloaded numpy

Step 2: try a normal install:

(venv) lcarvalh-mn1 ~/src/pip git:master ± ❱❱❱ pip install --target test_dir numpy-1.14.3-cp36-cp36m-manylinux1_x86_64.whl
numpy-1.14.3-cp36-cp36m-manylinux1_x86_64.whl is not a supported wheel on this platform.

Step 3: set an environment variable and install again

(venv) lcarvalh-mn1 ~/src/pip git:master ± ❱❱❱ PIP_IGNORE_PEP425=1 pip install --target test_dir numpy-1.14.3-cp36-cp36m-manylinux1_x86_64.whl
Processing ./numpy-1.14.3-cp36-cp36m-manylinux1_x86_64.whl
Installing collected packages: numpy
Successfully installed numpy-1.14.3

Thanks for looking!

-- Loren

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-lockedOutdated issues that have been locked by automationtype: feature requestRequest for a new feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions