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.

invalid `pyproject.toml`

See original GitHub issue
  • asyncpg version: irrelevant
  • PostgreSQL version: irrelevant
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce the issue with a local PostgreSQL install?: irrelevant
  • Python version: Python 3.10.3 (main, Mar 18 2022, 05:09:31) [GCC 10.2.1 20210110] on linux
  • Platform: Linux ecd864aa501c 5.10.60-sunxi64 #21.08.1 SMP Wed Aug 25 18:29:57 UTC 2021 aarch64 GNU/Linux
  • Do you use pgbouncer?: irrelevant
  • Did you install asyncpg with pip?: yes
  • If you built asyncpg locally, which version of Cython did you use?: irrelevant
  • Can the issue be reproduced under both asyncio and uvloop?: irrelevant

In most cases, it is not really a problem because we have prebuilt wheels. However, this is not true for aarch64 (#870). I’d always built it by myself, but after a recent update of Python (or setuptools or some other?), I could never build it successfully.

After some tests, I found this issue occurs on amd64 too.

According to PEP 621, [project] must contain the name of the project.


sudo docker run --rm -it python:3.10-slim bash
apt-get update && apt-get install -y build-essential git --no-install-recommends
pip install -U pip setuptools

Build from PyPI:

pip install asyncpg --no-binary :all:

Or, Build from source:

pip install git+https://github.com/MagicStack/asyncpg.git@master

Output:

Collecting git+https://github.com/MagicStack/asyncpg.git@master
Cloning https://github.com/MagicStack/asyncpg.git (to revision master) to /tmp/pip-req-build-1y0lh4k8
Running command git clone --filter=blob:none --quiet https://github.com/MagicStack/asyncpg.git /tmp/pip-req-build-1y0lh4k8
Resolved https://github.com/MagicStack/asyncpg.git to commit a2f093df6aceec7842709eaf92c5ff9df093efae
Running command git submodule update --init --recursive -q
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [515 lines of output]
/tmp/pip-build-env-mutsvdr9/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:100: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
warnings.warn(msg, _ExperimentalProjectMetadata)
configuration error: `project` must contain ['name'] properties
DESCRIPTION:
Data structure for the **project** table inside ``pyproject.toml`` (as
initially defined in :pep:`621`)

GIVEN VALUE:
{
"requires-python": ">=3.6"
}

OFFENDING RULE: 'required'

DEFINITION:
...
...
<omitted>
...
...

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py",line 363, in <module>
main()
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py",line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py",line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 177, in get_requires_for_build_wheel
return self._get_build_requires(
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 159, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 174, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 248, in <module>
setuptools.setup(
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 77, in setup
return distutils.core.setup(**attrs)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 122, in setup
dist.parse_config_files()
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 836, in parse_config_files
pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 52, in apply_configuration
config = read_configuration(filepath, True, ignore_option_errors, dist)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 114, in read_configuration
validate(subset, filepath)
File "/tmp/pip-build-env-9b_16u9a/overlay/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 43, in validate
raise error from None
ValueError: invalid pyproject.toml config: `project`
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
hint: See above for details.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:10
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
Rongronggg9commented, Mar 25, 2022

For those who can’t wait for the next release, you may temporarily use my fork. It just added the name of the project into pyproject.toml and fixed this bug. I’ve opened a PR too.

pip install git+https://github.com/Rongronggg9/asyncpg.git@fix/pep-621
1reaction
Rongronggg9commented, Mar 25, 2022

For temporary fixing you can use this instructions in your Dockerfile - and delete asyncpg from requirements.txt

RUN pip install --upgrade pip RUN pip install wheel RUN pip install check-wheel-contents RUN git clone https://github.com/Rongronggg9/asyncpg.git --recursive RUN cd asyncpg && python3 setup.py bdist_wheel && cd …

RUN pip install asyncpg/dist/*

In fact, there is a pretty simple solution: In the requirements.txt, replace asyncpg with git+https://github.com/Rongronggg9/asyncpg.git@fix/pep-621 and that’s it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Projects that contain pyproject.toml not compliant with ... - GitHub
Hi, We have been using pyproject.toml file in setup.py and when we build using ... ValueError: invalid pyproject.toml config: project.
Read more >
pyproject.toml won't find project name with setuptools python
Update. 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 >
dev-python/cppy-1.2.0 - ValueError: invalid pyproject.toml config
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo! Gentoo's Bugzilla – Bug 836600 dev-python/cppy-1.2.0 - ...
Read more >
pyproject.toml - pip documentation v22.3.1
Modern Python packages can contain a pyproject.toml file, first introduced in PEP 518 and later expanded in PEP 517, PEP 621 and PEP...
Read more >
The pyproject.toml file | Documentation | Poetry
poetry section of the pyproject.toml file is composed of multiple sections. name #. The name of the package. Required. This should be a...
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