openai / openai-python

The official Python library for the OpenAI API
https://pypi.org/project/openai/
Apache License 2.0
23.08k stars 3.25k forks source link

pip Install openai in android cli #1884

Closed leemeng0x61 closed 47 minutes ago

leemeng0x61 commented 9 hours ago

Confirm this is a feature request for the Python library and not the underlying OpenAI API.

Describe the feature or improvement you're requesting

When I install via pip install openai, I encounter can't find Rust compiler. Since rust does not support the android host temporarily, is there an alternative solution?

(ENV) msmnile_gvmq:/data/local/tmp $ pip install openai
Collecting openai
  Using cached openai-1.55.0-py3-none-any.whl.metadata (24 kB)
Requirement already satisfied: anyio<5,>=3.5.0 in ./ENV/lib/python3.12/site-packages (from openai) (4.6.2.post1)
Collecting distro<2,>=1.7.0 (from openai)
  Using cached distro-1.9.0-py3-none-any.whl.metadata (6.8 kB)
Requirement already satisfied: httpx<1,>=0.23.0 in ./ENV/lib/python3.12/site-packages (from openai) (0.27.2)
Collecting jiter<1,>=0.4.0 (from openai)
  Using cached jiter-0.7.1.tar.gz (162 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [50 lines of output]
      Collecting maturin<2,>=1
        Using cached maturin-1.7.4.tar.gz (191 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Building wheels for collected packages: maturin
        Building wheel for maturin (pyproject.toml): started
        Building wheel for maturin (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error

        × Building wheel for maturin (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [28 lines of output]
            running bdist_wheel
            running build
            running build_py
            creating build/lib.linux-armv8l-cpython-312/maturin
            copying maturin/__init__.py -> build/lib.linux-armv8l-cpython-312/maturin
            copying maturin/__main__.py -> build/lib.linux-armv8l-cpython-312/maturin
            running egg_info
            writing maturin.egg-info/PKG-INFO
            writing dependency_links to maturin.egg-info/dependency_links.txt
            writing requirements to maturin.egg-info/requires.txt
            writing top-level names to maturin.egg-info/top_level.txt
            reading manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest template 'MANIFEST.in'
            warning: no files found matching '*.json' under directory 'src/python_interpreter'
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            running build_ext
            running build_rust
            **error: can't find Rust compiler**

            If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

            To update pip, run:

                pip install --upgrade pip

            and then retry package installation.

            If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for maturin
      Failed to build maturin
      ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (maturin)
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies 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.

Additional context

No response

RobertCraigie commented 47 minutes ago

Hey @leemeng0x61, thanks for the report. Unfortunately there isn't anything we can do to help here, jiter is a required dependency and making it optional would be a breaking change.

If you're not planning on using the streaming helpers, you may be able to get pip to ignore the dependency error somehow and add a stub file like this to your python path so that our runtime imports of jiter will work

# jiter.py
def from_json(*args, **kwargs):
  raise NotImplementedError("jiter is not available")