trying out the new pex-based lockfiles in 2.11, an...
# general
s
trying out the new pex-based lockfiles in 2.11, and running into a roadblock. not sure if a bug in pants/pex or a side effect of my repo’s ugly dependency tree 🤔 I’m running on an intel mac in my
requirements.txt
I have:
Copy code
numpy==1.19.5
opencv-python-headless==4.5.5.62
this works fine with vanilla
pip install
, but when I run
./pants generate-lockfiles
I get the failure:
Copy code
ERROR: Cannot install numpy==1.19.5 and opencv-python-headless==4.5.5.62 because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit <https://pip.pypa.io/en/latest/user_guide/#fixing-conflicting-dependencies>
The conflict is caused by:
     The user requested numpy==1.19.5
     opencv-python-headless 4.5.5.62 depends on numpy>=1.21.2; python_version >= "3.6" and platform_system == "Darwin" and platform_machine == "arm64"
I checked the
setup.py
for that version of
opencv-python-headless
and confirmed that the newer numpy version is only required when running on ARM (see here). Is it a mistake that pex lockfile generation is trying to resolve a dependency for
platform_machine == "arm64"
when I’m running on an intel mac? or is this the correct behavior because the lockfile is trying to support both intel and m1 macs?
e
It's the latter. Pants asks Pex unconditionally to create a
--style universal
lock. That means resolve for all platforms (and all Python versions implied by any relevant interpreter constraints configured in the repo).
s
I was afraid you’d say that 🙂 but makes sense to me
e
There is currently no way to tell Pex universal, except for these platforms.
I'll think on if that is possible for Pex to support. It seems like it would be.
👍 1
h
We also could still add some modeling to pants to indicate that you do not want a universal lock. Even though many organizations will need a universal lock because not everyone uses the exact same platform, I can imagine some teams will be consistent. John has pointed out the security implications of not using universal https://github.com/pantsbuild/pants/issues/12458 I only paused to try to tackle that because the Python sub system is already so damn complex and I did not want to add anything until we finish removing the old stuff like poetry