leng-yue / py-scrcpy-client

An easy to use python scrcpy client
https://leng-yue.github.io/py-scrcpy-client/
MIT License
283 stars 71 forks source link

error: subprocess-exited-with-error when install python package #59

Closed Mrithul-E closed 2 months ago

Mrithul-E commented 3 months ago

C:\Users\Administrator>pip install scrcpy-client[ui] Collecting scrcpy-client[ui] Using cached scrcpy_client-0.4.1-py3-none-any.whl.metadata (2.8 kB) Collecting PySide6<7.0.0,>=6.3.0 (from scrcpy-client[ui]) Using cached PySide6-6.7.0-cp39-abi3-win_amd64.whl.metadata (5.5 kB) Collecting adbutils<0.15.0,>=0.14.1 (from scrcpy-client[ui]) Using cached adbutils-0.14.1-py3-none-win_amd64.whl.metadata (918 bytes) Collecting av<10.0.0,>=9.2.0 (from scrcpy-client[ui]) Using cached av-9.2.0.tar.gz (2.4 MB) 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 ╰─> [74 lines of output] Compiling av\buffer.pyx because it changed. [1/1] Cythonizing av\buffer.pyx Compiling av\bytesource.pyx because it changed. [1/1] Cythonizing av\bytesource.pyx Compiling av\descriptor.pyx because it changed. [1/1] Cythonizing av\descriptor.pyx Compiling av\dictionary.pyx because it changed. [1/1] Cythonizing av\dictionary.pyx Compiling av\enum.pyx because it changed. [1/1] Cythonizing av\enum.pyx Compiling av\error.pyx because it changed. [1/1] Cythonizing av\error.pyx Compiling av\format.pyx because it changed. [1/1] Cythonizing av\format.pyx Compiling av\frame.pyx because it changed. [1/1] Cythonizing av\frame.pyx performance hint: av\logging.pyx:232:5: Exception check on 'log_callback' will always require the GIL to be acquired. Possible solutions:

  1. Declare 'log_callback' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
  2. Use an 'int' return type on 'log_callback' to allow an error code to be returned.

    Error compiling Cython file:

    ... cdef const char log_context_name(void ptr) nogil: cdef log_context obj = <log_context>ptr return obj.name

    cdef lib.AVClass log_class log_class.item_name = log_context_name ^

    av\logging.pyx:216:22: Cannot assign type 'const char (void ) except? NULL nogil' to 'const char ()(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to the type of 'log_context_name'.

    Error compiling Cython file:

    ...

    Start the magic!

    We allow the user to fully disable the logging system as it will not play

    nicely with subinterpreters due to FFmpeg-created threads.

    if os.environ.get('PYAV_LOGGING') != 'off': lib.av_log_set_callback(log_callback) ^

    av\logging.pyx:351:28: Cannot assign type 'void (void , int, const char , va_list) except nogil' to 'av_log_callback' (alias of 'void ()(void , int, const char , va_list) noexcept nogil'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'log_callback'. Compiling av\logging.pyx because it changed. [1/1] Cythonizing av\logging.pyx Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(*hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-_cvakgx9\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-_cvakgx9\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires self.run_setup() File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-_cvakgx9\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-_cvakgx9\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup exec(code, locals()) File "", line 157, in File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-_cvakgx9\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1154, in cythonize cythonize_one(args) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-_cvakgx9\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1321, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: av\logging.pyx [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.

ActualMasterOogway commented 3 months ago

Getting the same error, Bump

aentwist commented 2 months ago

It's a Cython issue with av. If you get this error there are no prebuilt binaries for your arch/platform, and the version of av is bugged so it cannot build. Looks like with any luck if we upgrade or pin down av then it will resolve... the supposed fix was put in on Oct. 28, 2023 and the next version released after that looks like 11.0.0.

Indeed, I cannot install av 9.x or 10 but 11 installs successfully pip install av==11.0.0.

In this project we should upgrade av,

https://github.com/leng-yue/py-scrcpy-client/blob/4d9faa4996669f9f39b16d5d97f738f6add9acf7/pyproject.toml#L19

I really don't want to monkey patch this, so @leng-yue would you be open to upgrading it / merging a pull request from someone else?

On this topic, the av situation as to what, if any breaking changes there were between v9 and v11/12 appears completely undocumented. I'd just plug ^11 in and try it.

aentwist commented 2 months ago

Apparently according to av's issue a workaround is to constrain cython<3.0, but for some reason that isn't working for me, the verbose output still shows cython 3.x being used...

Another potential workaround is to downgrade your Python version to one for which av wheels are already built. This seems to be the most promising for now. #48

leng-yue commented 2 months ago

Can you submit a PR? I am happy to merge that

aentwist commented 2 months ago

Upgrading av removes support for python 3.7 (and allows support for 3.11, 3.12). This inevitable breaking change made it seem like an appropriate time to try to shove the python version. It appears that I also successfully addressed the cap of python 3.10, meaning everyone could now use 3.12 if they want too (vested interest). These are commit-separated depending on what you want.

The summary is python from 3.7-3.10 to 3.8-3.12 av from 9 to 12 pillow from 9 to 10

Motivation is unusually high to go out of my way to get this because python.org doesn't distribute python 3.9, 3.10 binaries for windows so I'd have to compile from source on windows and that's just gonna make me sick. Already tried and started having a bad time, so your prompt reply is welcomed. Let me know what you think @leng-yue

Edit: pyenv-win and chocolatey: exist This problem is indeed alternatively resolved by using an appropriate Python (3.10.11)