# Strange issue with pypa/build erroring on wheel creation

**URL:** <https://discuss.python.org/t/strange-issue-with-pypa-build-erroring-on-wheel-creation/12947>\
**Category:** Python Help\
**Created:** [January 7, 2022, 12:22am UTC](https://discuss.python.org/t/strange-issue-with-pypa-build-erroring-on-wheel-creation/12947 "2022-01-07T00:22:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![a-reich](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/a-reich/32/5885_2.png) [@a-reich](https://discuss.python.org/u/a-reich)\
**Post date:** [January 7, 2022, 12:22am UTC](https://discuss.python.org/t/strange-issue-with-pypa-build-erroring-on-wheel-creation/12947/1 "2022-01-07T00:22:19Z")

</div>

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](https://github.com/pypa/build) 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:

```auto
* 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, `pep517.build` 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.

---

<div class="post-metadata">

**Author:** ![CAM-Gerlach](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/cam-gerlach/32/3688_2.png) [@CAM-Gerlach](https://discuss.python.org/u/CAM-Gerlach)\
**Post date:** [January 10, 2022, 11:43pm UTC](https://discuss.python.org/t/strange-issue-with-pypa-build-erroring-on-wheel-creation/12947/2 "2022-01-10T23:43:42Z")

</div>

> [@a-reich](#):
>
> pypa/build seems to be a recommended way (the recommended way?)

Yup.

> [@a-reich](#):
>
> `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__')`

From a bit of googling, seems likely to be due to [this Setuptools issue](https://github.com/pypa/setuptools/issues/3002) 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.

> [@a-reich](#):
>
> 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.

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`.

---

<div class="post-metadata">

**Author:** ![a-reich](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/a-reich/32/5885_2.png) [@a-reich](https://discuss.python.org/u/a-reich)\
**Post date:** [January 11, 2022, 1:16am UTC](https://discuss.python.org/t/strange-issue-with-pypa-build-erroring-on-wheel-creation/12947/3 "2022-01-11T01:16:32Z")

</div>

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 🙂

Thank you!
