Python: query distutils to find site-packages directory#24095
Python: query distutils to find site-packages directory#24095tgamblin merged 6 commits intospack:developfrom
Conversation
permeakra
left a comment
There was a problem hiding this comment.
still doesn't work. I think, tuning the glob rule is required. After switching to this pr branch, I got cython libs installed into
/home/permeakra/spack/opt/spack/linux-ubuntu20.04-haswell/gcc-9.3.0/py-cython-0.29.22-iyt6swlafaunff4uawkj7w6adtq2wusm/lib/python3/dist-packages/
but a directory
/home/permeakra/spack/opt/spack/linux-ubuntu20.04-haswell/gcc-9.3.0/py-cython-0.29.22-iyt6swlafaunff4uawkj7w6adtq2wusm/lib/python3.8/site-packages/
still existed and was pulled into PYTHONPATH instead.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Can everyone test this latest version? You don't need to rebuild anything, just try to use an external Python with this latest commit. I was able to successfully install It looks like some of the unit tests are failing because we install a fake |
|
After double checking that the 'before' state failed, applying this this change made my py-numpy install work. Looks good to me. |
|
@alalazo to get the test to pass, I think there's two approaches we could take:
(2) might be helpful in the case where someone is using an external Python and distutils is not installed (I think I remember someone reporting a case like this, was it @michaelkuhn?) |
|
@alalazo can you explain the clingo test failure? |
For clingo unit tests we currently bootstrap clingo from sources (with |
|
Any idea how the changes in this PR could have broken that? I didn't change any of the detection logic. |
No, I need to try reproduce the issue. |
0b601af to
bc2b69e
Compare
|
@spackbot run pipeline |
|
I've started that pipeline for you! |
|
Style tests are now fixed. Failing clingo builds are also now magically fixed? I'm suspicious about that, but won't question it if it helps this PR to get finally merged. |
|
@spackbot run pipeline |
|
I've started that pipeline for you! |
|
@tgamblin can you re-review? |
spack#24095 introduced a couple of bugs, which are fixed here: 1. The module path is computed incorrectly for bootstrapped clingo 2. We remove too many paths for `sys.path` in case of failures
#24095 introduced a couple of bugs, which are fixed here: 1. The module path is computed incorrectly for bootstrapped clingo 2. We remove too many paths for `sys.path` in case of failures
spack#24095 introduced a couple of bugs, which are fixed here: 1. The module path is computed incorrectly for bootstrapped clingo 2. We remove too many paths for `sys.path` in case of failures
Add a workflow to test bootstrapping clingo on different platforms so that we can detect changes that break it. Compute `site_packages_dir` in `bootstrap.py` as it was before #24095, until we figure a better way to override that attribute.
|
Unfortunately, it looks like we're going to have to find a different way to do this. Python 3.10 is deprecating distutils and it will be removed completely in 3.12: https://docs.python.org/3.10/whatsnew/3.10.html#distutils |
|
I'll try to think of a solution, let me know if you have ideas. We need something like this with a package override to finish #25371 (the only thing missing there would be bootstrapping pytest for developers). |
This is a direct followup to #13557 which caches additional attributes that were added in #24095 that are expensive to compute. I had to reopen #25556 in another PR to invalidate the GitLab CI cache, but see #25556 for prior discussion. ### Before ```console $ time spack env activate . real 2m13.037s user 1m25.584s sys 0m43.654s $ time spack env view regenerate ==> Updating view at /Users/Adam/.spack/.spack-env/view real 16m3.541s user 10m28.892s sys 4m57.816s $ time spack env deactivate real 2m30.974s user 1m38.090s sys 0m49.781s ``` ### After ```console $ time spack env activate . real 0m8.937s user 0m7.323s sys 0m1.074s $ time spack env view regenerate ==> Updating view at /Users/Adam/.spack/.spack-env/view real 2m22.024s user 1m44.739s sys 0m30.717s $ time spack env deactivate real 0m10.398s user 0m8.414s sys 0m1.630s ``` Fixes #25555 Fixes #25541 * Speedup environment activation, part 2 * Only query distutils a single time * Fix KeyError bug * Make vermin happy * Manual memoize * Add comment on cross-compiling * Use platform-specific include directory * Fix multiple bugs * Fix python_inc discrepancy * Fix import tests
Third-party Python libraries may be installed in one of several directories:
lib/pythonX.Y/site-packagesfor Spack-installed Pythonlib64/pythonX.Y/site-packagesfor system Python on RHEL/CentOS/Fedoralib/pythonX/dist-packagesfor system Python on Debian/UbuntuPreviously, Spack packages were hard-coded to use the (1). Now, we query the Python installation itself and ask it which to use. Ever since #21446 this is how we've been determining where to install Python libraries anyway.
Note: there are still many packages that are hard-coded to use (1). I can change them in this PR, but I don't have the bandwidth to test all of them.
Fixes #24076
Fixes #24526
@skosukhin @permeakra @wspear can you test this?