pex-tool / pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs.
https://docs.pex-tool.org/
Apache License 2.0
2.5k stars 257 forks source link

Fix Pex to handle venvs with multiple site-packages dirs. #2383

Closed jsirois closed 4 months ago

jsirois commented 4 months ago

Previously the Pex venv code would blow up when it encountered a venv with multiple distinct site-packages directories. Although this was safe, it was unhelpful for virtualenvs created by modern Virtualenv on Red Hat based distributions where there is a separation between purelib (lib/pythonX.Y/site-packages) and platlib (lib64/pythonX.Y/site-packages). Interestingly this was not a problem for Python stdlib -mvenv virtualenvs since those create the lib64/ platlib directory as a symlink to the lib/ purelib directory. It's unclear who is constructing venvs correctly here, but given the Virtualenv layout, its definitely correct to honor the purelib / platlib distinction when installing wheels in venvs. Pex now does this and tests are added to confirm.

Also fix up various existing tests that failed on ARM machines where this problem was discovered.