-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flit's dynamic description is not working with pip 22.2 along with python 3.8, 3.9 #11294
Comments
Your package builds and installs fine for me (see below). 😕 It looks like pip is using some distutils/setuptools code to work out destination paths, and setuptools ends up trying to parse the metadata from Do you have any pip config in files or environment variables?
|
Thanks for the comment. When I try to install my package with Python 3.10, the installation succeeds. 🤔 But not with 3.8, 3.9. P.S. I think I haven't set any pip configuration. |
Thanks, when I make a Python 3.9 environment, I do see the same error. I still don't think this is a Flit bug - I think the issue is somewhere between pip & setuptools, because it looks like setuptools is trying to get the package metadata as if it was a setuptools package, which is wrong. But I don't know when I'll have time to dig into it to work out exactly what is going wrong. Other than digging through the traceback to figure out what is going on, you could try using git bisect to identify which change in pip introduced or revealed the problem. |
I agree with that flit is innocent 😇 Thanks for gentle and quick response. |
Pinging @abravalheri since setuptools' pyproject.toml support seems to be implicated in this. |
Any chance |
I can confirm why this isn't failing on 3.10 -- on 3.10+, pip's using the sysconfig paths and avoid importing/using distutils entirely. That's why the code never reaches the
I don't think that should happen? The only reason that I can think of is if setuptools' distutils hack has some logic to detect pip that's broken in 22.2. FWIW, this only happens for local installations and not when installing from a zipfile.
|
I can confirm that the custom import logic don't seem to be working for pip 22.2: in Maybe we can avoid this error if Something like: - sys.meta_path.insert(0, PipImportRedirectingFinder())
+ def _install():
+ for i, finder in enumerate(sys.meta_path):
+ if "DistutilsMetaFinder" in str(type(finder)):
+ sys.meta_path.insert(i + 1, PipImportRedirectingFinder())
+ return
+
+ sys.meta_path.insert(0, PipImportRedirectingFinder())
+
+
+ _install() |
Ah, well, that's interesting and would fix the immediate bleeding. I think it's reasonable for us to do a We actually changed this to the start on the rationale that no one else should try modifying pip before us (#11257 (comment)) but setuptools use case seems like a reasonable one. |
Thank you all for your support and interest. I'd be happy to wait. |
Thank you very much for the feedback @pradyunsg. There might be other ways of handling this in the setuptools side, but I think that this is the most straight forward... Without the custom finder intercepting @furiosamg, meanwhile you can try exporting |
@abravalheri Thanks, I checked that workaround works. Great! |
I'll move this over to pip, since we need to make a change on pip's end. |
thank you very much for posting this, @furiosamg! we ran into a related problem over in sourmash, sourmash-bio/sourmash#2139, where our ReadTheDocs build was failing with python3.8 and pip 22.2. I verified that downgrading to pip 22.1.2 fixed the problem, as did upgrading to python3.10 in the conda environment used for building the docs. I'm trying the latter out for the readthedocs fix. Nothing to be done, just wanted to chime in with another breaking build! Happy to help test or debug things if and as it would be helpful. (If others are having problems with pip 22.2 and readthedocs build, here is our fix) |
OK, could someone test and confirm that #11298 fixes the issue for them? |
The following (1) demonstrated the problem and (2) showed that the provided fix worked: cd $(mktemp -d)
git clone --no-single-branch --depth 50 https://github.com/sourmash-bio/sourmash .
# adjust environment.yml to point at python=3.8
# vi doc/environment.yml
mamba env create --name latest --file doc/environment.yml
conda activate latest
pip show pip
# pip version was 22.2
python -m pip install --upgrade --upgrade-strategy eager --no-cache-dir .[doc]
# FAILED
# now, update to @pradyunsg version of pip
mkdir foo
cd foo
git clone https://github.com/pradyunsg/pip.git .
git switch remove-distutils-shim
pip install .
cd ..
pip show pip
# Version: 22.3.dev0
python -m pip install --upgrade --upgrade-strategy eager --no-cache-dir .[doc]
# SUCCEEDED |
Just tried this out. Used to give me an error with Flit. Now confirmed it works with your fix @pradyunsg on
|
My initial minimal reproduction was also fixed. Python 3.8 (env-3.8) root@mg-shin-npu-0:~/flit-dynamic-pip-22# cd ~/pip
(env-3.8) root@mg-shin-npu-0:~/pip# git switch remove-distutils-shim
Branch 'remove-distutils-shim' set up to track remote branch 'remove-distutils-shim' from 'origin'.
Switched to a new branch 'remove-distutils-shim'
(env-3.8) root@mg-shin-npu-0:~/pip# pip install .
# Installed
(env-3.8) root@mg-shin-npu-0:~# cd ~/flit-dynamic-pip-22/
(env-3.8) root@mg-shin-npu-0:~/flit-dynamic-pip-22# python --version
Python 3.8.13
(env-3.8) root@mg-shin-npu-0:~/flit-dynamic-pip-22# pip --version
pip 22.3.dev0 from /root/.miniconda3/envs/env-3.8/lib/python3.8/site-packages/pip (python 3.8)
(env-3.8) root@mg-shin-npu-0:~/flit-dynamic-pip-22# pip install .
# SUCCEEDED Python 3.9 (env-3.9) root@mg-shin-npu-0:~/pip# git branch
main
* remove-distutils-shim
(env-3.9) root@mg-shin-npu-0:~/pip# pip install .
# Installed
(env-3.9) root@mg-shin-npu-0:~/pip# cd ~/flit-dynamic-pip-22/
(env-3.9) root@mg-shin-npu-0:~/flit-dynamic-pip-22# python --version
Python 3.9.12
(env-3.9) root@mg-shin-npu-0:~/flit-dynamic-pip-22# pip --version
pip 22.3.dev0 from /root/.miniconda3/envs/env-3.9/lib/python3.9/site-packages/pip (python 3.9)
(env-3.9) root@mg-shin-npu-0:~/flit-dynamic-pip-22# pip install .
# SUCCEEDED I also tested Python 3.10 version just in case, and it worked. Thanks! |
…es did not run successfully." when installing effect-form-validators in Python 3.9 environment. See: - pypa/pip#11294 for discussion on issue being introduced in pip 22.2 - https://github.com/pypa/pip/pull/11298/files for PR with possible fix
Hatch is affected too pypa/hatch#371 |
…dencies did not run successfully." when pip installing in Python 3.9 environment. See: - pypa/pip#11294 for discussion on issue being introduced in pip 22.2 - pypa/pip#11298 for fix, due to be included in pip 22.2.1 release
This reverts commit df6f44b.
This reverts commit 380fdf2.
This reverts commit b31e668.
Minimal reproduction: https://github.com/furiosamg/flit-dynamic-pip-22
I think flit's dynamic description generation is broken in pip 22.2.
When trying to install above package with pip 22.2, following error occurred.
The text was updated successfully, but these errors were encountered: