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.

test.tar.gz does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

See original GitHub issue

Description

I’m writing a small build-backend, essentiall a wrapper around setuptools. In a test project, the pyproject.toml is

[build-system]
requires = [
  "setuptools",
  "mybuildbackend",
  "wheel"
]
# build-backend = "setuptools.build_meta"
build-backend = "mybuildbackend.build_meta"

Upon

python -m build --sdist

this spits out a nice-looking dist/test-project.tar.gz. When trying to

pip install dist/test-project.tar.gz

however, I’m getting

ERROR: file:///path/to/dist/test-project-0.0.1.tar.gz does not appear to be a Python project: neither 'setup.py' nor 'pyproject.toml' found.

It works fine when pip-installing the untarred folder. It also works when changing just one line in tar, namely adding

build-backend = "setuptools.build_meta"

instead of the custom one.

I have no clue why that could be. The error message is misleadiing since there is a pyproject.toml.

Any idea what may be going wrong?

Expected behavior

No response

pip version

22.0.4

Python version

3.9.10

OS

Ubuntu 22.04

How to Reproduce

See above.

Output

No response

Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nschloecommented, Mar 18, 2022

Thanks everyone for the input. I’ve found the bug, and it was a subtle one in the backend. When recreating the tar.gz-file, a leading / was accidentally added in the file. That’s why pip was not able to find the pyproject.toml file.

I would have been happy about a clearer error message (found the file here but it should be there), but I think this is so niche that it doesn’t warrant anyone spending more time on this. Thanks again!

0reactions
pradyunsgcommented, Mar 19, 2022

(found the file here but it should be there)

There’s no “found file here” – it basically looks if there’s a file pyproject.toml or setup.py file in the tarball. It doesn’t go around searching or recursing to look for it – it’s a one-time lookup of a specific filename.

It didn’t find any file with that filename where it looked (the root of the source tarball) and presented that as an error.

I agree that working to add a clearer error message is not worth the effort here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Directory is not installable. Neither 'setup.py' nor 'pyproject ...
When looking at the items to be installed, pip checks what type of item each is, in the following order: Project or archive...
Read more >
Contributing — brainiak 0.11 documentation
If the package is installed normally and the test command is called from the project root directory, the coverage program will fail to...
Read more >
3 The anatomy of a minimal Python package
3.1.1 Parts of the Python build system. In the root directory for your project, start by running build using the following command: $...
Read more >
setuptools-scm - PyPI
First, ensure that setuptools_scm is present during the project's built step by specifying it as one of the build requirements. # pyproject.toml ......
Read more >
Python Packaging Guidelines - Fedora Docs
Fedora's Python SIG not only develops these guidelines, but it's also ... Common locations are pyproject.toml , setup.py , setup.cfg , config.toml ....
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