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

RuntimeError: Running cythonize failed! #24

Open
mm3509 opened this issue Feb 11, 2024 · 1 comment
Open

RuntimeError: Running cythonize failed! #24

mm3509 opened this issue Feb 11, 2024 · 1 comment

Comments

@mm3509
Copy link

mm3509 commented Feb 11, 2024

I am interested in vocal cloning from van der Oord et al and found this repo. I try to install on a Google Colab and get:

!pip install -r ZeroSpeech/requirements.txt

Collecting numpy==1.18.2 (from -r ZeroSpeech/requirements.txt (line 1))
  Using cached numpy-1.18.2.zip (5.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) 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.
  Preparing metadata (pyproject.toml) ... error
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.

I also start a virtual machine on the cloud, clone the repo, try to install, and get a similar error:

$ pip install -r requirements.txt 
Collecting numpy==1.18.2 (from -r requirements.txt (line 1))
  Using cached numpy-1.18.2.zip (5.4 MB)
  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
  ╰─> [63 lines of output]
      Running from numpy source directory.
      <string>:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      /tmp/pip-install-d1oosqgf/numpy_df17a3083fa845ed943b7f14bde0105d/tools/cythonize.py:75: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        required_version = LooseVersion('0.29.14')
      /tmp/pip-install-d1oosqgf/numpy_df17a3083fa845ed943b7f14bde0105d/tools/cythonize.py:77: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        if LooseVersion(cython_version) < required_version:
      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:
      ------------------------------------------------------------
      ...
          cdef sfc64_state rng_state
      
          def __init__(self, seed=None):
              BitGenerator.__init__(self, seed)
              self._bitgen.state = <void *>&self.rng_state
              self._bitgen.next_uint64 = &sfc64_uint64
                                         ^
      ------------------------------------------------------------
      
      _sfc64.pyx:90:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'uint64_t (void *) except? -1 nogil'.
      Processing numpy/random/_bounded_integers.pxd.in
      Processing numpy/random/_generator.pyx
      Processing numpy/random/_sfc64.pyx
      Traceback (most recent call last):
        File "/tmp/pip-install-d1oosqgf/numpy_df17a3083fa845ed943b7f14bde0105d/tools/cythonize.py", line 238, in <module>
          main()
        File "/tmp/pip-install-d1oosqgf/numpy_df17a3083fa845ed943b7f14bde0105d/tools/cythonize.py", line 234, in main
          find_process_files(root_dir)
        File "/tmp/pip-install-d1oosqgf/numpy_df17a3083fa845ed943b7f14bde0105d/tools/cythonize.py", line 225, in find_process_files
          process(root_dir, fromfile, tofile, function, hash_db)
        File "/tmp/pip-install-d1oosqgf/numpy_df17a3083fa845ed943b7f14bde0105d/tools/cythonize.py", line 191, in process
          processor_function(fromfile, tofile)
        File "/tmp/pip-install-d1oosqgf/numpy_df17a3083fa845ed943b7f14bde0105d/tools/cythonize.py", line 80, in process_pyx
          subprocess.check_call(
        File "/opt/conda/envs/bshall/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/opt/conda/envs/bshall/bin/python3.10', '-m', 'cython', '-3', '--fast-fail', '-o', '_sfc64.c', '_sfc64.pyx']' returned non-zero exit status 1.
      Cythonizing sources
      Traceback (most recent call last):
        File "/opt/conda/envs/bshall/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/conda/envs/bshall/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/conda/envs/bshall/lib/python3.10/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 "/tmp/pip-build-env-ux6kv4on/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/tmp/pip-build-env-ux6kv4on/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-ux6kv4on/overlay/lib/python3.10/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.

I found this issue with a similar issue on numpy 1.18.5, and they suggest --no-build-isolation, but I still get the error:

$ python -m pip install numpy==1.18.2 --no-build-isolation
Collecting numpy==1.18.2
  Using cached numpy-1.18.2.zip (5.4 MB)
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [63 lines of output]
      Running from numpy source directory.
      <string>:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      /tmp/pip-install-bhazifhj/numpy_638e295665ae4b3e88c648f1b94929e4/tools/cythonize.py:75: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        required_version = LooseVersion('0.29.14')
      /tmp/pip-install-bhazifhj/numpy_638e295665ae4b3e88c648f1b94929e4/tools/cythonize.py:77: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
        if LooseVersion(cython_version) < required_version:
      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:
      ------------------------------------------------------------
      ...
          cdef sfc64_state rng_state
      
          def __init__(self, seed=None):
              BitGenerator.__init__(self, seed)
              self._bitgen.state = <void *>&self.rng_state
              self._bitgen.next_uint64 = &sfc64_uint64
                                         ^
      ------------------------------------------------------------
      
      _sfc64.pyx:90:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to type 'uint64_t (void *) except? -1 nogil'.
      Processing numpy/random/_bounded_integers.pxd.in
      Processing numpy/random/_generator.pyx
      Processing numpy/random/_sfc64.pyx
      Traceback (most recent call last):
        File "/tmp/pip-install-bhazifhj/numpy_638e295665ae4b3e88c648f1b94929e4/tools/cythonize.py", line 238, in <module>
          main()
        File "/tmp/pip-install-bhazifhj/numpy_638e295665ae4b3e88c648f1b94929e4/tools/cythonize.py", line 234, in main
          find_process_files(root_dir)
        File "/tmp/pip-install-bhazifhj/numpy_638e295665ae4b3e88c648f1b94929e4/tools/cythonize.py", line 225, in find_process_files
          process(root_dir, fromfile, tofile, function, hash_db)
        File "/tmp/pip-install-bhazifhj/numpy_638e295665ae4b3e88c648f1b94929e4/tools/cythonize.py", line 191, in process
          processor_function(fromfile, tofile)
        File "/tmp/pip-install-bhazifhj/numpy_638e295665ae4b3e88c648f1b94929e4/tools/cythonize.py", line 80, in process_pyx
          subprocess.check_call(
        File "/opt/conda/envs/bshall/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/opt/conda/envs/bshall/bin/python', '-m', 'cython', '-3', '--fast-fail', '-o', '_sfc64.c', '_sfc64.pyx']' returned non-zero exit status 1.
      Cythonizing sources
      Traceback (most recent call last):
        File "/opt/conda/envs/bshall/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/conda/envs/bshall/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/opt/conda/envs/bshall/lib/python3.10/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 "/opt/conda/envs/bshall/lib/python3.10/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/opt/conda/envs/bshall/lib/python3.10/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/opt/conda/envs/bshall/lib/python3.10/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.

One possible problem is that I'm not sure that Nvidia/Apex is installed. So I follow this thread to install it on Colab. I get this error:

DEPRECATION: --build-option and --global-option are deprecated. pip 23.3 will enforce this behaviour change. A possible replacement is to use --config-settings. Discussion can be found at https://github.com/pypa/pip/issues/11859
WARNING: Implying --no-binary=:all: due to the presence of --build-option / --global-option. 
Processing /content/gdrive/MyDrive/apex
  Running command pip subprocess to install build dependencies
  Using pip 23.1.2 from /usr/local/lib/python3.10/dist-packages/pip (python 3.10)
  Collecting setuptools
    Using cached setuptools-69.0.3-py3-none-any.whl
  Collecting wheel
    Using cached wheel-0.42.0-py3-none-any.whl
  Installing collected packages: wheel, setuptools
    Creating /tmp/pip-build-env-f0jjytpy/overlay/local/bin
    changing mode of /tmp/pip-build-env-f0jjytpy/overlay/local/bin/wheel to 755
  ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
  ipython 7.34.0 requires jedi>=0.16, which is not installed.
  lida 0.0.10 requires fastapi, which is not installed.
  lida 0.0.10 requires kaleido, which is not installed.
  lida 0.0.10 requires python-multipart, which is not installed.
  lida 0.0.10 requires uvicorn, which is not installed.
  Successfully installed setuptools-69.0.3 wheel-0.42.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  Traceback (most recent call last):
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-f0jjytpy/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
    File "/tmp/pip-build-env-f0jjytpy/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-f0jjytpy/overlay/local/lib/python3.10/dist-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 5, in <module>
  ModuleNotFoundError: No module named 'packaging'
  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.
  full command: /usr/bin/python3 /usr/local/lib/python3.10/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py get_requires_for_build_wheel /tmp/tmpp0zh_uyr
  cwd: /content/gdrive/MyDrive/apex
  Getting requirements to build wheel ... error
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.

I install packaging with !pip install packaging but I get the same error.

How can I install the numpy requirements for running this project?

@yanshui177
Copy link

Same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants