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.

Issue building a package using `python -m build` (pip error)

See original GitHub issue

Problem description

So I’m not 100% what’s happening here as it’s only just started to happen. It happens on all versions of Pip, and even on code where it worked just a few days ago, so I’m completely stumped. I’ve also tried it on both Python 3.9 and 3.10 and getting these errors, and even my GitHub Actions workflow is having the same problem. I was using setuptools 58.1, but updating to 60.3 makes no difference.

Whenever I try to run python -m build, everything works fine until it tries to build a wheel. The tar archive builds okay, and appears to have all the correct files in it. This is the output/error in full:

* Building wheel from sdist
* Creating virtualenv isolated environment...
* Installing packages in isolated environment... (setuptools>=42, wheel)
* Getting dependencies for wheel...
running egg_info
warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
writing manifest file 'chatto.egg-info/SOURCES.txt'
* Installing packages in isolated environment... (wheel)
/tmp/build-env-8qhq7gxo/bin/python: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Traceback (most recent call last):
  File "/home/parafoxia/Programs/Projects/chatto/.venv/lib/python3.10/site-packages/build/__main__.py", line 372, in main
    built = build_call(
  File "/home/parafoxia/Programs/Projects/chatto/.venv/lib/python3.10/site-packages/build/__main__.py", line 242, in build_package_via_sdist
    out = _build(isolation, builder, outdir, distribution, config_settings, skip_dependency_check)
  File "/home/parafoxia/Programs/Projects/chatto/.venv/lib/python3.10/site-packages/build/__main__.py", line 140, in _build
    return _build_in_isolated_env(builder, outdir, distribution, config_settings)
  File "/home/parafoxia/Programs/Projects/chatto/.venv/lib/python3.10/site-packages/build/__main__.py", line 110, in _build_in_isolated_env
    env.install(builder.get_requires_for_build(distribution))
  File "/home/parafoxia/Programs/Projects/chatto/.venv/lib/python3.10/site-packages/build/env.py", line 211, in install
    _subprocess(cmd)
  File "/home/parafoxia/Programs/Projects/chatto/.venv/lib/python3.10/site-packages/build/env.py", line 81, in _subprocess
    raise e
  File "/home/parafoxia/Programs/Projects/chatto/.venv/lib/python3.10/site-packages/build/env.py", line 78, in _subprocess
    subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File "/usr/local/lib/python3.10/subprocess.py", line 420, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/local/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/tmp/build-env-8qhq7gxo/bin/python', '-Im', 'pip', 'install', '--use-pep517', '--no-warn-script-location', '-r', '/tmp/build-reqs-vohv2_qf.txt']' returned non-zero exit status 1.

ERROR Command '['/tmp/build-env-8qhq7gxo/bin/python', '-Im', 'pip', 'install', '--use-pep517', '--no-warn-script-location', '-r', '/tmp/build-reqs-vohv2_qf.txt']' returned non-zero exit status 1.

I wish I had more of an idea or a starting point but to be honest I’m completely at a loss, and can’t find anything exactly the same around. I’ve looked at a few other issues with the same problems and none of the solutions work, but there may be some I missed.

Thanks in advance for your help!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
joelbarranteswinscommented, Jan 6, 2022

Hello guys, I’m not really sure what it’s really happening here. I’m getting this error however I’m using python=3.96, venv on windows 10 and I’m trying compile my own package.

hope your answer this could be the same issue from https://github.com/pypa/build/issues/426

Traceback (most recent call last):
  File "C:\Users\joel_\OneDrive\Documentos\GitLab\darit\cli\.venv\lib\site-packages\build\__main__.py", line 372, in main
    built = build_call(
  File "C:\Users\joel_\OneDrive\Documentos\GitLab\darit\cli\.venv\lib\site-packages\build\__main__.py", line 242, in build_package_via_sdist
    out = _build(isolation, builder, outdir, distribution, config_settings, skip_dependency_check)
  File "C:\Users\joel_\OneDrive\Documentos\GitLab\darit\cli\.venv\lib\site-packages\build\__main__.py", line 140, in _build
    return _build_in_isolated_env(builder, outdir, distribution, config_settings)
  File "C:\Users\joel_\OneDrive\Documentos\GitLab\darit\cli\.venv\lib\site-packages\build\__main__.py", line 110, in _build_in_isolated_env
    env.install(builder.get_requires_for_build(distribution))
  File "C:\Users\joel_\OneDrive\Documentos\GitLab\darit\cli\.venv\lib\site-packages\build\env.py", line 211, in install
    _subprocess(cmd)
  File "C:\Users\joel_\OneDrive\Documentos\GitLab\darit\cli\.venv\lib\site-packages\build\env.py", line 81, in _subprocess
    raise e
  File "C:\Users\joel_\OneDrive\Documentos\GitLab\darit\cli\.venv\lib\site-packages\build\env.py", line 78, in _subprocess
    subprocess.check_output(cmd, stderr=subprocess.STDOUT)
  File "C:\Users\joel_\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "C:\Users\joel_\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\Users\\joel_\\AppData\\Local\\Temp\\build-env-xzabxgoo\\Scripts\\python.exe', '-Im', 'pip', 'install', '--use-pep517', '--no-warn-script-location', '-r', 'C:\\Users\\joel_\\AppData\\Local\\Temp\\build-reqs-lp2bxm5b.txt']' returned non-zero exit status 1.

ERROR Command '['C:\\Users\\joel_\\AppData\\Local\\Temp\\build-env-xzabxgoo\\Scripts\\python.exe', '-Im', 'pip', 'install', '--use-pep517', '--no-warn-script-location', '-r', 'C:\\Users\\joel_\\AppData\\Local\\Temp\\build-reqs-lp2bxm5b.txt']' returned non-zero exit status 1.
1reaction
henryiiicommented, Jan 6, 2022

Yes, we’d have a custom error if a subprocess call fails, rather than just letting a traceback bubble up. It would only be on subprocess calls we know might fail - if a failure is unexpected, then a traceback is fine / correct.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when installing using pip - python - Stack Overflow
Try. sudo pip install -U setuptools. If this doesn't solve your problem then. Firstly, you need the python-dev package because Pillow needs ...
Read more >
I can't install libraries - Discussions on Python.org
Hello, each time i try to install librabies as matplotlib, i have the following error : “python setup.py egg_info did not run successfully....
Read more >
User Guide - pip documentation v22.3.1
This also means that, when you run a pip install command, pip only considers the packages you are installing in that command, and...
Read more >
Installing scikit-learn
It will provide a stable version and pre-built packages are availabl. ... see which version and where scikit-learn is installedpython -m pip freeze...
Read more >
How to Publish an Open-Source Python Package to PyPI
In this step-by-step tutorial, you'll learn how to create a ... For example python module.py and python -m module are mostly equivalent.
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