question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] pyproject.toml: name, version not recognized (UNKNOWN 0.0.0)

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:25 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
tim-evescommented, Sep 22, 2022

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’s sys.path. As a result, when the temporary build env’s site/sitecustomize.py script runs /usr/lib/python3/dist-packages is left at the end of sys.path, before the overlay and normal 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 the pyproject.toml requested. That version does not support PEP621 and is unable to extract name and version metadata, resulting in UNKNOWN-0.0.0.

This was not an issue on 20.04 (Focal) because the get_purelib and get_platlib logic inside pip/_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 of sysconfig._PIP_USE_SYSCONFIG, which only defaults to False 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 var DEB_PYTHON_INSTALL_LAYOUT is set to either deb or deb_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.

2reactions
wimglenncommented, Apr 22, 2022

I think this person had the same problem 😃 https://pypi.org/project/UNKNOWN/

Read more comments on GitHub >

github_iconTop Results From Across the Web

pyproject.toml won't find project name with setuptools python
At the time the question was asked, setuptools did not have support for writing its configuration in a pyproject.toml file (PEP 621).
Read more >
Problems using pyproject.toml : r/learnpython - Reddit
So it seems it doesn't read the pyproject.toml. I'm pretty sure the name and version meta data in correct under the project table....
Read more >
Dependency scanning fails for setuptools project that ... - GitLab
My project contains a setup.cfg and a pyproject.toml . Unfortunately, it does not get recognized by the Dependency scanning. Does this issue ...
Read more >
build backend is missing the 'build_editable' hook. - You.com
done ERROR: Project file:///home/developer/src/packaging-test has a 'pyproject.toml' and its build backend is missing the 'build_editable' hook. Since it does ...
Read more >
History - setuptools 65.6.3.post20221216 documentation
Setuptools will adopt the name of the top-level package (or module in the case of single-module distributions), only when name is not explicitly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found