Failed to build httptools, how to fix it
Asked Answered
M

5

6

When I try to install FastAPI. I am using Python 3.10.2, Pycharm.

I have already installed build tools which is given by the link. and updated setuptools, wheel and pip using

pip install --upgrade pip setuptools wheel

but I still get the following error with httptools.

Building wheels for collected packages: httptools<br />
  Building wheel for httptools (setup.py) ... error<br />
  error: subprocess-exited-with-error<br />

  × python setup.py bdist_wheel did not run successfully.<br />
  │ exit code: 1<br />
  ╰─> [25 lines of output]<br />
      running bdist_wheel<br />
      running build<br />
      running build_py<br />
      creating build<br />
      creating build\lib.win-amd64-3.10<br />
      creating build\lib.win-amd64-3.10\httptools<br />
      copying httptools\_version.py -> build\lib.win-amd64-3.10\httptools<br />
      copying httptools\__init__.py -> build\lib.win-amd64-3.10\httptools<br />
      creating build\lib.win-amd64-3.10\httptools\parser<br />
      copying httptools\parser\errors.py -> build\lib.win-amd64-3.10\httptools\parser<br />
      copying httptools\parser\__init__.py -> build\lib.win-amd64-3.10\httptools\parser<br />
      running egg_info<br />
      writing httptools.egg-info\PKG-INFO<br />
      writing dependency_links to httptools.egg-info\dependency_links.txt<br />
      writing requirements to httptools.egg-info\requires.txt<br />
      writing top-level names to httptools.egg-info\top_level.txt<br />
      reading manifest file 'httptools.egg-info\SOURCES.txt'<br />
      reading manifest template 'MANIFEST.in'<br />
      adding license file 'LICENSE'<br />
      writing manifest file 'httptools.egg-info\SOURCES.txt'<br />
      copying httptools\parser\parser.c -> build\lib.win-amd64-3.10\httptools\parser<br />
      copying httptools\parser\url_parser.c -> build\lib.win-amd64-3.10\httptools\parser<br />
      running build_ext<br />
      building 'httptools.parser.parser' extension<br />
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/<br />
      [end of output]<br />
<br />
  note: This error originates from a subprocess, and is likely not a problem with pip.<br />
  ERROR: Failed building wheel for httptools<br />
  Running setup.py clean for httptools<br />
Failed to build httptools<br />
Installing collected packages: httptools, certifi, ujson, python-multipart, orjson, jinja2, itsdangerous, dnspython, charset-normalizer, requests, email_validator, fastapi
  Running setup.py install for httptools ... error<br />
  error: subprocess-exited-with-error<br />
<br />
  × Running setup.py install for httptools did not run successfully.<br />
  │ exit code: 1<br />
  ╰─> [27 lines of output]<br />
      running install<br />
      c:\users\ghali\pycharmprojects\tat\venv\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and ot
her standards-based tools.<br />
        warnings.warn(<br />
      running build<br />
      running build_py<br />
      creating build<br />
      creating build\lib.win-amd64-3.10<br />
      creating build\lib.win-amd64-3.10\httptools<br />
      copying httptools\_version.py -> build\lib.win-amd64-3.10\httptools<br />
      copying httptools\__init__.py -> build\lib.win-amd64-3.10\httptools<br />
      creating build\lib.win-amd64-3.10\httptools\parser<br />
      copying httptools\parser\errors.py -> build\lib.win-amd64-3.10\httptools\parser<br />
      copying httptools\parser\__init__.py -> build\lib.win-amd64-3.10\httptools\parser<br />
      running egg_info<br />
      writing httptools.egg-info\PKG-INFO<br />
      writing dependency_links to httptools.egg-info\dependency_links.txt<br />
      writing requirements to httptools.egg-info\requires.txt<br />
      writing top-level names to httptools.egg-info\top_level.txt<br />
      reading manifest file 'httptools.egg-info\SOURCES.txt'<br />
      reading manifest template 'MANIFEST.in'<br />
      adding license file 'LICENSE'<br />
      writing manifest file 'httptools.egg-info\SOURCES.txt'<br />
      copying httptools\parser\parser.c -> build\lib.win-amd64-3.10\httptools\parser<br />
      copying httptools\parser\url_parser.c -> build\lib.win-amd64-3.10\httptools\parser<br />
      running build_ext<br />
      building 'httptools.parser.parser' extension<br />
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/<br />
      [end of output]<br />
<br />
  note: This error originates from a subprocess, and is likely not a problem with pip.<br />
error: legacy-install-failure<br />
<br />
× Encountered error while trying to install package.<br />
╰─> httptools<br />
<br />
note: This is an issue with the package mentioned above, not pip<br />.
hint: See above for output from the failure.<br />
Merrymaking answered 25/2, 2022 at 13:3 Comment(6)
The error message says: "Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": visualstudio.microsoft.com/visual-cpp-build-tools". Have you tried doing what it suggests?Interrogatory
of course, but it didn't help. I have installed the Visual Studio 2019 Build Tools.Merrymaking
Which version of httptools? httptools 0.4.0 has prebuilt whls for 3.10 (some earlier versions will only have 3.9, etc.): pypi.org/project/httptools/#filesSteeple
unfortunatly, dont really know.Merrymaking
The version number will be specified in your requirements.txt file - or it will be present in the pip log when the package is attempted to be installed (slightly higher up than where the log in your question starts).Steeple
After installing the Microsoft Visual C++ 14.0 build tools also some other error poped up. Updating the version number of httptools version from 0.4.0 to 0.5.0 in requirements file fixed the issue.Formenti
M
1

Unfortunately I couldn't solve this problem using python 3.10
The only thing that helped me was rolling back to python 3.8.6 (it will probably work in python 3.9 as well)
As far as I understand, the problem is the incompatibility of the current version of httptools and python 3.10 If anyone finds a solution, be sure to write. I will wait.

Merrymaking answered 25/2, 2022 at 16:39 Comment(0)
C
1

Might want to try upgrading the version of httptools. I was able to build it for 3.10.9

Python 3.10.9 (main, Jan 11 2023, 09:18:20) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import httptools
>>> httptools.__version__
'0.1.2
Cletis answered 13/2, 2023 at 5:15 Comment(0)
P
0

I resolved the same problem by adding the following libraries:

sudo apt install python3.10-distutils

sudo apt install python3.10-dev

Python version 3.10.13

Picrite answered 6/9, 2023 at 12:43 Comment(0)
S
0

belated updated, this was/is caused by httptools putting windows support at a lower priority and not releasing windows wheels as timely as linux ones. There have been many cases across the years of lack of windows wheels causeing this issue for various python versions. HttpTools will eventually release a windows wheel and it's fixed, until the next python version comes out and they once again don't bother to provide a windows wheel until enough people complain ;)

As of now up to 3.10 at least should have a windows httptools wheel and install without issue for most people. If you're stuck behind a firewall like me you will have to request an update to your pip mirror or downgrade your python. Trying to install visual C++ to build the wheel manually never seems to work.

given how frequently it's come up I wouldn't be surprised if at some point a new python also lacks a httptools wheel and a new generation of folks find this question and if so you will just have to downgrade or wait for them to put out a windows wheel.

Sulphone answered 11/12, 2023 at 15:58 Comment(0)
K
-1

The support for newer python versions comes a bit late on the library.

I did some build automation jobs on 09/10/2024:

  • python 3.13.0 failed
  • python 3.12.0 succeed
  • python 3.11.0 succeed

further research: httptools github workflow file

Seems like they have not yet added support for the python3.13. You could switch to the latest supported python version.

Krouse answered 9/10 at 7:8 Comment(2)
From OP : I am using Python 3.10.2Scurvy
@Scurvy do note that the question was asked about 2.5 years ago. In all likelihood, 3.10.2 was that newest python version back then. This answer's notion that the latest python versions is unlikely to be supported would (probably) had held true back then and in the future too.Triggerhappy

© 2022 - 2024 — McMap. All rights reserved.