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

Errors building installing 0.2.0 via pip install #95

Closed
mack42 opened this issue Jul 18, 2023 · 6 comments · Fixed by #98
Closed

Errors building installing 0.2.0 via pip install #95

mack42 opened this issue Jul 18, 2023 · 6 comments · Fixed by #98

Comments

@mack42
Copy link

mack42 commented Jul 18, 2023

As of recently (the past week or so ) I started getting build errors when trying to install the latest 0.2.0 of pysptk on ubuntu 22.04.
Error:

`
pip install git+https://github.com/r9y9/pysptk
Collecting git+https://github.com/r9y9/pysptk
Cloning https://github.com/r9y9/pysptk to /tmp/pip-req-build-lk5w0i69
Running command git clone --filter=blob:none --quiet https://github.com/r9y9/pysptk /tmp/pip-req-build-lk5w0i69
Resolved https://github.com/r9y9/pysptk to commit 968bf76
Running command git submodule update --init --recursive -q
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: scipy in ./anaconda3/envs/vfo_v1/lib/python3.9/site-packages (from pysptk==0.2.0+968bf76) (1.11.1)
Requirement already satisfied: decorator in ./anaconda3/envs/vfo_v1/lib/python3.9/site-packages (from pysptk==0.2.0+968bf76) (5.1.1)
Requirement already satisfied: cython>=0.28.0 in ./anaconda3/envs/vfo_v1/lib/python3.9/site-packages (from pysptk==0.2.0+968bf76) (3.0.0)
Requirement already satisfied: numpy<1.28.0,>=1.21.6 in ./anaconda3/envs/vfo_v1/lib/python3.9/site-packages (from scipy->pysptk==0.2.0+968bf76) (1.24.4)
Building wheels for collected packages: pysptk
Building wheel for pysptk (pyproject.toml) ... error
error: subprocess-exited-with-error

× Building wheel for pysptk (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [93 lines of output]
:58: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
running bdist_wheel
running build
running build_py
-- Building version 0.2.0+968bf76
creating build
creating build/lib.linux-x86_64-cpython-39
creating build/lib.linux-x86_64-cpython-39/pysptk
copying pysptk/sptk.py -> build/lib.linux-x86_64-cpython-39/pysptk
copying pysptk/conversion.py -> build/lib.linux-x86_64-cpython-39/pysptk
copying pysptk/util.py -> build/lib.linux-x86_64-cpython-39/pysptk
copying pysptk/version.py -> build/lib.linux-x86_64-cpython-39/pysptk
copying pysptk/synthesis.py -> build/lib.linux-x86_64-cpython-39/pysptk
copying pysptk/init.py -> build/lib.linux-x86_64-cpython-39/pysptk
creating build/lib.linux-x86_64-cpython-39/pysptk/example_audio_data
copying pysptk/example_audio_data/COPYING -> build/lib.linux-x86_64-cpython-39/pysptk/example_audio_data
copying pysptk/example_audio_data/arctic_a0007.wav -> build/lib.linux-x86_64-cpython-39/pysptk/example_audio_data
running build_ext
/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /tmp/pip-req-build-lk5w0i69/pysptk/_sptk.pxd
tree = Parsing.p_module(s, pxd, full_module_name)

  Error compiling Cython file:
  ------------------------------------------------------------
  ...

  import numpy as np
  cimport numpy as np

  cimport cython
  cimport _sptk
          ^
  ------------------------------------------------------------

  pysptk/_sptk.pyx:8:8: '_sptk.pxd' not found
  Compiling pysptk/_sptk.pyx because it changed.
  [1/1] Cythonizing pysptk/_sptk.pyx
  Traceback (most recent call last):
    File "/home/ubuntu/anaconda3/envs/vfo_v1/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/ubuntu/anaconda3/envs/vfo_v1/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/ubuntu/anaconda3/envs/vfo_v1/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 416, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
      self.run_setup()
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 487, in run_setup
      super(_BuildMetaLegacyBackend,
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
      exec(code, locals())
    File "<string>", line 136, in <module>
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 107, in setup
      return distutils.core.setup(**attrs)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1234, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 343, in run
      self.run_command("build")
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1234, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 131, in run
      self.run_command(cmd_name)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1234, in run_command
      super().run_command(command)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
      self.build_extensions()
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
      self._build_extensions_serial()
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
      self.build_extension(ext)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/Cython/Distutils/build_ext.py", line 122, in build_extension
      new_ext = cythonize(
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1134, in cythonize
      cythonize_one(*args)
    File "/tmp/pip-build-env-88ayx65x/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1301, in cythonize_one
      raise CompileError(None, pyx_file)
  Cython.Compiler.Errors.CompileError: pysptk/_sptk.pyx
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pysptk
Failed to build pysptk
ERROR: Could not build wheels for pysptk, which is required to install pyproject.toml-based projects

`

pip list

`
pip list
Package Version


appdirs 1.4.4
Assimulo 3.4.1
audioread 3.0.0
boto3 1.28.4
botocore 1.31.4
Brotli 1.0.9
certifi 2023.5.7
cffi 1.15.1
charset-normalizer 3.2.0
conda-pack 0.7.0
contourpy 1.1.0
cupy-cuda110 12.1.0
cycler 0.11.0
Cython 3.0.0
decorator 5.1.1
fastrlock 0.8.1
filelock 3.9.0
fonttools 4.41.0
gmpy2 2.1.2
idna 3.4
importlib-resources 6.0.0
Jinja2 3.1.2
jmespath 1.0.1
joblib 1.3.0
kiwisolver 1.4.4
lazy_loader 0.2
librosa 0.10.0
llvmlite 0.40.1
MarkupSafe 2.1.1
matplotlib 3.7.1
mpmath 1.2.1
msgpack 1.0.5
munkres 1.1.4
networkx 2.8.4
noisereduce 2.0.1
numba 0.57.1
numpy 1.24.4
packaging 23.1
pandas 2.0.3
Pillow 9.4.0
pip 23.2
pooch 1.6.0
progressbar 2.5
pycparser 2.21
pynvrtc 9.2
pyparsing 3.1.0
PySocks 1.7.1
python-dateutil 2.8.2
pytz 2023.3
requests 2.31.0
s3transfer 0.6.1
scikit-learn 1.3.0
scipy 1.11.1
setuptools 68.0.0
six 1.16.0
soundfile 0.12.1
soxr 0.3.5
sympy 1.11.1
threadpoolctl 3.2.0
torch 2.0.1
torchvision 0.15.2
tqdm 4.65.0
typing_extensions 4.6.3
tzdata 2023.3
unicodedata2 15.0.0
urllib3 1.26.16
wheel 0.40.0
zipp 3.16.2

`

I tried it with Python 3.8 as well and got the same error.

@maratsubkhankulov
Copy link
Contributor

Looks like the problem is the recent Cython release. You can work around the issue by:

  1. downgrading/restricting Cython cython version below 3.0.0
  2. `pip install --upgrade Cython==0.29.35
  3. using --no-build-isolation flag
  4. pip install pysptk --no-build-isolation

The issue is also discussed here: JeremyCCHsu/Python-Wrapper-for-World-Vocoder#87

@mack42
Copy link
Author

mack42 commented Jul 19, 2023

I had a feeling it was Cython, but wasn't aware of the --no-build-isolation flag. This workaround worked perfect for me. Thanks for the quick response!

@r9y9
Copy link
Owner

r9y9 commented Jul 20, 2023

@JeremyCCHsu
Copy link

I found that if Line 8 in pysptk/_sptk.pyx changes to from pysptk cimport _sptk, pip install . will work for Cython 3.0.0 and 0.29.36. (the upper limit for cython version in pyproject.toml will thus be unnecessary.)

@r9y9
Copy link
Owner

r9y9 commented Jul 22, 2023

Thanks! Looks like Cython 3.0.0 changed the default syntax semantics from Python 2.7 to Python 3. Relative import may need update due to the change

https://cython.readthedocs.io/en/latest/src/userguide/migrating_to_cy30.html#python-3-syntax-semantics

Cython 3.0 now uses Python 3 syntax and semantics by default, which previously required setting the language_level directive to either 3 or 3str. The new default setting is now language_level=3str, which means Python 3 semantics, but unprefixed strings are str objects, i.e. unicode text strings under Python 3 and byte strings under Python 2.7.

r9y9/pyopenjtalk#58 (comment)

I'll make a fix to support Cython 3.0.0. when I have some time.

@abhattachary
Copy link

abhattachary commented Jul 27, 2023

Hi, @maratsubkhankulov I faced the same issue and applied the workaround suggested. But I got a different error:

Collecting Cython==0.29.35
Downloading Cython-0.29.35-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (2.0 MB)
Installing collected packages: Cython
Successfully installed Cython-0.29.35
Collecting pysptk
Downloading pysptk-0.2.1.tar.gz (419 kB)
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /tmp/tmpiyfm_as1 prepare_metadata_for_build_wheel /tmp/tmp1juni2tc
cwd: /tmp/pip-install-jf81jbry/pysptk
Complete output (51 lines):
running dist_info
creating /tmp/pip-modern-metadata-6emjiydx/pysptk.egg-info
writing /tmp/pip-modern-metadata-6emjiydx/pysptk.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-modern-metadata-6emjiydx/pysptk.egg-info/dependency_links.txt
writing requirements to /tmp/pip-modern-metadata-6emjiydx/pysptk.egg-info/requires.txt
writing top-level names to /tmp/pip-modern-metadata-6emjiydx/pysptk.egg-info/top_level.txt
writing manifest file '/tmp/pip-modern-metadata-6emjiydx/pysptk.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "/tmp/tmpiyfm_as1", line 280, in
main()
File "/tmp/tmpiyfm_as1", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/tmp/tmpiyfm_as1", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 158, in prepare_metadata_for_build_wheel
self.run_setup()
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 249, in run_setup
super(_BuildMetaLegacyBackend,
File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 143, in run_setup
exec(compile(code, file, 'exec'), locals())
File "setup.py", line 136, in
setup(
File "/usr/lib/python3/dist-packages/setuptools/init.py", line 144, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/lib/python3/dist-packages/setuptools/command/dist_info.py", line 31, in run
egg_info.run()
File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 297, in run
self.find_sources()
File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 304, in find_sources
mm.run()
File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 535, in run
self.add_defaults()
File "/usr/lib/python3/dist-packages/setuptools/command/egg_info.py", line 571, in add_defaults
sdist.add_defaults(self)
File "/usr/lib/python3.8/distutils/command/sdist.py", line 228, in add_defaults
self._add_defaults_ext()
File "/usr/lib/python3.8/distutils/command/sdist.py", line 311, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/usr/lib/python3.8/distutils/cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/lib/python3.8/distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "setup.py", line 77, in finalize_options
builtins.NUMPY_SETUP = False
AttributeError: 'dict' object has no attribute 'NUMPY_SETUP'
----------------------------------------

Any help on this?

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

Successfully merging a pull request may close this issue.

5 participants