python-samplerate icon indicating copy to clipboard operation
python-samplerate copied to clipboard

Can't install sample rate in google colab

Open ajayarora1235 opened this issue 1 year ago • 4 comments

Version of python is 3.10.12.

!pip install samplerate --no-cache-dir returns

Collecting samplerate
  Downloading samplerate-0.2.1.tar.gz (21 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in /usr/local/lib/python3.10/dist-packages (from samplerate) (1.25.2)
Building wheels for collected packages: samplerate
  error: subprocess-exited-with-error
  
  × Building wheel for samplerate (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.
  Building wheel for samplerate (pyproject.toml) ... error
  ERROR: Failed building wheel for samplerate
Failed to build samplerate
ERROR: Could not build wheels for samplerate, which is required to install pyproject.toml-based projects

Can't get any of the errors to display, but it also fails for me on my mac locally. seemed to be an issue there with cmake and "from cmake import cmake".

ajayarora1235 avatar Feb 16 '24 17:02 ajayarora1235

Hi @ajayarora1235 , actually, I had the same issue on colab, and I think I know the cause. samplerate uses cmake to handle the compilation. Colab comes with the cmake python package (a wrapper around) cmake preinstalled, so that calling cmake calls this package instead of the real cmake. However, the python package build system creates an empty environment to build the package, and there, the cmake python is not available, however, it still calls the same cmake wrapper that depends on it. The solution is to add the cmake python wrapper as a build dependency of samplerate. I will try to do that quickly.

fakufaku avatar Feb 17 '24 07:02 fakufaku

I made a fix in PR #16 . You can try it by installing from the fix_cmake_dep branch. I have verified successful installation of the package on colab with the following command.

pip -q install git+https://github.com/tuxu/python-samplerate.git@fix_cmake_dep

fakufaku avatar Feb 17 '24 07:02 fakufaku

Thanks for this fix! I came across the same problem today and this fixed it for me

kieranabrennan avatar Feb 21 '24 23:02 kieranabrennan

same here, thanks for the fix.

Pbotsaris avatar May 08 '24 07:05 Pbotsaris