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 2 years ago
- Reactions: 5
- Comments: 33 (14 by maintainers)
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 a year 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 9 months 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 8 months 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 8 months ago
For me it helped to update pip
TLDR; On Ubuntu 22.04 (Jammy) ensure the environment variable
DEB_PYTHON_INSTALL_LAYOUT=deb_system
before installing a PEP621 compliant project with pip and setuptools.This issue is occurring on Jammy because
pip
is 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.py
script runs/usr/lib/python3/dist-packages
is left at the end of sys.path, before theoverlay
andnormal
paths 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.toml
requested. That version does not support PEP621 and is unable to extractname
andversion
metadata, resulting inUNKNOWN-0.0.0
.This was not an issue on 20.04 (Focal) because the
get_purelib
andget_platlib
logic insidepip/_internal/locations/__init__.py
switched 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 toFalse
if 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_LAYOUT
is set to eitherdeb
ordeb_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.
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-packages
folder 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.
I just changed back to a setup.py.
For mac users -
Turns out, there was an outdated
setuptools
installed 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
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.