MagicStack / httptools

Fast HTTP parser
MIT License
1.21k stars 83 forks source link

Error installing httptools as a uvicorn dependency #93

Closed ansegura7 closed 1 year ago

ansegura7 commented 1 year ago

Hello,

I am getting the following error when installing uvicorn, with the following command:

pip install "uvicorn[standard]"

Error:

Using cached uvicorn-0.23.2-py3-none-any.whl (59 kB)
Building wheels for collected packages: httptools
  Building wheel for httptools (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for httptools (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [66 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\httptools
      copying httptools\_version.py -> build\lib.win-amd64-cpython-312\httptools
      copying httptools\__init__.py -> build\lib.win-amd64-cpython-312\httptools
      creating build\lib.win-amd64-cpython-312\httptools\parser
      copying httptools\parser\errors.py -> build\lib.win-amd64-cpython-312\httptools\parser
      copying httptools\parser\__init__.py -> build\lib.win-amd64-cpython-312\httptools\parser
      running egg_info
      writing httptools.egg-info\PKG-INFO
      writing dependency_links to httptools.egg-info\dependency_links.txt
      writing requirements to httptools.egg-info\requires.txt
      writing top-level names to httptools.egg-info\top_level.txt
      reading manifest file 'httptools.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE'
      writing manifest file 'httptools.egg-info\SOURCES.txt'
      C:\Users\asegura\AppData\Local\Temp\pip-build-env-thzd1pw8\overlay\Lib\site-packages\setuptools\command\build_py.py:204: _Warning: Package 'httptools.parser' is absent from the `packages` configuration.
      !!

              ********************************************************************************
              ############################
              # Package would be ignored #
              ############################
              Python recognizes 'httptools.parser' as an importable package[^1],
              but it is absent from setuptools' `packages` configuration.

              This leads to an ambiguous overall configuration. If you want to distribute this
              package, please make sure that 'httptools.parser' is explicitly added
              to the `packages` configuration field.

              Alternatively, you can also rely on setuptools' discovery methods
              (for example by using `find_namespace_packages(...)`/`find_namespace:`
              instead of `find_packages(...)`/`find:`).

              You can read more about "package discovery" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

              If you don't want 'httptools.parser' to be distributed and are
              already explicitly excluding 'httptools.parser' via
              `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
              you can try to use `exclude_package_data`, or `include-package-data=False` in
              combination with a more fine grained `package-data` configuration.

              You can read more about "package data files" on setuptools documentation page:

              - https://setuptools.pypa.io/en/latest/userguide/datafiles.html

              [^1]: For Python, any directory (with suitable naming) can be imported,
                    even if it does not contain any `.py` files.
                    On the other hand, currently there is no concept of package data
                    directory, all directories are treated like packages.
              ********************************************************************************

      !!
        check.warn(importable)
      copying httptools\parser\parser.c -> build\lib.win-amd64-cpython-312\httptools\parser
      copying httptools\parser\url_parser.c -> build\lib.win-amd64-cpython-312\httptools\parser
      running build_ext
      building 'httptools.parser.parser' extension
      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/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for httptools
Failed to build httptools
ERROR: Could not build wheels for httptools, which is required to install pyproject.toml-based projects

And I need the httptools package to be able to install the uvicorn server. Any suggestions?

By the way, I'm using Python 3.12.0 x64.

Thanks in advance.

unnati-shree commented 1 year ago

You need to install the Microsoft Visual C++ 14.0 or greater.

Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

This error happens because a httptools wheel does not yet exist for python 3.12

ansegura7 commented 1 year ago

Thank you for the clarification and solution. I will close the issue.