river icon indicating copy to clipboard operation
river copied to clipboard

ERROR: Failed building wheel for river

Open Mixto12 opened this issue 11 months ago • 11 comments

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

This error occurs when I installing river via pip. Can anyone knows how to resolve this issue?

Mixto12 avatar Mar 18 '24 22:03 Mixto12

Hey, Could you provide a minimal reproducible example, please? With your system information?

AdilZouitine avatar Mar 24 '24 20:03 AdilZouitine

I am encountering the same problem with macOS 14.4.1. Steps to reproduce: pip install river

marinasie avatar Apr 29 '24 13:04 marinasie

I'm sorry to hear that @marinasie. I'm on MacOS 14, Sonoma, and it's working. Could you share a traceback, including the error you obtained?

MaxHalford avatar Apr 30 '24 10:04 MaxHalford

Thanks for helping me out @MaxHalford ! This is my traceback when running pip install river:

Building wheels for collected packages: river
  Building wheel for river (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for river (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [116 lines of output]
      A setup.py file already exists. Using it.

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      # distutils: language = c++
      # distutils: extra_compile_args = "-std=c++11"

      import cython

      from .efficient_rollingrocauc cimport RollingROCAUC as CppRollingROCAUC
      ^
      ------------------------------------------------------------

      build/lib.linux-x86_64-cpython-312/river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx:6:0: relative cimport from non-package directory is not allowed

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      from .efficient_rollingrocauc cimport RollingROCAUC as CppRollingROCAUC

      cdef class EfficientRollingROCAUC:
          cdef cython.int positiveLabel
          cdef cython.ulong windowSize
          cdef CppRollingROCAUC* rollingrocauc
               ^
      ------------------------------------------------------------

      build/lib.linux-x86_64-cpython-312/river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx:11:9: 'CppRollingROCAUC' is not a type identifier

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef CppRollingROCAUC* rollingrocauc

          def __cinit__(self, cython.int positiveLabel, cython.ulong windowSize):
              self.positiveLabel = positiveLabel
              self.windowSize = windowSize
              self.rollingrocauc = new CppRollingROCAUC(positiveLabel, windowSize)
                                       ^
      ------------------------------------------------------------

      build/lib.linux-x86_64-cpython-312/river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx:16:33: 'CppRollingROCAUC' is not a type identifier

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
          cdef CppRollingROCAUC* rollingrocauc

          def __cinit__(self, cython.int positiveLabel, cython.ulong windowSize):
              self.positiveLabel = positiveLabel
              self.windowSize = windowSize
              self.rollingrocauc = new CppRollingROCAUC(positiveLabel, windowSize)
                                   ^
      ------------------------------------------------------------

      build/lib.linux-x86_64-cpython-312/river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx:16:29: new operator can only be applied to a C++ class

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              self.windowSize = windowSize
              self.rollingrocauc = new CppRollingROCAUC(positiveLabel, windowSize)

          def __dealloc__(self):
              if not self.rollingrocauc == NULL:
                  del self.rollingrocauc
                          ^
      ------------------------------------------------------------

      build/lib.linux-x86_64-cpython-312/river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx:20:20: Deletion of non-Python, non-C++ object
      Compiling build/lib.linux-x86_64-cpython-312/river/drift/adwin_c.pyx because it changed.
      Compiling build/lib.linux-x86_64-cpython-312/river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx because it depends on /private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/Cython/Includes/libcpp/vector.pxd.
      Compiling build/lib.linux-x86_64-cpython-312/river/metrics/expected_mutual_info.pyx because it changed.
      Compiling build/lib.linux-x86_64-cpython-312/river/utils/vectordict.pyx because it changed.
      Compiling river/drift/adwin_c.pyx because it changed.
      Compiling river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx because it depends on /private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/Cython/Includes/libcpp/vector.pxd.
      Compiling river/metrics/expected_mutual_info.pyx because it changed.
      Compiling river/utils/vectordict.pyx because it changed.
      [1/8] Cythonizing build/lib.linux-x86_64-cpython-312/river/drift/adwin_c.pyx
      [2/8] Cythonizing build/lib.linux-x86_64-cpython-312/river/metrics/expected_mutual_info.pyx
      [3/8] Cythonizing build/lib.linux-x86_64-cpython-312/river/utils/vectordict.pyx
      [4/8] Cythonizing river/drift/adwin_c.pyx
      [5/8] Cythonizing river/metrics/expected_mutual_info.pyx
      [6/8] Cythonizing river/utils/vectordict.pyx
      [7/8] Cythonizing build/lib.linux-x86_64-cpython-312/river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx
      Traceback (most recent call last):
        File "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-install-8jj_hf2x/river_5c1dc9f218384df098e06c22f57902ef/setup.py", line 82, in <module>
          from build import *
        File "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-install-8jj_hf2x/river_5c1dc9f218384df098e06c22f57902ef/build.py", line 22, in <module>
          ext_modules = cythonize(
        File "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize
          cythonize_one(*args)
        File "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1321, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: build/lib.linux-x86_64-cpython-312/river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx
      Traceback (most recent call last):
        File "/Users/user/miniconda3/envs/bird/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/user/miniconda3/envs/bird/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 "/Users/user/miniconda3/envs/bird/lib/python3.10/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 "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/poetry/core/masonry/api.py", line 58, in build_wheel
          return WheelBuilder.make_in(
        File "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 88, in make_in
          wb.build(target_dir=directory)
        File "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 121, in build
          self._build(zip_file)
        File "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 182, in _build
          self._run_build_command(setup)
        File "/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-build-env-w84ohfek/overlay/lib/python3.10/site-packages/poetry/core/masonry/builders/wheel.py", line 248, in _run_build_command
          subprocess.check_call([
        File "/Users/user/miniconda3/envs/bird/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/Users/user/miniconda3/envs/bird/bin/python3', '/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-install-8jj_hf2x/river_5c1dc9f218384df098e06c22f57902ef/setup.py', 'build', '-b', '/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-install-8jj_hf2x/river_5c1dc9f218384df098e06c22f57902ef/build', '--build-purelib', '/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-install-8jj_hf2x/river_5c1dc9f218384df098e06c22f57902ef/build/lib', '--build-platlib', '/private/var/folders/0b/nxx7zwbd6892znfk2t06h5n80000gn/T/pip-install-8jj_hf2x/river_5c1dc9f218384df098e06c22f57902ef/build/lib.macosx-10.9-x86_64-cpython-310']' returned non-zero exit status 1.
      [end of output]

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

marinasie avatar Apr 30 '24 12:04 marinasie

May I ask which Python version you're using?

MaxHalford avatar May 01 '24 15:05 MaxHalford

Python 3.10.11 🐍

marinasie avatar May 02 '24 10:05 marinasie

Ok super weird. Normally a pre-built wheel should be used, so you don't have to install from scratch. I asked because I see a cpython-312 in your traceback, making me think you're on Python 3.12... I'm not really sure how to help now 😅

MaxHalford avatar May 02 '24 13:05 MaxHalford

I think there is no pre-built wheel for MacOS 14 on an Intel CPU, so Pip builds it from scratch. I have no idea why Pip is using cpython3.12 instead of 3.9 in my case.

justinuliu avatar May 02 '24 23:05 justinuliu

I am getting the same error as @marinasie with Python 3.11 mac 14.3 when using pip install river. I was also running into issues installing the latest development version from github until I ran rustup target add x86_64-apple-darwin, I don't seem to be getting errors now but I haven't tried out River yet.

hannahleblanc avatar May 08 '24 18:05 hannahleblanc

Yes, thank you @hannahleblanc !

This installation procedure solved it for me:

rustup target add x86_64-apple-darwin
pip install git+ssh://[email protected]/online-ml/river.git --upgrade  # using SSH
pip install git+https://github.com/online-ml/river --upgrade  # or alternatively run with https

Worked with python 3.10.11 and macOS 14.4.1

Now river works like a charm. 🚀

marinasie avatar May 10 '24 08:05 marinasie

Hi all, same error on macOS 12.5.1 (on x86 arch), python 3.10 or 3.12 equally, that disappears when rolling back to river 0.19.0 however. The command rustup target add x86_64-apple-darwin does not do the trick for me for installing river >=0.20.0

adrian-valente avatar May 14 '24 22:05 adrian-valente