chaquo / chaquopy

Chaquopy: the Python SDK for Android
https://chaquo.com/chaquopy/
MIT License
793 stars 130 forks source link

Install of openai is failing with some issues related to jiter #1227

Open jksaras opened 1 month ago

jksaras commented 1 month ago
> Task :app:generateFullDebugPythonRequirements
Chaquopy: Installing for arm64-v8a
Looking in indexes: https://pypi.org/simple, https://chaquo.com/pypi-7.0, https://chaquo.com/pypi-13.1
Collecting pandas
  Using cached https://chaquo.com/pypi-13.1/pandas/pandas-1.5.0-1-cp311-cp311-android_21_arm64_v8a.whl (10.1 MB)
Collecting pydantic==1.10.7
  Using cached pydantic-1.10.7-py3-none-any.whl (157 kB)
Collecting wheel==0.41.2
  Using cached wheel-0.41.2-py3-none-any.whl (64 kB)
Collecting six
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting openai
  Using cached openai-1.40.1-py3-none-any.whl (360 kB)
Collecting numpy
  Using cached https://chaquo.com/pypi-13.1/numpy/numpy-1.26.2-0-cp311-cp311-android_21_arm64_v8a.whl (5.0 MB)
Collecting pytz>=2020.1
  Using cached pytz-2024.1-py2.py3-none-any.whl (505 kB)
Collecting chaquopy-libcxx>=11000
  Using cached https://chaquo.com/pypi-7.0/chaquopy-libcxx/chaquopy_libcxx-11000-0-py3-none-android_21_arm64_v8a.whl (308 kB)
Collecting python-dateutil>=2.8.1
  Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Collecting typing-extensions>=4.2.0
  Using cached typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Collecting sniffio
  Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)
Collecting anyio<5,>=3.5.0
  Using cached anyio-4.4.0-py3-none-any.whl (86 kB)
Collecting distro<2,>=1.7.0
  Using cached distro-1.9.0-py3-none-any.whl (20 kB)
Collecting tqdm>4
  Using cached tqdm-4.66.5-py3-none-any.whl (78 kB)
Collecting jiter<1,>=0.4.0
  Using cached jiter-0.5.0.tar.gz (158 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 wheel metadata: started
    Preparing wheel metadata: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\jatan.kshirsagar\AppData\Local\Programs\Python\Python311\python.exe' 'D:\Code\Android\feature_development_1\SarasAndroid\app\build\generated\python\bp\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\JATAN~1.KSH\AppData\Local\Temp\tmpgq2gfzib'
         cwd: C:\Users\jatan.kshirsagar\AppData\Local\Temp\pip-install-3btkus86\jiter
    Complete output (26 lines):
    Checking for Rust toolchain....
    Running `maturin pep517 write-dist-info --metadata-directory C:\Users\jatan.kshirsagar\AppData\Local\Temp\pip-modern-metadata-jaby74um --interpreter C:\Users\jatan.kshirsagar\AppData\Local\Programs\Python\Python311\python.exe`
    Traceback (most recent call last):
      File "D:\Code\Android\feature_development_1\SarasAndroid\app\build\generated\python\bp\pip\_vendor\pep517\_in_process.py", line 280, in <module>
        main()
    ERROR: Command errored out with exit status 1:

      File "D:\Code\Android\feature_development_1\SarasAndroid\app\build\generated\python\bp\pip\_vendor\pep517\_in_process.py", line 263, in main
        json_out['return_val'] = hook(**hook_input['kwargs'])
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "D:\Code\Android\feature_development_1\SarasAndroid\app\build\generated\python\bp\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
        return hook(metadata_directory, config_settings)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\jatan.kshirsagar\AppData\Local\Temp\pip-build-env-e3kkimc4\overlay\Lib\site-packages\maturin\__init__.py", line 203, in prepare_metadata_for_build_wheel
        _output = subprocess.check_output(command)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\jatan.kshirsagar\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 466, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\jatan.kshirsagar\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 548, in run
        with Popen(*popenargs, **kwargs) as process:
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\jatan.kshirsagar\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1026, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "C:\Users\jatan.kshirsagar\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1538, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    ----------------------------------------
ERROR: Failed to install jiter<1,>=0.4.0 from https://files.pythonhosted.org/packages/d7/1a/aa64be757afc614484b370a4d9fc1747dc9237b37ce464f7f9d9ca2a3d38/jiter-0.5.0.tar.gz#sha256=1d916ba875bcab5c5f7d927df998c4cb694d27dceddf3392e58beaf10563368a (from openai).
For assistance, please raise an issue at https://github.com/chaquo/chaquopy/issues.
Failed to install jiter<1,>=0.4.0 from https://files.pythonhosted.org/packages/d7/1a/aa64be757afc614484b370a4d9fc1747dc9237b37ce464f7f9d9ca2a3d38/jiter-0.5.0.tar.gz#sha256=1d916ba875bcab5c5f7d927df998c4cb694d27dceddf3392e58beaf10563368a (from openai).

Chaquopy: Exit status 1

Chaquopy version

classpath "com.chaquo.python:gradle:14.0.2"

Relevant parts of your build.gradle file

python {
            version "3.11"
            pip {
                install "pandas"
                install "pydantic==1.10.7"
                install "wheel==0.41.2"
                install "six"
                install "openai"
                install "numpy"
            }
        }
full {
            dimension "version"
            versionNameSuffix "-full"
            ndk.abiFilters 'armeabi-v7a','arm64-v8a', 'x86_64'
        }
mhsmith commented 1 month ago

Thanks for the report. Unfortunately it won't be possible to use jiter until we have proper support for Rust (#1030).

However, you may be able to work around this by using an older version of openai.

If anyone else has this issue, let us know by clicking the thumbs-up button above.

JameslaoA commented 1 month ago

@mhsmith I encountered the same error when installing openai in android studio. How can I solve it?

classpath 'com.android.tools.build:gradle:4.2.1' classpath 'com.chaquo.python:gradle:9.0.0' id 'com.chaquo.python' version '14.0.2' apply false

error log : Collecting jiter<1,>=0.4.0 Using cached jiter-0.5.0.tar.gz (158 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 wheel metadata: started Preparing wheel metadata: finished with status 'error' ERROR: Command errored out with exit status 1: command: 'D:\fibotranslate\app\build\python\env\debug\Scripts\python.exe' 'D:\fibotranslate\app\build\python\env\debug\lib\site-packages\pip_vendor\pep517_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\Administ rator\AppData\Local\Temp\tmp2kiako8b' cwd: C:\Users\Administrator\AppData\Local\Temp\pip-install-lbu_day2\jiter Checking for Rust toolchain.... Running maturin pep517 write-dist-info --metadata-directory C:\Users\Administrator\AppData\Local\Temp\pip-modern-metadata-ze36jg06 --interpreter D:\fibotranslate\app\build\python\env\debug\Scripts\python.exe Traceback (most recent call last):

mhsmith commented 1 month ago

Like I said, I think older versions of openai don't have this dependency.

jatankshirsagar commented 1 month ago

we resolved it by using the openai version 1.39.0