spleeter icon indicating copy to clipboard operation
spleeter copied to clipboard

[Discussion] Using Spleeter under Ubuntu 22.04 LTS

Open zoomosis opened this issue 3 years ago • 3 comments

Spleeter (or a Python module it uses) appears to be incompatible with Python 3.10, however Python 3.10 is the default Python version in the recently-released Ubuntu 22.04.

It is possible to install Python 3.9 from the Ubuntu 22.04 repos using apt, but evidently virtualenv support is broken due to missing distutils module.

However we can build Python 3.9 manually from source and install it to $HOME/opt/python-3.9/:

sudo apt install build-essential libssl-dev
cd $HOME/src
wget https://www.python.org/ftp/python/3.9.12/Python-3.9.12.tar.xz
tar xf Python-3.9.12.tar.xz
cd Python-3.9.12
sh configure --prefix=$HOME/opt/python-3.9
make -j8
make install

Now install Spleeter in a Python 3.9 virtualenv:

cd $HOME
sudo apt install python3-pip 
pip3 install --user virtualenv
virtualenv -p $HOME/opt/python-3.9/bin/python3 spleeter
source $HOME/spleeter/bin/activate
pip3 install --upgrade setuptools
pip3 install spleeter

Finally run Spleeter:

spleeter separate --verbose audio.mp3 -p spleeter:5stems-16kHz -o output

Note you'll need to use the "source" command each time you want to run Spleeter from a new terminal. This configures the correct environment to set up Python 3.9 for Spleeter, ie.

source $HOME/spleeter/bin/activate
spleeter separate --verbose audio.mp3 -p spleeter:5stems-16kHz -o output

All of the above has been tested on x86_64. I can't vouch for it working on arm64.

Have fun!

zoomosis avatar Apr 25 '22 09:04 zoomosis

Hi @zoomosis, thanks for the help. Note that it should be quite straightforward to build spleeter from sources adding support to python 3.10. We'll have a look at it soon in order to provide this support.

romi1502 avatar Apr 29 '22 10:04 romi1502

Thanks @romi1502 :)

zoomosis avatar Apr 30 '22 11:04 zoomosis

After issueing python3 -m pip install spleeter --user on PopOS 22.04 which runs python 3.10.4 we receive the following ERROR messages, so we fail to install spleeter:

ERROR: Ignored the following versions that require a different python version: 1.4.1 Requires-Python >=3.6, <3.8; 1.4.3 Requires-Python >=3.6, <3.8; 1.4.4 Requires-Python >=3.6, <3.8; 1.4.5 Requires-Python >=3.6, <3.8; 1.4.6 Requires-Python >=3.6, <3.8; 1.4.7 Requires-Python >=3.6, <3.8; 1.4.8 Requires-Python >=3.6, <3.8; 1.4.9 Requires-Python >=3.6, <3.8; 1.5.0 Requires-Python >=3.6, <3.8; 1.5.1 Requires-Python >=3.6, <3.8; 1.5.2 Requires-Python >=3.6, <3.8; 1.5.3 Requires-Python >=3.6, <3.8; 1.5.4 Requires-Python >=3.6, <3.8; 2.0 Requires-Python >=3.6, <3.9; 2.0.1 Requires-Python >=3.6, <3.9; 2.0.2 Requires-Python >=3.6, <3.9; 2.1.1 Requires-Python >=3.6.1,<3.9; 2.1.2 Requires-Python >=3.6.1,<3.9; 2.2.0 Requires-Python >=3.6.1,<3.9; 2.2.1 Requires-Python >=3.6.1,<3.9; 2.2.2 Requires-Python >=3.6.1,<3.9; 2.3.0 Requires-Python >=3.6.1,<3.10; 2.3.1 Requires-Python >=3.6.2,<3.10
ERROR: Could not find a version that satisfies the requirement tensorflow==2.3.0 (from spleeter) (from versions: 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1)
ERROR: No matching distribution found for tensorflow==2.3.0

johnblommers avatar Jul 29 '22 00:07 johnblommers

After issueing python3 -m pip install spleeter --user on PopOS 22.04 which runs python 3.10.4 we receive the following ERROR messages, so we fail to install spleeter:

ERROR: Ignored the following versions that require a different python version: 1.4.1 Requires-Python >=3.6, <3.8; 1.4.3 Requires-Python >=3.6, <3.8; 1.4.4 Requires-Python >=3.6, <3.8; 1.4.5 Requires-Python >=3.6, <3.8; 1.4.6 Requires-Python >=3.6, <3.8; 1.4.7 Requires-Python >=3.6, <3.8; 1.4.8 Requires-Python >=3.6, <3.8; 1.4.9 Requires-Python >=3.6, <3.8; 1.5.0 Requires-Python >=3.6, <3.8; 1.5.1 Requires-Python >=3.6, <3.8; 1.5.2 Requires-Python >=3.6, <3.8; 1.5.3 Requires-Python >=3.6, <3.8; 1.5.4 Requires-Python >=3.6, <3.8; 2.0 Requires-Python >=3.6, <3.9; 2.0.1 Requires-Python >=3.6, <3.9; 2.0.2 Requires-Python >=3.6, <3.9; 2.1.1 Requires-Python >=3.6.1,<3.9; 2.1.2 Requires-Python >=3.6.1,<3.9; 2.2.0 Requires-Python >=3.6.1,<3.9; 2.2.1 Requires-Python >=3.6.1,<3.9; 2.2.2 Requires-Python >=3.6.1,<3.9; 2.3.0 Requires-Python >=3.6.1,<3.10; 2.3.1 Requires-Python >=3.6.2,<3.10
ERROR: Could not find a version that satisfies the requirement tensorflow==2.3.0 (from spleeter) (from versions: 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1)
ERROR: No matching distribution found for tensorflow==2.3.0

https://github.com/deezer/spleeter/wiki/5.-FAQ#python-39 Downgrade your python to 3.8

adamwelsh avatar Aug 25 '22 19:08 adamwelsh

Missing distutils is also affecting Debian unstable for me. Temporary workaround is https://stackoverflow.com/a/62992463 Basically copy files from /usr/lib/python3.10/distutils/ to /usr/lib/python3.9/distutils/ and use python3.9

Zipdox avatar Aug 26 '22 23:08 Zipdox

We've made some dependency changes in the 2.3.2 version that should make it straightforwardly compatible with latest Ubuntu

mmoussallam avatar Sep 07 '22 11:09 mmoussallam