spleeter icon indicating copy to clipboard operation
spleeter copied to clipboard

[Bug] Unable to succesfully run pip install spleeter

Open Emaan-Confinality opened this issue 1 year ago • 20 comments

  • [ ] I didn't find a similar issue already open.
  • [ ] I read the documentation (README AND Wiki)
  • [ ] I have installed FFMpeg
  • [ ] My problem is related to Spleeter only, not a derivative product (such as Webapplication, or GUI provided by others)

Description

I think the new update 4 days ago related to compatible versions has caused some issue because previously the same code was working fine and giving output however now it is showing me numpy version error.

Step to reproduce

  1. Running on colab.
  2. Installed using !pip install spleeter
  3. Got error: "Collecting spleeter Using cached spleeter-2.1.0-py3-none-any.whl.metadata (10 kB) Collecting ffmpeg-python==0.2.0 (from spleeter) Using cached ffmpeg_python-0.2.0-py3-none-any.whl.metadata (1.7 kB) Collecting httpx<0.17.0,>=0.16.1 (from httpx[http2]<0.17.0,>=0.16.1->spleeter) Using cached httpx-0.16.1-py3-none-any.whl.metadata (38 kB) Collecting librosa==0.8.0 (from spleeter) Using cached librosa-0.8.0.tar.gz (183 kB) Preparing metadata (setup.py) ... done Collecting norbert==0.2.1 (from spleeter) Using cached norbert-0.2.1-py2.py3-none-any.whl.metadata (3.8 kB) Collecting numpy<1.19.0,>=1.16.0 (from spleeter) Using cached numpy-1.18.5.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."

Output

previously this command would run perfectly fine and install spleeter.

Environment

OS Windows 11
Installation type pip
RAM available 12.7 GB
Hardware spec GPU / CPU both

Emaan-Confinality avatar Jan 28 '25 23:01 Emaan-Confinality

This is likely due to the fact that distutils has been depreciated since python3.10 and the collab is running python3.11.

JoseffRibble avatar Jan 30 '25 05:01 JoseffRibble

@Emaan-Confinality the follow is not a fix but a work around using pyenv to install and older copy of python on collab:

!git clone https://github.com/pyenv/pyenv.git ~/.pyenv
import os

# Set the root for pyenv
os.environ['PYENV_ROOT'] = os.path.expanduser("~/.pyenv")
# Prepend pyenv's bin folder to PATH
os.environ['PATH'] = os.environ['PYENV_ROOT'] + '/bin:' + os.environ['PATH']

# Confirm pyenv is callable
!pyenv --version
!apt-get install libffi-dev
!pyenv install 3.8.13
!pyenv global 3.8.13
!pyenv exec pip install spleeter
!pyenv exec spleeter

Once this is done you should be able to call spleeter as needed with !pyenv exec spleeter as it will run using python 3.8.13.

You can build with it as you want just your notebooks will always have to use !pyenv to call it as though its on the command line (you could also use a subprocess but magic is more fun)

opencoca avatar Feb 02 '25 11:02 opencoca

Hello.

Is there any way to fix this? Is it not possible to update outdated libraries?

Using old versions of Python or something similar doesn't seem like a good solution to me.

Thanks

cacaedu avatar Feb 05 '25 01:02 cacaedu

This is likely due to the fact that distutils has been depreciated since python3.10 and the collab is running python3.11.

Hello @JoseffRibble . It's not just with collab. It's also happening at the local installation.

cacaedu avatar Feb 05 '25 01:02 cacaedu

Unfortunately, until the devs update the code, using an older python version is the only solution I have. You can use something like pyenv to create a virtual environment with an older python version. This will allow you to run the code without having to modify your system's python version

JoseffRibble avatar Feb 05 '25 01:02 JoseffRibble

Yup, The PyEnv fix works everywhere. I even use it in my more esoteric docker builds where I need choose to combine the use of different python versions.

opencoca avatar Feb 05 '25 14:02 opencoca

I found a way to run it on colab. The main issue is that cloab now is using python3.11. It provide a method to allow you temporarily switch back to python3.10 though. you can try it in this official colab notebook.

Make sure the notebook is connected to google server.

tools - command palette - type "Use fallback runtime version"

This will reset the python version to be 3.10 and everything works now.

According to colab official repository, this fallback runtime feature "is available until early February"

HaoleiH avatar Feb 05 '25 20:02 HaoleiH

As it's it's early February I strongly recommend using my pyenv workaround.

https://github.com/deezer/spleeter/issues/927#issuecomment-2629364261

Using pyenv this way will allow you to have multiple versions of python on the colab and won't complicate things using a fallback that's about to be retired any day now.

opencoca avatar Feb 06 '25 13:02 opencoca

for some reason, it is working fine on google vertex AI's colab enterprise notebook. Python version is 3.10.12.

This is likely due to the fact that distutils has been depreciated since python3.10 and the collab is running python3.11.

Hello @JoseffRibble . It's not just with collab. It's also happening at the local installation.

Emaan-Confinality avatar Feb 06 '25 14:02 Emaan-Confinality

@Emaan-Confinality, well yes that would be the reason: Python 3.10 should work with with spleeter. As @HaoleiH Google's depreciating this on the non enterprise colab this month. They'll likely keep it around for londer on enterprise.

That being said and me sounding like a broken record... just use pyenv wherever you're working with this as it's got slightly esoteric requirements and that will allow you to sidestep them causing other complications.

opencoca avatar Feb 06 '25 15:02 opencoca

@Emaan-Confinality, well yes that would be the reason: Python 3.10 should work with with spleeter. As @HaoleiH Google's depreciating this on the non enterprise colab this month. They'll likely keep it around for londer on enterprise.

That being said and me sounding like a broken record... just use pyenv wherever you're working with this as it's got slightly esoteric requirements and that will allow you to sidestep them causing other complications.

Can you provide any directions for using this solution in a local installation? I already tried every python version back to 3.8 and can't manage to make this work in a macOS M1.

asapsmc avatar Mar 14 '25 12:03 asapsmc

After new upgrade of Mac OS (15.3.2) Python 3.8.x cannot be build because it fails with a 'too long filename' error during build it generates a very long temp file path. brew install [email protected] also fails due to the fact it is unsupported version So now I don't even know which version we need to go.

With 3.10.x or 3.11 pip3 install spleeter give a 'no c compiler error' even though I have gcc and clang installed.

$ pip3 install spleeter
...
Collecting numpy<1.19.0,>=1.16.0 (from spleeter)
  Using cached numpy-1.18.5.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
  ╰─> [25 lines of output]
      Running from numpy source directory.
      <string>:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      Traceback (most recent call last):
        File "/Users/richardjonas/projects/spleeter-work/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/richardjonas/projects/spleeter-work/.venv/lib/python3.11/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/richardjonas/projects/spleeter-work/.venv/lib/python3.11/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 "/private/var/folders/ht/0brx8__s06gfg0_07r6wljx80000gn/T/pip-build-env-cxiox6kq/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 377, in prepare_metadata_for_build_wheel
          self.run_setup()
        File "/private/var/folders/ht/0brx8__s06gfg0_07r6wljx80000gn/T/pip-build-env-cxiox6kq/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 522, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/private/var/folders/ht/0brx8__s06gfg0_07r6wljx80000gn/T/pip-build-env-cxiox6kq/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 320, in run_setup
          exec(code, locals())
        File "<string>", line 488, in <module>
        File "<string>", line 465, in setup_package
        File "/private/var/folders/ht/0brx8__s06gfg0_07r6wljx80000gn/T/pip-install-0y_rr0uq/numpy_2615cd4e65af4faebc7b85efa0f7e254/numpy/distutils/__init__.py", line 26, in <module>
          from . import ccompiler
        File "/private/var/folders/ht/0brx8__s06gfg0_07r6wljx80000gn/T/pip-install-0y_rr0uq/numpy_2615cd4e65af4faebc7b85efa0f7e254/numpy/distutils/ccompiler.py", line 111, in <module>
          replace_method(CCompiler, 'find_executables', CCompiler_find_executables)
                         ^^^^^^^^^
      NameError: name 'CCompiler' is not defined. Did you mean: 'ccompiler'?
      [end of output]

jonasrichard avatar Mar 14 '25 16:03 jonasrichard

Using recommended installation method pip install spleeter and get the same error:

File "C:\Users\Dmitry\AppData\Local\Temp\pip-install-juw3klzo\numpy_3c3d[whatever]231c\numpy\distutils\ccompiler.py", line 111, in <module>
          replace_method(CCompiler, 'find_executables', CCompiler_find_executables)
                         ^^^^^^^^^
      NameError: name 'CCompiler' is not defined. Did you mean: 'ccompiler'?
      [end of output]

python --version -> Python 3.12.9 🤷

whyboris avatar Mar 27 '25 05:03 whyboris

Use pyenv to switch to an older version of python (python 3.8 for example). https://github.com/pyenv/pyenv?tab=readme-ov-file#installation

JoseffRibble avatar Mar 27 '25 19:03 JoseffRibble

any eta on when spleeter will work for latest version of python?

officialasishkumar avatar Apr 18 '25 15:04 officialasishkumar

Meanwhile, the "Spleeter is compatible with Python 3.11" label on the Spleeter Github home page should probably be changed back to 3.10.

I'm having the same issue with Python 3.11 install.

I am not using colab. Just installing straight to Windows 11.

steadybright avatar Apr 19 '25 15:04 steadybright

@steadybright It is working on colab with python 3.11.12 now. Probably you can try that temporarily.

HaoleiH avatar Apr 19 '25 16:04 HaoleiH

Thanks @HaoleiH! I'll stay with 3.10 for now. Hopefully, 3.11(+) will be fixed soon.

steadybright avatar Apr 19 '25 23:04 steadybright

I am using al older version of conda:

use miniconda installation guide but with an older version: wget https://repo.anaconda.com/miniconda/Miniconda3-py310_25.1.1-1-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh

https://www.anaconda.com/docs/getting-started/miniconda/install#to-download-an-older-version

ImanHz avatar May 03 '25 09:05 ImanHz

using python 3.8 worked for me

FantinRaimbault avatar Jun 09 '25 18:06 FantinRaimbault