I keep getting the same error when installing openai

python version = 3.9
pip version = 22.3.1

I am trying to pip install to use openai, but the following error continuously occurs.

To solve it, I entered ‘chcp 65001’ in the anaconda powershell prompt window and proceeded, and I checked all the environment variables, but the same error still occurs.

Is there anyone who has had the same problem as me and has a solution?

 UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 1031: illegal multibyte sequence
  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.
  full command: 'C:\Users\krema\anaconda3\python.exe' 'C:\Users\krema\anaconda3\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py' get_requires_for_build_wheel 'C:\Users\krema\AppData\Local\Temp\tmpdjgd_v3b'
  cwd: C:\Users\krema\AppData\Local\Temp\pip-install-xs3yacfq\openai_9ef093dfd6b74f799d5500aa51d0f77e
  Getting requirements to build wheel ... error
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.

Well, that’s a very specific error.

Uninstall Python with pip, anaconda and everything, restart your computer and start clean.

Make sure to install 3.11 or newer.

Hi,
I have the same problem as yours.
I soved it by change the locale.getpreferredencoding() setting and then rebooted.
Control panel → Clock and Region → Region → Administrative → Change system locale → Check Beta: Use Unicode UTF-8

1 Like

I had this issue as well, but on a bare bones Ubuntu Server VM. Hopefully the solution is the same.

What ultimately worked was declaring the pip version when installing. So pip3.10 install openai did it for me. There was nothing online when I first had this problem, so I wrote it out here: Python Error When Istalling OpenAI.

1 Like