online-ml/river

Encountering error when installing river using pip on macOS M1

Opened this issue · 3 comments

Versions

river version: 0.21.0
Python version: 3.9.13
Operating system: macOS 12.6.3 [M1 Pro]

Describe the bug

I couldn't install river on my local machine using pip. However, I was able to install it from the conda-forge channel using the command conda install river. But the channel doesn't have the latest version.

Here's the part of the installation log:

(base) kajanan@kajanans-MBP ~ % pip install river
Collecting river
  Using cached river-0.21.0.tar.gz (796 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy<2.0.0,>=1.23.0 in /opt/anaconda3/lib/python3.9/site-packages (from river) (1.25.2)
...........................................
...........................................
Requirement already satisfied: six>=1.5 in /opt/anaconda3/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas<3.0,>=2.1->river) (1.16.0)
Using cached pandas-2.2.1-cp39-cp39-macosx_10_9_x86_64.whl (12.6 MB)
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
  ╰─> [1223 lines of output]
      A setup.py file already exists. Using it.
      Compiling river/drift/adwin_c.pyx because it changed.
      Compiling river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx because it changed.
      Compiling river/metrics/expected_mutual_info.pyx because it changed.
      Compiling river/utils/vectordict.pyx because it changed.
      [1/4] Cythonizing river/drift/adwin_c.pyx
      [2/4] Cythonizing river/metrics/efficient_rollingrocauc/efficient_rollingrocauc.pyx
      [3/4] Cythonizing river/metrics/expected_mutual_info.pyx
      [4/4] Cythonizing river/utils/vectordict.pyx
      running build
      running build_py
      creating /private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build
      creating /private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build/lib.macosx-10.9-x86_64-cpython-39
      creating /private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build/lib.macosx-10.9-x86_64-cpython-39/river
      copying river/test_estimators.py -> /private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build/lib.macosx-10.9-x86_64-cpython-39/river
...........................................
...........................................
      29 warnings generated.
      clang -bundle -undefined dynamic_lookup -Wl,-rpath,/opt/anaconda3/lib -L/opt/anaconda3/lib -L/opt/anaconda3/lib -Wl,-rpath,/opt/anaconda3/lib -L/opt/anaconda3/lib /private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build/temp.macosx-10.9-x86_64-cpython-39/river/utils/vectordict.o -lm -o /private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build/lib.macosx-10.9-x86_64-cpython-39/river/utils/vectordict.cpython-39-darwin.so
      running build_rust
      error: can't find manifest for Rust extension `river.stats._rust_stats` at path `Cargo.toml`
      Traceback (most recent call last):
        File "/opt/anaconda3/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/anaconda3/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 "/opt/anaconda3/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 "/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-build-env-s2qpcjc_/overlay/lib/python3.9/site-packages/poetry/core/masonry/api.py", line 58, in build_wheel
          return WheelBuilder.make_in(
        File "/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-build-env-s2qpcjc_/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 88, in make_in
          wb.build(target_dir=directory)
        File "/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-build-env-s2qpcjc_/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 121, in build
          self._build(zip_file)
        File "/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-build-env-s2qpcjc_/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 182, in _build
          self._run_build_command(setup)
        File "/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-build-env-s2qpcjc_/overlay/lib/python3.9/site-packages/poetry/core/masonry/builders/wheel.py", line 248, in _run_build_command
          subprocess.check_call([
        File "/opt/anaconda3/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/opt/anaconda3/bin/python3.9', '/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/setup.py', 'build', '-b', '/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build', '--build-purelib', '/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build/lib', '--build-platlib', '/private/var/folders/t3/klqfnc0s5db94nn9pp57_rsw0000gn/T/pip-install-mers9x9k/river_1a4d0bf28e244f5e9d4117aa8444affd/build/lib.macosx-10.9-x86_64-cpython-39']' 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

Steps/code to reproduce

pip install river

It's weird because it's trying to install for MacOS 10_9. Do you confirm you're on MacOS 12.x?

@kajanan1212 I am on the same OS (MacOS Monterey) and an M1 Pro chip, and was able to install River without any problems. It seems like there are some problems with Rust and/or Cython on your local machine. Would you mind checking that the two has been installed properly as per the guide in our CONTRIBUTING markdown file?