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.

build_meta doesn't use a fresh dist directory, which causes ValueError unpacking tuple

See original GitHub issue

If you use pip install . on a source directory that already has a dist, the existing directory structure is used when preparing the wheel. This causes an exception if an existing wheel with a different name exists, because build_meta assumes there’s only one wheel in dist.

Here’s a script to create a MWE repo:

#!/usr/bin/bash

mkdir /tmp/demo_dist_517
cd /tmp/demo_dist_517
echo "from setuptools import setup; setup()" > setup.py
echo "0.0.1" > VERSION
cat > setup.cfg << EOF
[metadata]
name = foo
version = file: VERSION
EOF
cat > pyproject.toml << EOF
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
EOF

At this point your repo looks like this:

$ tree
├── pyproject.toml
├── setup.cfg
├── setup.py
└── VERSION

Create a wheel in dist, then change the version:

pip wheel . --no-deps -w dist
echo "0.0.2" > VERSION

Now try to create a wheel from the repo:

pip wheel . -w dist

This will trigger an error in build_meta: File “/tmp/pip-build-env-plomixa1/overlay/…/setuptools/build_meta.py”, line 157, in _file_with_extension file, = matching ValueError: too many values to unpack (expected 1) Building wheel for foo (PEP 517) … error Failed building wheel for foo

This is pretty easy to work around, obviously, since the user can just remove dist before invoking any pip commands, but it might be better to do the wheel build in a clean directory if possible.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:33 (31 by maintainers)

github_iconTop GitHub Comments

1reaction
benoit-pierrecommented, Apr 22, 2019

I’ll do it.

1reaction
pgansslecommented, Apr 22, 2019

@webknjaz I have no objections, but I won’t have much time until this weekend at the earliest. @benoit-pierre or @jaraco feel free to cut a release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unpack tuples in python and the ValueError - Stack Overflow
The elements of the sequence produced by enumerate() always have a length of two - the index, followed by a value from the...
Read more >
ValueError: too many values to unpack (expected 2)
Unpacking refers to retrieving values from a list and assigning them to a list of variables. This error occurs when the number of...
Read more >
Nuitka-fixed - PyPI
It then executes uncompiled code and compiled code together in an extremely compatible manner. You can use all Python library modules and all ......
Read more >
How to Pack and Unpack a Tuple in Python? (+ ValueError)
Welcome back to Digital Academy, the Complete Python Development Tutorial for Beginners, which will help you Learn Python from A to Z!🖥️ ...
Read more >
Diff - platform/prebuilts/build-tools - Google Git
+ def __new__(cls, dims=(), **kwargs): + return Tuple(list(dims), ... + if node.cause: + raise ValueError(f"Node can't use cause without an ...
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