3

I'm trying to install OpenAI with Python 3.11, Windows OS, pip fully upgraded, and I got this error.

Here is the full error message:

Collecting openai
  Using cached openai-0.26.0.tar.gz (54 kB)
  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 "C:\Users\vocal\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
          main()
        File "C:\Users\vocal\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\vocal\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\vocal\AppData\Local\Temp\pip-build-env-lr3fjsgg\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\vocal\AppData\Local\Temp\pip-build-env-lr3fjsgg\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "C:\Users\vocal\AppData\Local\Temp\pip-build-env-lr3fjsgg\overlay\Lib\site-packages\setuptools\build_meta.py", line 485, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\vocal\AppData\Local\Temp\pip-build-env-lr3fjsgg\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 13, in <module>
      UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 1031: illegal multibyte sequence
      [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.

I have no idea how to solve this error. Can anybody give me a hint?

UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 1031: illegal multibyte sequence

Because of that message, I tried this solution and it didn't work.

Rubén
  • 34,714
  • 9
  • 70
  • 166
Ljyeon
  • 43
  • 1
  • 4

2 Answers2

7

I working in Google Colab and I have the same issue. I fixed it by doing the same thing.

!pip install --upgrade pip
!pip install openai
owernet
  • 91
  • 3
  • As of March 9, 2023, the above solution works in Colab. Running `!pip install --upgrade pip` upgrades `pip-22.0.4` to `pip-23.0.1`, the version required for openai to be installed. – jeanhuguesroy Mar 09 '23 at 12:32
6

I ran into this problem recently on a fresh Linux VM, but the solution was actually quite simple. I added the pip version to the install command, e.g. pip3.10 install openai and everything worked as intended.

This may not be the same issue for your Windows environment, but here is the full write up I posted since I couldn't find any helpful information at the time.

ramayac
  • 5,173
  • 10
  • 50
  • 58
  • Just for the note, I had the same issue on Google colab and running `%pip install --upgrade pip %pip install openai` worked. – Masa Mar 09 '23 at 01:33