setuptools: [BUG] pyproject.toml: name, version not recognized (UNKNOWN 0.0.0)
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 reads name and version incorrectly:
pip install .
Defaulting to user installation because normal site-packages is not writeable
Processing /path/to/foobar
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: UNKNOWN
Building wheel for UNKNOWN (pyproject.toml) ... done
Created wheel for UNKNOWN: filename=UNKNOWN-0.0.0-py3-none-any.whl size=1227 sha256=sgrhihehihg
Stored in directory: /path/to/.cache/pip/wheels/dsliughredshg
Successfully built UNKNOWN
Installing collected packages: UNKNOWN
Attempting uninstall: UNKNOWN
Found existing installation: UNKNOWN 0.0.0
Uninstalling UNKNOWN-0.0.0:
Successfully uninstalled UNKNOWN-0.0.0
Successfully installed UNKNOWN-0.0.0
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.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 35 (14 by maintainers)
Links to this issue
Commits related to this issue
- Build: migrate to pyproject.toml setup.py is now legacy Migrate to pyproject.toml To simplify things, move the package to a src folder, which is the standard way to organize a Python package (this m... — committed to iMichka/pygccxml by iMichka 3 years ago
- #3049 Fix UNKNOWN name error on SDist See https://github.com/pypa/setuptools/issues/3269 for more details — committed to agriyakhetarpal/PyBaMM by agriyakhetarpal 3 years ago
- Try ubuntu-20.04 for Read-the-docs There seems to be an issue with installing the strConstruct python package and as a result the rendered document looks incomplete. The package is named UNKNOWN for ... — committed to ValaJeyhani/strContruct by ValaJeyhani 3 years ago
- Try ubuntu-20.04 for Read-the-docs (#19) There seems to be an issue with installing the strConstruct python package and as a result the rendered document looks incomplete. The package is named UNKN... — committed to ValaJeyhani/strContruct by ValaJeyhani 3 years ago
- build: update pip and setuptools in dockerfile Otherwise a form of this issue occurs due to older setuptools not supporting pyproject.toml: https://github.com/pypa/setuptools/issues/3269 Might be re... — committed to idiap/coqui-ai-TTS by eginhard 3 years ago
- build: update pip and setuptools in dockerfile Otherwise a form of this issue occurs due to older setuptools not supporting pyproject.toml: https://github.com/pypa/setuptools/issues/3269 Might be re... — committed to idiap/coqui-ai-TTS by eginhard 3 years ago
- build: update pip and setuptools in dockerfile Otherwise a form of this issue occurs due to older setuptools not supporting pyproject.toml: https://github.com/pypa/setuptools/issues/3269 Might be re... — committed to idiap/coqui-ai-TTS by eginhard 3 years ago
- Install Python in GHA deployment runner 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/w... — committed to Urban-Analytics-Technology-Platform/web-app-template by penelopeysm 2 years ago
- Install Python in GHA deployment runner 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/w... — committed to Urban-Analytics-Technology-Platform/web-app-template by penelopeysm 2 years ago
- Install Python in GHA deployment runner 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/w... — committed to Urban-Analytics-Technology-Platform/web-app-template by penelopeysm 2 years ago
- #3049 Fix UNKNOWN name error on SDist See https://github.com/pypa/setuptools/issues/3269 for more details — committed to js1tr3/PyBaMM by agriyakhetarpal 3 years ago
- Upgrade pip before installation in CI 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. Ref... — committed to richtja/autils by richtja 2 years ago
- fall back to setup.cfg for packaging metadata * workaround for bug UNKNOWN 0.0.0 * https://github.com/pypa/setuptools/issues/3269 Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com> — committed to sarnold/python-daemonizer by sarnold a year ago
- fall back to setup.cfg for packaging metadata * workaround for bug UNKNOWN 0.0.0 * https://github.com/pypa/setuptools/issues/3269 Signed-off-by: Stephen L Arnold <sarnold@vctlabs.com> — committed to sarnold/python-daemonizer by sarnold a year ago
For me it helped to update pip
TLDR; On Ubuntu 22.04 (Jammy) ensure the environment variable
DEB_PYTHON_INSTALL_LAYOUT=deb_systembefore installing a PEP621 compliant project with pip and setuptools.This issue is occurring on Jammy because
pipis unable to get an accurate list of system package directories to remove from its temporary build environment’ssys.path. As a result, when the temporary build env’ssite/sitecustomize.pyscript runs/usr/lib/python3/dist-packagesis left at the end of sys.path, before theoverlayandnormalpaths are appended, thus placing it before those dirs in the search path. This means Jammy’s debian packaged setuptools (at version 59) is found and loaded ahead of whatever version thepyproject.tomlrequested. That version does not support PEP621 and is unable to extractnameandversionmetadata, resulting inUNKNOWN-0.0.0.This was not an issue on 20.04 (Focal) because the
get_purelibandget_platliblogic insidepip/_internal/locations/__init__.pyswitched at runtime between using the older distutils and newer sysconfig modules for determining purelib and platlib paths. That choice is based on the value ofsysconfig._PIP_USE_SYSCONFIG, which only defaults toFalseif the python version is less than 3.10. The older distuils knew how to deal with Debian’s install scheme layout, where the newer sysconfig doesn’t unless the env varDEB_PYTHON_INSTALL_LAYOUTis set to eitherdebordeb_system.This means this is a distro configuration/packaging issue, but I’m posting this comment on a closed bug because this bug report comes up as the top result when googling for this issue.
I think this person had the same problem 😃 https://pypi.org/project/UNKNOWN/
Indeed, this is the problem. I’ve “fixed” it by removing the system setuptools,
Now it all builds correctly.
Ran into this issue installing my package in a Docker. Fixed it by just upgrading pip before installing my package:
I just changed back to a setup.py.
This is a reproducer based on the issue previously reported in the pip tracker:
Note that when we update the root installation of setuptools, the project builds correctly, which indicates that the
dist-packagesfolder is somehow leaking into the build environment: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.
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.
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 https://github.com/pypa/setuptools/issues/3269#issuecomment-1254507377, 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.
For mac users -
Turns out, there was an outdated
setuptoolsinstalled in my mac too. It took me some but I finally found it and removed it -This was purportedly fixed toward the end of September 2022 in https://github.com/pypa/pip/pull/11466
Thank you very much for confirming @nschloe