Python Package Installation Fails: 'Getting requirements to build wheel did not run successfully' - Stack Overfl

In my python projects I create a list of required packages by pip freeze > requirements.txt it autom

In my python projects I create a list of required packages by pip freeze > requirements.txt it automatically list the packages with version. But after a while when I reinstall the package or trying to run other people project I have to install the dependencis with pip install -r requirements.txt. In this process some of the packages(For example, Pillow, numpy, etc) can't install the specific version that listed. By removing the version number it can install successfully.

In my current case, My project have requirement of pillow==10.3.0 but it shows the following error.

Collecting pillow==10.3.0 (from -r requirements.txt (line 6))
  Using cached pillow-10.3.0.tar.gz (46.6 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "D:\LMS\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "D:\LMS\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\LMS\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel          return hook(config_settings)
        File "C:\Users\wo\AppData\Local\Temp\pip-build-env-bxsls9dh\overlay\Lib\site-packages\setuptools\build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\wo\AppData\Local\Temp\pip-build-env-bxsls9dh\overlay\Lib\site-packages\setuptools\build_meta.py", line 304, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "C:\Users\wo\AppData\Local\Temp\pip-build-env-bxsls9dh\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 33, in <module>
        File "<string>", line 27, in get_version
      KeyError: '__version__'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Then I tried to install the package with the same version manually and still fails. So, I installed pillow without version specification and it installed successfully.

(venv) D:\LMS>pip install pillow
Collecting pillow
  Using cached pillow-11.1.0-cp313-cp313-win_amd64.whl.metadata (9.3 kB)
Using cached pillow-11.1.0-cp313-cp313-win_amd64.whl (2.6 MB)
Installing collected packages: pillow
Successfully installed pillow-11.1.0

I face this situation often, so I want to know why this happens or what to do in this situations.

In my python projects I create a list of required packages by pip freeze > requirements.txt it automatically list the packages with version. But after a while when I reinstall the package or trying to run other people project I have to install the dependencis with pip install -r requirements.txt. In this process some of the packages(For example, Pillow, numpy, etc) can't install the specific version that listed. By removing the version number it can install successfully.

In my current case, My project have requirement of pillow==10.3.0 but it shows the following error.

Collecting pillow==10.3.0 (from -r requirements.txt (line 6))
  Using cached pillow-10.3.0.tar.gz (46.6 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "D:\LMS\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "D:\LMS\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "D:\LMS\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel          return hook(config_settings)
        File "C:\Users\wo\AppData\Local\Temp\pip-build-env-bxsls9dh\overlay\Lib\site-packages\setuptools\build_meta.py", line 334, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\wo\AppData\Local\Temp\pip-build-env-bxsls9dh\overlay\Lib\site-packages\setuptools\build_meta.py", line 304, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "C:\Users\wo\AppData\Local\Temp\pip-build-env-bxsls9dh\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 33, in <module>
        File "<string>", line 27, in get_version
      KeyError: '__version__'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Then I tried to install the package with the same version manually and still fails. So, I installed pillow without version specification and it installed successfully.

(venv) D:\LMS>pip install pillow
Collecting pillow
  Using cached pillow-11.1.0-cp313-cp313-win_amd64.whl.metadata (9.3 kB)
Using cached pillow-11.1.0-cp313-cp313-win_amd64.whl (2.6 MB)
Installing collected packages: pillow
Successfully installed pillow-11.1.0

I face this situation often, so I want to know why this happens or what to do in this situations.

Share Improve this question asked Mar 3 at 5:15 Md Mahmud HasanMd Mahmud Hasan 339 bronze badges 6
  • As I asked some chatbots about this problem, They said this might be happened because the package versions required dependecis might be not available now. So it fails to install – Md Mahmud Hasan Commented Mar 3 at 5:17
  • Or there might be some package is missing in my system. I upgraded setuptools and wheel still the same issue. – Md Mahmud Hasan Commented Mar 3 at 5:18
  • keep all environment same and try agian. ie make python version same in all cases and try to install again or use poetry to install packages – sahasrara62 Commented Mar 3 at 8:28
  • @sahasrara62 I can't understand what you are saying by keeping all environments same. – Md Mahmud Hasan Commented Mar 3 at 8:51
  • check if python version is same in all or not – sahasrara62 Commented Mar 3 at 16:27
 |  Show 1 more comment

1 Answer 1

Reset to default 2

Your Python version is 3.13 and it is not compatible with pillow 10.3.0. Pillow 10.3.0 supports Python 3.8 - 3.12. There are no wheels for Python 3.13.

So why did pip install pillow work? Installing a package without specifying a version usually attempts to install the latest release. So pip install pillow will give you the stable release of pillow which supports Python 3.13.

Always look at the supported python versions of specific packages and verify that the package version you are trying to install is compatible.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745108977a4611732.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信