Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win11 python 3.11 unable to finish requirements.txt - Numpy #9

Open
hotwareboy opened this issue Apr 15, 2024 · 4 comments
Open

Win11 python 3.11 unable to finish requirements.txt - Numpy #9

hotwareboy opened this issue Apr 15, 2024 · 4 comments
Labels
help wanted Extra attention is needed

Comments

@hotwareboy
Copy link

Error

Collecting numpy<1.19.0,>=1.16.0 (from spleeter->-r requirements.txt (line 5))
Downloading numpy-1.18.5.zip (5.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.4/5.4 MB 86.2 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error

× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [90 lines of output]
Running from numpy source directory.
:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
C:\Users\user\AppData\Local\Temp\pip-install-5gc9rfl0\numpy_e963657ba9e14370aaf0e3a1b20de7c2\tools\cythonize.py:75: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
required_version = LooseVersion('0.29.14')
C:\Users\user\AppData\Local\Temp\pip-install-5gc9rfl0\numpy_e963657ba9e14370aaf0e3a1b20de7c2\tools\cythonize.py:77: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(cython_version) < required_version:
performance hint: _common.pyx:261:19: Exception check after calling 'random_func' will always require the GIL to be acquired. Declare 'random_func' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:285:19: Exception check after calling 'random_func' will always require the GIL to be acquired. Declare 'random_func' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:308:50: Exception check after calling 'random_func' will always require the GIL to be acquired. Declare 'random_func' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:411:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:448:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:490:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:573:36: Exception check after calling 'f0' will always require the GIL to be acquired. Declare 'f0' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:577:36: Exception check after calling 'f1' will always require the GIL to be acquired. Declare 'f1' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:581:36: Exception check after calling 'f2' will always require the GIL to be acquired. Declare 'f2' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:585:36: Exception check after calling 'f3' will always require the GIL to be acquired. Declare 'f3' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:617:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:652:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:687:63: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:727:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:756:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:874:40: Exception check after calling 'f0' will always require the GIL to be acquired. Declare 'f0' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:878:40: Exception check after calling 'fd' will always require the GIL to be acquired. Declare 'fd' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:882:41: Exception check after calling 'fdd' will always require the GIL to be acquired. Declare 'fdd' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:887:40: Exception check after calling 'fi' will always require the GIL to be acquired. Declare 'fi' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:891:41: Exception check after calling 'fdi' will always require the GIL to be acquired. Declare 'fdi' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:895:38: Exception check after calling 'fiii' will always require the GIL to be acquired. Declare 'fiii' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:930:31: Exception check after calling 'f' will always require the GIL to be acquired. Declare 'f' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _common.pyx:972:32: Exception check after calling 'f1' will always require the GIL to be acquired. Declare 'f1' as 'noexcept' if you control the definition and you're sure you don't want the function to raise exceptions.
performance hint: _generator.pyx:811:41: Exception check after calling '_shuffle_int' will always require the GIL to be acquired.
Possible solutions:
1. Declare '_shuffle_int' 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 '_shuffle_int' to allow an error code to be returned.
performance hint: _generator.pyx:840:45: Exception check after calling '_shuffle_int' will always require the GIL to be acquired.
Possible solutions:
1. Declare '_shuffle_int' 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 '_shuffle_int' to allow an error code to be returned.

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          for i in range(1, RK_STATE_LEN):
              self.rng_state.key[i] = val[i]
          self.rng_state.pos = i

          self._bitgen.state = &self.rng_state
          self._bitgen.next_uint64 = &mt19937_uint64
                                     ^
  ------------------------------------------------------------

  _mt19937.pyx:138:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to the type of the value being assigned.
  Processing numpy/random\_bounded_integers.pxd.in
  Processing numpy/random\mtrand.pyx
  Processing numpy/random\_bit_generator.pyx
  Processing numpy/random\_bounded_integers.pyx.in
  Processing numpy/random\_common.pyx
  Processing numpy/random\_generator.pyx
  Processing numpy/random\_mt19937.pyx
  Traceback (most recent call last):
    File "C:\Users\user\AppData\Local\Temp\pip-install-5gc9rfl0\numpy_e963657ba9e14370aaf0e3a1b20de7c2\tools\cythonize.py", line 238, in <module>
      main()
    File "C:\Users\user\AppData\Local\Temp\pip-install-5gc9rfl0\numpy_e963657ba9e14370aaf0e3a1b20de7c2\tools\cythonize.py", line 234, in main
      find_process_files(root_dir)
    File "C:\Users\user\AppData\Local\Temp\pip-install-5gc9rfl0\numpy_e963657ba9e14370aaf0e3a1b20de7c2\tools\cythonize.py", line 225, in find_process_files
      process(root_dir, fromfile, tofile, function, hash_db)
    File "C:\Users\user\AppData\Local\Temp\pip-install-5gc9rfl0\numpy_e963657ba9e14370aaf0e3a1b20de7c2\tools\cythonize.py", line 191, in process
      processor_function(fromfile, tofile)
    File "C:\Users\user\AppData\Local\Temp\pip-install-5gc9rfl0\numpy_e963657ba9e14370aaf0e3a1b20de7c2\tools\cythonize.py", line 80, in process_pyx
      subprocess.check_call(
    File "C:\python310\lib\subprocess.py", line 369, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['C:\\code\\audio\\vocal-separate\\venv\\Scripts\\python.exe', '-m', 'cython', '-3', '--fast-fail', '-o', '_mt19937.c', '_mt19937.pyx']' returned non-zero exit status 1.
  Cythonizing sources
  Traceback (most recent call last):
    File "C:\code\audio\vocal-separate\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
      main()
    File "C:\code\audio\vocal-separate\venv\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:\code\audio\vocal-separate\venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 149, in prepare_metadata_for_build_wheel
      return hook(metadata_directory, config_settings)
    File "C:\Users\user\AppData\Local\Temp\pip-build-env-gn8vj0ej\overlay\Lib\site-packages\setuptools\build_meta.py", line 366, in prepare_metadata_for_build_wheel
      self.run_setup()
    File "C:\Users\user\AppData\Local\Temp\pip-build-env-gn8vj0ej\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
      super().run_setup(setup_script=setup_script)
    File "C:\Users\user\AppData\Local\Temp\pip-build-env-gn8vj0ej\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 488, in <module>
    File "<string>", line 469, in setup_package
    File "<string>", line 275, in generate_cython
  RuntimeError: Running cythonize failed!
  [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

(venv) C:\code\audio\vocal-separate>

@jianchang512
Copy link
Owner

pip install -r requirements.txt --no-deps --ignore-installed

@MasterDevYY
Copy link

pip install -r requirements.txt --no-deps --ignore-installed

我用了这个方法依旧没法成功安装依赖,希望下次更新可以在requirements.txt指定版本号

@jianchang512
Copy link
Owner

jianchang512 commented Jul 31, 2024

由于 requirements.txt 管理依赖的简陋性,即便txt里指定版本号页依然可能存在各种安装兼容和报错问题。请依次尝试执行以下命令

  1. pip install --upgrade pip setuptools

  2. pip install numpy==1.18.5 --only-binary=:all:

  3. pip install cython

  4. pip install -r requirements.txt --no-deps --ignore-installed

@MasterDevYY
Copy link

由于 requirements.txt 管理依赖的简陋性,即便txt里指定版本号页依然可能存在各种安装兼容和报错问题。请依次尝试执行以下命令

  1. pip install --upgrade pip setuptools
  2. pip install numpy==1.18.5 --only-binary=:all:
  3. pip install cython
  4. pip install -r requirements.txt --no-deps --ignore-installed

终于解决了,我的环境是 Win10 + Python 3.10.11

解决方法:

  1. 创建一个干净的 venv 环境

  2. 安装 spleeter 本体

    pip install spleeter==2.4.0 tensorflow==2.9.3

    会同时安装 click-7.1.2typer-0.3.2numpy-2.0.1werkzeug-3.0.3

  3. 降级 numpy

    pip install numpy==1.23.5

    项目用numpy2.x跑不起来

  4. 升级 typer、安装 flask 和其他依赖

    pip install typer==0.4.1 flask==3.0.3 gevent==24.2.1

    可以忽略以下报错:

    spleeter 2.4.0 requires typer<0.4.0,>=0.3.2, but you have typer 0.4.1 which is incompatible.
    

以上步骤不能顺序颠倒,python start.py应该可以跑起来了


折腾过程:

  1. 这个项目使用了 Flask,而 spleeter 会安装最新的 werkzeug,与 Flask 2.x 不兼容(ImportError: cannot import name 'url_quote' from 'werkzeug.urls'
  2. 最新的 Flask 要求 click>=8.1.3,又导致 typer 和 click 冲突(ImportError: cannot import name 'get_terminal_size' from 'click.termui'
  3. 如果降级 click,需要同时降级 Flask,这样跟 werkzeug 又不兼容。综合考虑,还是将 typer 升级到 0.4.1

仅供参考,真的太折腾了

@jianchang512 jianchang512 added the help wanted Extra attention is needed label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants