I am trying to package a Python project using py -m build
within an Anaconda environment. However, I noticed that only the .tar.gz
source distribution is being created, and the .whl
(wheel) distribution is missing.
This is the exact error:
ERROR Backend subprocess exited when trying to invoke build_wheel
While troubleshooting, I discovered that the script pyproject-build.exe
is located in the Scripts
folder of my Anaconda installation (Anaconda3/Scripts
), which is not included in my system's PATH.
Steps I've Taken:
Verified that
build
is installed:python3 -m pip install --upgrade pip
Checked the
Scripts
folder location mentioned in the upgrade warning message.Tried running:
py -m build
This successfully creates the
.tar.gz
file in thedist
directory but does not generate the.whl
file.
Questions:
How can I add the
Scripts
directory to my PATH so thatpyproject-build.exe
is recognized?What steps should I take to ensure that both
.tar.gz
and.whl
distributions are created when runningpy -m build
?Are there additional dependencies or configurations in the
pyproject.toml
file that I should check?
I am trying to package a Python project using py -m build
within an Anaconda environment. However, I noticed that only the .tar.gz
source distribution is being created, and the .whl
(wheel) distribution is missing.
This is the exact error:
ERROR Backend subprocess exited when trying to invoke build_wheel
While troubleshooting, I discovered that the script pyproject-build.exe
is located in the Scripts
folder of my Anaconda installation (Anaconda3/Scripts
), which is not included in my system's PATH.
Steps I've Taken:
Verified that
build
is installed:python3 -m pip install --upgrade pip
Checked the
Scripts
folder location mentioned in the upgrade warning message.Tried running:
py -m build
This successfully creates the
.tar.gz
file in thedist
directory but does not generate the.whl
file.
Questions:
How can I add the
Scripts
directory to my PATH so thatpyproject-build.exe
is recognized?What steps should I take to ensure that both
.tar.gz
and.whl
distributions are created when runningpy -m build
?Are there additional dependencies or configurations in the
pyproject.toml
file that I should check?
3 Answers
Reset to default 0It was #3 for me. There was no directory that matched the project name in the pyproject.toml file. And, I needed to pip install wheel
. Finally, the build was successful!
Install wheel via pip install wheel. Update pyproject.toml to ensure it includes wheel under the requires section. Add Anaconda's Scripts folder to your system’s PATH. Retry building with py -m build.
Anaconda doesn't add pyproject-build.exe
to PATH by default.
To make sure both .tar.gz
and .whl
files are created, you must first install build
using pip install build
then run py -m build
.
You should also check if pyproject-build.exe
is in your Python version's Scripts
folder, then add it to your PATH
if it is not listed there yet.