Strange issue with pypa/build erroring on wheel creation

I’m not sure if this is the right place to post this - presumably not in the Packaging category here since that’s more for development of tools/standards. I could create an issue on the GitHub - pypa/build: A simple, correct PEP 517 build frontend repo.

Anyway, I am trying to package a small project using PEP517. pypa/build seems to be a recommended way (the recommended way?) to do this, but I’ve run into a very confusing problem. Running python -m build completes the sdist build successfully, but during wheel building fails with:

* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools>=42, setuptools_scm[toml]>=3.4, wheel<0.37)
* Getting dependencies for wheel...
running egg_info
listing git files failed - pretending there aren't any
writing manifest file 'versioned_pickle.egg-info\SOURCES.txt'
* Installing packages in isolated environment... (wheel)
C:\Users\asafs\AppData\Local\Temp\build-env-w6nk4k0f\Scripts\python.exe: Error while finding module specification for 'pip' (AttributeError: module '__main__' has no attribute '__file__')

Same thing happens if I pass “-w” to build the wheel from source. However, with “–no-isolation” everything works, so it is indeed the step of installing wheel into the isolated env that’s failing. (FWIW, also works but I don’t want to rely on deprecated functionality,)

I am on windows, and my python interpreter itself was installed with miniconda. I’ve tried Python 3.9 & 3.8, and build 0.7.0 or 0.6.0.post1.

Anyone ever seen this type of thing before? Googling didn’t reveal anything useful.


From a bit of googling, seems likely to be due to this Setuptools issue which produces an identical error. Most likely, either that version of Setuptools (60.3.0) is getting installed in your Anaconda env, or in your isolated build env. Check the former with conda list setuptools and (if you’re using conda-forge) update with conda install -c conda-forge setuptools=60.5.0). If you’re using the defaults/anaconda channels or your conda env version of Setuptools is older, just re-run build and it should redownload the new, fixed version of Setuptools. (In case it doesn’t, just set setuptools==60.5.0 in your buildrequires, re-run build and set it back as before). They yanked the version from PyPI, and it should be yanked from CF now, so it shouldn’t happen to new envs you create.

All the same for me, and haven’t seen this issue, but I hadn’t upgraded to the affected (and later yanked) version of setuptools.

So I am no longer seeing this issue when I run build, presumably because my conda env/build env is now pulling the updated setuptools. Just to prove you were right, I tried setting the build system requirement to “setuptools==60.3.0”, and the error comes back. I guess I’m glad it was part of a wider disruption and not just me doing something weird :slight_smile:

Thank you!