openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

pip install failure deprecation on >=v0.26.4

Open frison opened this issue 2 years ago • 1 comments

Describe the bug

Versions >= v0.26.4 fail to install on fresh Ubuntu 22.04 container w/ Kernel Linux [redacted]-2017 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

To Reproduce

With the following Dockerfile:

FROM ubuntu:22.04

RUN \
    DEBIAN_FRONTEND=noninteractive apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
    curl \
    git \
    python3 python3-pip

RUN echo "openai==0.26.4" > /requirements.txt
RUN pip install -r /requirements.txt

Note the installation failure:

 > [4/4] RUN pip install -r /requirements.txt:                                                                                                                                                                                                                                           
#10 1.029 Collecting openai==0.26.4                                                                                                                                                                                                                                                      
#10 1.265   Downloading openai-0.26.4.tar.gz (55 kB)                                                                                                                                                                                                                                     
#10 1.298      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.6/55.6 KB 1.6 MB/s eta 0:00:00                                                                                                                                                                                                
#10 1.463   Installing build dependencies: started                                                                                                                                                                                                                                       
#10 4.490   Installing build dependencies: finished with status 'done'
#10 4.493   Getting requirements to build wheel: started
#10 4.689   Getting requirements to build wheel: finished with status 'error'
#10 4.698   error: subprocess-exited-with-error
#10 4.698   
#10 4.698   × Getting requirements to build wheel did not run successfully.
#10 4.698   │ exit code: 1
#10 4.698   ╰─> [81 lines of output]
#10 4.698       Traceback (most recent call last):
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/config.py", line 419, in _parse_attr
#10 4.698           return getattr(StaticModule(module_name), attr_name)
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/config.py", line 26, in __init__
#10 4.698           spec = importlib.util.find_spec(name)
#10 4.698         File "/usr/lib/python3.10/importlib/util.py", line 94, in find_spec
#10 4.698           parent = __import__(parent_name, fromlist=['__path__'])
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/__init__.py", line 9, in <module>
#10 4.698           from openai.api_resources import (
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_resources/__init__.py", line 1, in <module>
#10 4.698           from openai.api_resources.completion import Completion  # noqa: F401
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_resources/completion.py", line 4, in <module>
#10 4.698           from openai.api_resources.abstract import DeletableAPIResource, ListableAPIResource
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_resources/abstract/__init__.py", line 3, in <module>
#10 4.698           from openai.api_resources.abstract.api_resource import APIResource
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_resources/abstract/api_resource.py", line 4, in <module>
#10 4.698           from openai import api_requestor, error, util
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_requestor.py", line 21, in <module>
#10 4.698           import aiohttp
#10 4.698       ModuleNotFoundError: No module named 'aiohttp'
#10 4.698       
#10 4.698       During handling of the above exception, another exception occurred:
#10 4.698       
#10 4.698       Traceback (most recent call last):
#10 4.698         File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
#10 4.698           main()
#10 4.698         File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
#10 4.698           json_out['return_val'] = hook(**hook_input['kwargs'])
#10 4.698         File "/usr/lib/python3/dist-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
#10 4.698           return hook(config_settings)
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
#10 4.698           return self._get_build_requires(
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 143, in _get_build_requires
#10 4.698           self.run_setup()
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in run_setup
#10 4.698           exec(compile(code, __file__, 'exec'), locals())
#10 4.698         File "setup.py", line 3, in <module>
#10 4.698           setup()
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
#10 4.698           return distutils.core.setup(**attrs)
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 122, in setup
#10 4.698           dist.parse_config_files()
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 804, in parse_config_files
#10 4.698           parse_configuration(
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/config.py", line 158, in parse_configuration
#10 4.698           meta.parse()
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/config.py", line 498, in parse
#10 4.698           section_parser_method(section_options)
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/config.py", line 469, in parse_section
#10 4.698           self[name] = value
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/config.py", line 222, in __setitem__
#10 4.698           value = parser(value)
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/config.py", line 599, in _parse_version
#10 4.698           version = self._parse_attr(value, self.package_dir)
#10 4.698         File "/usr/lib/python3/dist-packages/setuptools/config.py", line 422, in _parse_attr
#10 4.698           module = importlib.import_module(module_name)
#10 4.698         File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
#10 4.698           return _bootstrap._gcd_import(name[level:], package, level)
#10 4.698         File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
#10 4.698         File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
#10 4.698         File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
#10 4.698         File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
#10 4.698         File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
#10 4.698         File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
#10 4.698         File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
#10 4.698         File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
#10 4.698         File "<frozen importlib._bootstrap_external>", line 883, in exec_module
#10 4.698         File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/__init__.py", line 9, in <module>
#10 4.698           from openai.api_resources import (
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_resources/__init__.py", line 1, in <module>
#10 4.698           from openai.api_resources.completion import Completion  # noqa: F401
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_resources/completion.py", line 4, in <module>
#10 4.698           from openai.api_resources.abstract import DeletableAPIResource, ListableAPIResource
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_resources/abstract/__init__.py", line 3, in <module>
#10 4.698           from openai.api_resources.abstract.api_resource import APIResource
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_resources/abstract/api_resource.py", line 4, in <module>
#10 4.698           from openai import api_requestor, error, util
#10 4.698         File "/tmp/pip-install-7lrzz_ii/openai_2922e99e37a54fe8816c6c965a07945b/openai/api_requestor.py", line 21, in <module>
#10 4.698           import aiohttp
#10 4.698       ModuleNotFoundError: No module named 'aiohttp'
#10 4.698       [end of output]
#10 4.698   
#10 4.698   note: This error originates from a subprocess, and is likely not a problem with pip.
#10 4.702 error: subprocess-exited-with-error
#10 4.702 
#10 4.702 × Getting requirements to build wheel did not run successfully.
#10 4.702 │ exit code: 1
#10 4.702 ╰─> See above for output.
#10 4.702 
#10 4.702 note: This error originates from a subprocess, and is likely not a problem with pip.

Installs cleanly with:

FROM ubuntu:22.04

RUN \
    DEBIAN_FRONTEND=noninteractive apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y \
    curl \
    git \
    python3 python3-pip

RUN echo "openai==0.26.3" > /requirements.txt
RUN pip install -r /requirements.txt

Code snippets

No response

OS

Windows 10/WSL2

Python version

Python 3.10.6

Library version

openai-python >=v0.26.4

frison avatar Feb 15 '23 04:02 frison

This is a dupe of https://github.com/openai/openai-python/issues/219 , but I narrowed things down for you.

frison avatar Feb 15 '23 04:02 frison

this issue should be fixed in v0.27.2. Can you give that a shot?

hallacy avatar Mar 11 '23 03:03 hallacy