最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Why is pyproject-build.exe not on PATH in Anaconda, and how can I ensure both .tar.gz and .whl distributions are create

programmeradmin0浏览0评论

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:

  1. Verified that build is installed:

    python3 -m pip install --upgrade pip
    
  2. Checked the Scripts folder location mentioned in the upgrade warning message.

  3. Tried running:

    py -m build
    

    This successfully creates the .tar.gz file in the dist directory but does not generate the .whl file.

Questions:

  1. How can I add the Scripts directory to my PATH so that pyproject-build.exe is recognized?

  2. What steps should I take to ensure that both .tar.gz and .whl distributions are created when running py -m build?

  3. 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:

  1. Verified that build is installed:

    python3 -m pip install --upgrade pip
    
  2. Checked the Scripts folder location mentioned in the upgrade warning message.

  3. Tried running:

    py -m build
    

    This successfully creates the .tar.gz file in the dist directory but does not generate the .whl file.

Questions:

  1. How can I add the Scripts directory to my PATH so that pyproject-build.exe is recognized?

  2. What steps should I take to ensure that both .tar.gz and .whl distributions are created when running py -m build?

  3. Are there additional dependencies or configurations in the pyproject.toml file that I should check?

Share Improve this question edited Nov 19, 2024 at 16:38 phd 95.2k14 gold badges158 silver badges207 bronze badges asked Nov 19, 2024 at 16:23 Kate CrawfordKate Crawford 1
Add a comment  | 

3 Answers 3

Reset to default 0

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论