Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install openai because "Failed building wheel for aiohttp" #645

Closed
TechnoCatza opened this issue Oct 10, 2023 · 14 comments
Closed

Cannot install openai because "Failed building wheel for aiohttp" #645

TechnoCatza opened this issue Oct 10, 2023 · 14 comments
Labels
fixed in v1 Issues addressed by the v1 beta

Comments

@TechnoCatza
Copy link

TechnoCatza commented Oct 10, 2023

Describe the bug

I yesterday freshly install Python, and now i want to install openai. The installation always fails at building the wheel for aiohttp. Im not a big programmer, so i dont know what is wrong here (I did remove my user name for this post)

To Reproduce

  1. Install Python (newest version)
  2. Install openai

Expected: Succesfully Installing openai

Code snippets

pip3.12 install --upgrade openai
Collecting openai
  Obtaining dependency information for openai from https://files.pythonhosted.org/packages/1e/9f/385c25502f437686e4aa715969e5eaf5c2cb5e5ffa7c5cdd52f3c6ae967a/openai-0.28.1-py3-none-any.whl.metadata
  Using cached openai-0.28.1-py3-none-any.whl.metadata (11 kB)
Requirement already satisfied: requests>=2.20 in c:\users\\appdata\local\programs\python\python312\lib\site-packages (from openai) (2.31.0)
Collecting tqdm (from openai)
  Obtaining dependency information for tqdm from https://files.pythonhosted.org/packages/00/e5/f12a80907d0884e6dff9c16d0c0114d81b8cd07dc3ae54c5e962cc83037e/tqdm-4.66.1-py3-none-any.whl.metadata
  Using cached tqdm-4.66.1-py3-none-any.whl.metadata (57 kB)
Collecting aiohttp (from openai)
  Using cached aiohttp-3.8.6.tar.gz (7.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\\appdata\local\programs\python\python312\lib\site-packages (from requests>=2.20->openai) (3.3.0)
Requirement already satisfied: idna<4,>=2.5 in c:\users\\appdata\local\programs\python\python312\lib\site-packages (from requests>=2.20->openai) (3.4)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\\appdata\local\programs\python\python312\lib\site-packages (from requests>=2.20->openai) (2.0.6)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\\appdata\local\programs\python\python312\lib\site-packages (from requests>=2.20->openai) (2023.7.22)
Collecting attrs>=17.3.0 (from aiohttp->openai)
  Using cached attrs-23.1.0-py3-none-any.whl (61 kB)
Collecting multidict<7.0,>=4.5 (from aiohttp->openai)
  Using cached multidict-6.0.4-cp312-cp312-win_amd64.whl
Collecting async-timeout<5.0,>=4.0.0a3 (from aiohttp->openai)
  Obtaining dependency information for async-timeout<5.0,>=4.0.0a3 from https://files.pythonhosted.org/packages/a7/fa/e01228c2938de91d47b307831c62ab9e4001e747789d0b05baf779a6488c/async_timeout-4.0.3-py3-none-any.whl.metadata 
  Using cached async_timeout-4.0.3-py3-none-any.whl.metadata (4.2 kB)
Collecting yarl<2.0,>=1.0 (from aiohttp->openai)
  Using cached yarl-1.9.2-cp312-cp312-win_amd64.whl
Collecting frozenlist>=1.1.1 (from aiohttp->openai)
  Using cached frozenlist-1.4.0-cp312-cp312-win_amd64.whl
Collecting aiosignal>=1.1.2 (from aiohttp->openai)
  Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Requirement already satisfied: colorama in c:\users\\appdata\local\programs\python\python312\lib\site-packages (from tqdm->openai) (0.4.6)
Using cached openai-0.28.1-py3-none-any.whl (76 kB)
Using cached tqdm-4.66.1-py3-none-any.whl (78 kB)
Using cached async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Building wheels for collected packages: aiohttp
  Building wheel for aiohttp (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for aiohttp (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [110 lines of output]
      *********************
      * Accelerated build *
      *********************
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-312
      creating build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\abc.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\base_protocol.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\client.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\client_exceptions.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\client_proto.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\client_reqrep.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\client_ws.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\connector.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\cookiejar.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\formdata.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\hdrs.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\helpers.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\http.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\http_exceptions.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\http_parser.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\http_websocket.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\http_writer.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\locks.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\log.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\multipart.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\payload.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\payload_streamer.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\pytest_plugin.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\resolver.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\streams.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\tcp_helpers.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\test_utils.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\tracing.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\typedefs.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_app.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_exceptions.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_fileresponse.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_log.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_middlewares.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_protocol.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_request.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_response.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_routedef.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_runner.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_server.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_urldispatcher.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\web_ws.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\worker.py -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\__init__.py -> build\lib.win-amd64-cpython-312\aiohttp
      running egg_info
      writing aiohttp.egg-info\PKG-INFO
      writing dependency_links to aiohttp.egg-info\dependency_links.txt
      writing requirements to aiohttp.egg-info\requires.txt
      writing top-level names to aiohttp.egg-info\top_level.txt
      reading manifest file 'aiohttp.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no files found matching 'aiohttp' anywhere in distribution
      warning: no previously-included files matching '*.pyc' found anywhere in distribution
      warning: no previously-included files matching '*.pyd' found anywhere in distribution
      warning: no previously-included files matching '*.so' found anywhere in distribution
      warning: no previously-included files matching '*.lib' found anywhere in distribution
      warning: no previously-included files matching '*.dll' found anywhere in distribution
      warning: no previously-included files matching '*.a' found anywhere in distribution
      warning: no previously-included files matching '*.obj' found anywhere in distribution
      warning: no previously-included files found matching 'aiohttp\*.html'
      no previously-included directories found matching 'docs\_build'
      adding license file 'LICENSE.txt'
      writing manifest file 'aiohttp.egg-info\SOURCES.txt'
      copying aiohttp\_cparser.pxd -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\_find_header.pxd -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\_headers.pxi -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\_helpers.pyi -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\_helpers.pyx -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\_http_parser.pyx -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\_http_writer.pyx -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\_websocket.pyx -> build\lib.win-amd64-cpython-312\aiohttp
      copying aiohttp\py.typed -> build\lib.win-amd64-cpython-312\aiohttp
      creating build\lib.win-amd64-cpython-312\aiohttp\.hash
      copying aiohttp\.hash\_cparser.pxd.hash -> build\lib.win-amd64-cpython-312\aiohttp\.hash
      copying aiohttp\.hash\_find_header.pxd.hash -> build\lib.win-amd64-cpython-312\aiohttp\.hash
      copying aiohttp\.hash\_helpers.pyi.hash -> build\lib.win-amd64-cpython-312\aiohttp\.hash
      copying aiohttp\.hash\_helpers.pyx.hash -> build\lib.win-amd64-cpython-312\aiohttp\.hash
      copying aiohttp\.hash\_http_parser.pyx.hash -> build\lib.win-amd64-cpython-312\aiohttp\.hash
      copying aiohttp\.hash\_http_writer.pyx.hash -> build\lib.win-amd64-cpython-312\aiohttp\.hash
      copying aiohttp\.hash\_websocket.pyx.hash -> build\lib.win-amd64-cpython-312\aiohttp\.hash
      copying aiohttp\.hash\hdrs.py.hash -> build\lib.win-amd64-cpython-312\aiohttp\.hash
      running build_ext
      building 'aiohttp._websocket' extension
      creating build\temp.win-amd64-cpython-312
      creating build\temp.win-amd64-cpython-312\Release
      creating build\temp.win-amd64-cpython-312\Release\aiohttp
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\\AppData\Local\Programs\Python\Python312\include -IC:\Users\\AppData\Local\Programs\Python\Python312\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.37.32822\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /Tcaiohttp/_websocket.c /Fobuild\temp.win-amd64-cpython-312\Release\aiohttp/_websocket.obj
      _websocket.c
      aiohttp/_websocket.c(1475): warning C4996: 'Py_OptimizeFlag': deprecated in 3.12
      aiohttp/_websocket.c(3042): error C2039: 'ob_digit': is not a member of '_longobject'
      C:\Users\\AppData\Local\Programs\Python\Python312\include\cpython/longintrepr.h(87): note: see declaration of '_longobject'
      aiohttp/_websocket.c(3097): error C2039: 'ob_digit': is not a member of '_longobject'
      C:\Users\\AppData\Local\Programs\Python\Python312\include\cpython/longintrepr.h(87): note: see declaration of '_longobject'
      aiohttp/_websocket.c(3238): error C2039: 'ob_digit': is not a member of '_longobject'
      C:\Users\\AppData\Local\Programs\Python\Python312\include\cpython/longintrepr.h(87): note: see declaration of '_longobject'
      aiohttp/_websocket.c(3293): error C2039: 'ob_digit': is not a member of '_longobject'
      C:\Users\\AppData\Local\Programs\Python\Python312\include\cpython/longintrepr.h(87): note: see declaration of '_longobject'
      aiohttp/_websocket.c(3744): error C2039: 'ob_digit': is not a member of '_longobject'
      C:\Users\\AppData\Local\Programs\Python\Python312\include\cpython/longintrepr.h(87): note: see declaration of '_longobject'
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.37.32822\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

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

OS

Windows 11

Python version

Python v3.12

Library version

Newest

@TechnoCatza TechnoCatza added the bug Something isn't working label Oct 10, 2023
@RobertCraigie
Copy link
Collaborator

This is happening because aiohttp doesn't support Python 3.12 yet. Support is currently in a beta version: aio-libs/aiohttp#7675.

I'd recommend using Python 3.11 as 3.12 was only recently released and there almost definitely will be other libraries that don't support it yet as well.

This is "fixed" in our v1 beta as we've moved away from aiohttp to httpx which is a pure python library and while they don't advertise 3.12 support yet, it is much more likely to work out of the box.

@RobertCraigie RobertCraigie closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2023
@RobertCraigie RobertCraigie added fixed in v1 Issues addressed by the v1 beta and removed bug Something isn't working labels Oct 11, 2023
@usmantariq1240
Copy link

i am facing the same error. still not clear to me how to solve it?

@usmantariq1240
Copy link

@RobertCraigie so how to solve this? just by changing the version of python?

@usmantariq1240
Copy link

@TechnoCatza how did you resolve this error?

@RobertCraigie
Copy link
Collaborator

@usmantariq1240 yes that would work, your options are

  • install a beta version of aiohttp
  • downgrade python to 3.11 or lower
  • switch to the v1 beta of the openai SDK

@PPJun0
Copy link

PPJun0 commented Oct 15, 2023

thanks god

@usmantariq1240
Copy link

@usmantariq1240 yes that would work, your options are

  • install a beta version of aiohttp
  • downgrade python to 3.11 or lower
  • switch to the v1 beta of the openai SDK

Thank You for your help! it worked 😊

@MitchRamsay
Copy link

How do I downgrade from Python 3.12 to 3.11?

@MitchRamsay
Copy link

@usmantariq1240 yes that would work, your options are

  • install a beta version of aiohttp
  • downgrade python to 3.11 or lower
  • switch to the v1 beta of the openai SDK

Hi, How do I downgrade to Python 3.11 from 3.12 on a Mac?

@RobertCraigie
Copy link
Collaborator

This depends entirely on your setup and unfortunately there are many different ways of configuring Python. Do you know how python is setup on your system?

A side note, I'd personally recommend using Rye as it manages python versions for you and changing versions is as simple as

@aoweixu
Copy link

aoweixu commented Oct 17, 2023

@usmantariq1240 yes that would work, your options are

  • install a beta version of aiohttp
  • downgrade python to 3.11 or lower
  • switch to the v1 beta of the openai SDK

Hi, How do I downgrade to Python 3.11 from 3.12 on a Mac?

Downgrading your default python installation can often cause unexpected results. I would install python 3.11 separately and use it to create a virtual environment specific to your openai project.

@nileshian
Copy link

nileshian commented Oct 24, 2023

Probleb solved!!!

I have unistall 3.12.0 version of python and install 3.11.0

Click here to install 3.11.0

This solved my problem and able to install openai now.

@wa8eem
Copy link

wa8eem commented Oct 31, 2023

This is happening because aiohttp doesn't support Python 3.12 yet. Support is currently in a beta version: aio-libs/aiohttp#7675.

I'd recommend using Python 3.11 as 3.12 was only recently released and there almost definitely will be other libraries that don't support it yet as well.

This is "fixed" in our v1 beta as we've moved away from aiohttp to httpx which is a pure python library and while they don't advertise 3.12 support yet, it is much more likely to work out of the box.

Thanks man, It actually helped me!!

@RubTalha
Copy link

https://stackoverflow.com/a/77388956/13086128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in v1 Issues addressed by the v1 beta
Projects
None yet
Development

No branches or pull requests

9 participants