-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[BUG] pyproject.toml: name, version not recognized (UNKNOWN 0.0.0) #3269
Comments
Hi @nschloe , is it the case you have a |
No, it's all there. Let me try and construct an MWE. |
Thank you very much Nico. I don't know exactly what is the problem, it seems to be working fine when installed in a virtual environment: cd /tmp
git clone https://github.com/nschloe/setuptools-UNKNOWN-bug.git
cd setuptools-UNKNOWN-bug
virtualenv -p python3.10 .venv
.venv/bin/python -m pip install . Cloning into 'setuptools-UNKNOWN-bug'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 12 (delta 0), reused 12 (delta 0), pack-reused 0
created virtual environment CPython3.10.4.final.0-64 in 6163ms
creator CPython3Posix(dest=/tmp/setuptools-UNKNOWN-bug/.venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/abravalheri/.local/share/virtualenv)
added seed packages: pip==22.0.4, setuptools==60.9.3, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Processing /tmp/setuptools-UNKNOWN-bug
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: foobar
Building wheel for foobar (pyproject.toml) ... done
Created wheel for foobar: filename=foobar-1.2.3-py3-none-any.whl size=1637 sha256=f907c18db190782ff7e3066eecd072fd76ec5a4777809cf7f8325309cb24937a
Stored in directory: /home/abravalheri/.cache/pip/wheels/d5/45/27/903aaeecfb5f483be8a106ef7e408201b853f57c4b50642397
Successfully built foobar
Installing collected packages: foobar
Successfully installed foobar-1.2.3 It also seem to be OK when running from a container: > docker run --rm -it python:3.10-bullseye /bin/bash
cd /tmp
git clone https://github.com/nschloe/setuptools-UNKNOWN-bug.git
cd setuptools-UNKNOWN-bug
pip install . Cloning into 'setuptools-UNKNOWN-bug'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 12 (delta 0), reused 12 (delta 0), pack-reused 0
Receiving objects: 100% (12/12), done.
Processing /tmp/setuptools-UNKNOWN-bug
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: foobar
Building wheel for foobar (pyproject.toml) ... done
Created wheel for foobar: filename=foobar-1.2.3-py3-none-any.whl size=1637 sha256=652ef47f8ff8cd03e54c981d121e61618e95a60d1ca5f7592588f0baecc75def
Stored in directory: /root/.cache/pip/wheels/d5/45/27/903aaeecfb5f483be8a106ef7e408201b853f57c4b50642397
Successfully built foobar
Installing collected packages: foobar
Successfully installed foobar-1.2.3
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv Have you tried updating pip? Maybe that would help? |
It also works in a venv here. pip is at the latest version. There's got to be something wrong with my installation. Geez, I wish I had any clue at all. |
Are you using the system-provided Python and pip (i.e. the ones in |
It's all in |
Any chance this originates from caches of previous builds? Does it persist even after a |
Yup, even then. I noticed, however, that pip creates a |
Can you run |
I could also add some |
I wonder if this is related to pypa/pip#6264 (comment) It would seem that an older version of setuptools is being loaded from outside the environment prepared by pip. |
Yup, that’s what this looks like. You’re almost certainly using a Debian-patched Python which behaves incorrectly with pip and how it handles build isolation. |
I'm indeed on Ubuntu 22.04. I've now tried the fixed (?) Python from the deadsnakes PPA (https://launchpad.net/~deadsnakes/+archive/ubuntu/python3.10-jammy), still to no avail.
|
I don't know what this patch does, but just to make sure the problem we discuss in pypa/pip#6264 (comment) is the case, would it be possible for you to try updating the version of setuptools in |
deadsnake (intentionally) distributes exactly the same Python patches as Debian, simply backporting (and forward-poarting, is that a thing?) them to more system versions. So if something does not work right with the system Python, it’s likely to also not work with a deadsnake Python—that’s an explicit design goal. But whatever the problem is, it very likely roots in the a patch that breaks build isolation. |
This is a reproducer based on the issue previously reported in the pip tracker: > docker run --rm -it debian:11 /bin/bash
apt update && apt install -y python3 python3-dev curl git
cd /tmp
curl -sSL https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --no-setuptools --no-wheel
python3 -m pip install -Uv setuptools==44.0.0
python3 -m pip list
# Package Version
# ---------- -------
# pip 22.0.4
# setuptools 44.0.0
python3 -c 'import setuptools; print(setuptools.__path__, setuptools.__version__)'
# ['/usr/local/lib/python3.9/dist-packages/setuptools'] 44.0.0
git clone https://github.com/nschloe/setuptools-UNKNOWN-bug
cd setuptools-UNKNOWN-bug
pip install . -vv
# ...
# Successfully installed UNKNOWN-0.0.0
# ... Note that when we update the root installation of setuptools, the project builds correctly, which indicates that the python3 -m pip install -Uv setuptools==62.1.0
pip install . -vv
# ...
# Successfully installed foobar-1.2.3
# ... My conclusion is that it is the same problem, and based on what @uranusjr just discussed, deadsnakes patches are either the same as upstream debian/ubuntu or not enough to workaround this issue. |
@nschloe, if you can confirm that is the case, I think we can close this issue as a duplicate and follow the original discussion in pypa/pip#6264 for updates. |
Indeed, this is the problem. I've "fixed" it by removing the system setuptools,
Now it all builds correctly. |
Thank you very much for confirming @nschloe |
I think this person had the same problem :-) |
Judging from the 2004 upload, I’m pretty sure that’s a differnt problem. pyproject.toml wasn’t invented until 2016. |
I've read through all of this but still have no idea what the solution is. I've updated to the latest pip. Can anyone succinctly describe a solution on Ubuntu 22.04? I'm in a dev container already, so I'm not using venv. |
I recall I might have worked around this by specifying these things in any other way, such as the traditional setup.py . |
Which is aggravating since then you get deprecation warnings non-stop... |
Have you tried setting DEB_PYTHON_INSTALL_LAYOUT=deb_system, in you dev container, or exporting it before running pip? There is a longer explanation here #3269 (comment), but I found that help me. Though I thought it had been fixed by now... as I don't seem to have that set /etc/environment any more. |
The issue is occurring at build time, not at install time. I'm trying to build a wheel using this command line:
|
I just changed back to a setup.py. |
I ran into this issue using |
Otherwise a form of this issue occurs due to older setuptools not supporting pyproject.toml: pypa/setuptools#3269 Might be resolved on Ubuntu 24.04 images.
Otherwise a form of this issue occurs due to older setuptools not supporting pyproject.toml: pypa/setuptools#3269 Might be resolved on Ubuntu 24.04 images.
Otherwise a form of this issue occurs due to older setuptools not supporting pyproject.toml: pypa/setuptools#3269 Might be resolved on Ubuntu 24.04 images.
Ran into this issue installing my package in a Docker. Fixed it by just upgrading pip before installing my package: pip install --upgrade pip
pip install . |
same, worked well, thank you @kikefdezl |
Without this step, the pyproject.toml file is not correctly parsed, see e.g. this action which fails: https://github.com/Urban-Analytics-Technology-Platform/web-app-template/actions/runs/9894661493/job/27332702540#step:7:108 Notice that the package name is UNKNOWN and the wheel file is UNKNOWN-0.0.0-py3-none-any.whl. This causes the web template to break because it expects my-python-module.<stuff>.whl. I think this is essentially an extension of pypa/setuptools#3269. Installing a proper version of Python (which presumably includes pip and setuptools) fixes this issue.
Without this step, the pyproject.toml file is not correctly parsed, see e.g. this action which fails: https://github.com/Urban-Analytics-Technology-Platform/web-app-template/actions/runs/9894661493/job/27332702540#step:7:108 Notice that the package name is UNKNOWN and the wheel file is UNKNOWN-0.0.0-py3-none-any.whl. This causes the web template to break because it expects my-python-module.<stuff>.whl. I think this is essentially an extension of pypa/setuptools#3269. Installing a proper version of Python (which presumably includes pip and setuptools) fixes this issue.
Without this step, the pyproject.toml file is not correctly parsed, see e.g. this action which fails: https://github.com/Urban-Analytics-Technology-Platform/web-app-template/actions/runs/9894661493/job/27332702540#step:7:108 Notice that the package name is UNKNOWN and the wheel file is UNKNOWN-0.0.0-py3-none-any.whl. This causes the web template to break because it expects my-python-module.<stuff>.whl. I think this is essentially an extension of pypa/setuptools#3269. Installing a proper version of Python (which presumably includes pip and setuptools) fixes this issue.
See pypa/setuptools#3269 for more details
The pip installation of local project via pyproject.toml can have issues on ubuntu-22.04 which is used by GitHub CI. The pip upgrade should solve the issue. Reference: pypa/setuptools#3269 Signed-off-by: Jan Richter <jarichte@redhat.com>
setuptools version
62.1.0
Python version
3.10
OS
Ubuntu 22.04
Additional environment information
No response
Description
I recently started using Python 3.10 and found the
pyproject.toml
-based installation lacking. It now doesn't readsname
andversion
incorrectly:Any idea why this might be? Perhaps package that's missing in my 3.10 installation? I was surprised not to get an error message here either.
The text was updated successfully, but these errors were encountered: