spleeter icon indicating copy to clipboard operation
spleeter copied to clipboard

[Feature] tell people how to run from git

Open ensonic opened this issue 1 year ago • 4 comments

Description

Whike f3rr0-C47 tells you how to build from git it does not tell you how to run it. I am not here to learn yet another build system in depth and after glancing the poetry docs and trying e.g.

> poetry shell
The currently activated Python version 3.12.3 is not supported by the project (>=3.7.1,<3.11).
Trying to find and use a compatible version. 
Using python3.8 (3.8.19)
Spawning shell within /home/ensonic/.cache/pypoetry/virtualenvs/spleeter-_aolmB5c-py3.8
./spleeterenv/bin/spleeter --help
Traceback (most recent call last):
  File "/usr/lib64/python3.11/importlib/metadata/__init__.py", line 563, in from_name
    return next(cls.discover(name=name))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ensonic/projects/audio/spleeter/./spleeterenv/bin/spleeter", line 33, in <module>
    sys.exit(load_entry_point('spleeter==2.0.2', 'console_scripts', 'spleeter')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ensonic/projects/audio/spleeter/./spleeterenv/bin/spleeter", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
                       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/metadata/__init__.py", line 982, in distribution
    return Distribution.from_name(distribution_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/metadata/__init__.py", line 565, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: No package metadata was found for spleeter

The binary install options don't work either. These days distros want you to use pipx, but that fails.

 pipx install spleeter
Fatal error from pip prevented installation. Full pip output in file:
    /home/ensonic/.local/pipx/logs/cmd_2024-08-04_13.56.45_pip_errors.log

pip seemed to fail to build package:
    numpy<1.19.0,>=1.16.0

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    subprocess.CalledProcessError: Command '['/home/ensonic/.local/pipx/venvs/spleeter/bin/python', '-m', 'cython', '-3', '--fast-fail', '-o', '_mt19937.c', '_mt19937.pyx']' returned non-zero exit status 1.
    RuntimeError: Running cythonize failed!
    error: metadata-generation-failed

Error installing spleeter.

ensonic avatar Aug 04 '24 12:08 ensonic

Now that I posted it I've found the answer, e.g.

poetry run spleeter separate --help

ensonic avatar Aug 04 '24 12:08 ensonic

The install appears to have broken on macOS as well, particularly with Apple Silicon chips. Trying to get Spleeter running per this guide seems to result in missing dependencies:

PackagesNotFoundError: The following packages are not available from current channels:

  - tensorflow=1.14.0*
  - python=3.7*
  - pandas==0.25.1

I managed to fix it after tediously looking up newer versions of these dependencies:

#Version numbers will change as new versions are released.
#Pandas+Python+Tensorflow versions found here: https://repo.anaconda.com/pkgs/main/osx-arm64/

name: spleeter-cpu

channels:
  - conda-forge
  - anaconda

dependencies:
  - python=3.9
  - tensorflow=2.12.0
  - ffmpeg
  - pandas==2.2.2
  - requests
  - pip
  - pip:
    - museval==0.3.0
    - musdb==0.3.1
    - norbert==0.2.1
    - spleeter

yllekz avatar Aug 08 '24 14:08 yllekz

poetry run spleeter separate --help

It used to be working but now it simply fails with this output:

The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead.

'format'

Actually poetry run pytest tests/ works fine.

Raviu56 avatar Mar 19 '25 20:03 Raviu56

Here is debug output poetry run -vvv spleeter :

The "poetry.dev-dependencies" section is deprecated and will be removed in a future version. Use "poetry.group.dev.dependencies" instead.
Loading configuration file /home/user/.config/pypoetry/config.toml
Disabling source caches
Trying to detect current active python executable as specified in the config.
Unable to detect the current active python executable. Falling back to default.
Using virtualenv: /home/user/pypoetry/virtualenvs/spleeter-674V1wss-py3.11

  Stack trace:

  10  /usr/lib/python3.11/site-packages/cleo/application.py:327 in run
       325│ 
       326│             try:
     → 327│                 exit_code = self._run(io)
       328│             except BrokenPipeError:
       329│                 # If we are piped to another process, it may close early and send a

   9  /usr/lib/python3.11/site-packages/poetry/console/application.py:236 in _run
       234│ 
       235│         with directory(self._working_directory):
     → 236│             exit_code: int = super()._run(io)
       237│ 
       238│         return exit_code

   8  /usr/lib/python3.11/site-packages/cleo/application.py:431 in _run
       429│             io.input.interactive(interactive)
       430│ 
     → 431│         exit_code = self._run_command(command, io)
       432│         self._running_command = None
       433│ 

   7  /usr/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
       471│ 
       472│         if error is not None:
     → 473│             raise error
       474│ 
       475│         return terminate_event.exit_code

   6  /usr/lib/python3.11/site-packages/cleo/application.py:457 in _run_command
       455│ 
       456│             if command_event.command_should_run():
     → 457│                 exit_code = command.run(io)
       458│             else:
       459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

   5  /usr/lib/python3.11/site-packages/cleo/commands/base_command.py:117 in run
       115│         io.input.validate()
       116│ 
     → 117│         return self.execute(io) or 0
       118│ 
       119│     def merge_application_definition(self, merge_args: bool = True) -> None:

   4  /usr/lib/python3.11/site-packages/cleo/commands/command.py:61 in execute
        59│ 
        60│         try:
     →  61│             return self.handle()
        62│         except KeyboardInterrupt:
        63│             return 1

   3  /usr/lib/python3.11/site-packages/poetry/console/commands/run.py:31 in handle
        29│ 
        30│         if scripts and script in scripts:
     →  31│             return self.run_script(scripts[script], args)
        32│ 
        33│         try:

   2  /usr/lib/python3.11/site-packages/poetry/console/commands/run.py:77 in run_script
        75│         module, callable_ = script.split(":")
        76│ 
     →  77│         src_in_sys_path = "sys.path.append('src'); " if self._module.is_in_src() else ""
        78│ 
        79│         cmd = ["python", "-c"]

   1  /usr/lib/python3.11/site-packages/poetry/console/commands/run.py:46 in _module
        44│         package = poetry.package
        45│         path = poetry.file.path.parent
     →  46│         module = Module(package.name, path.as_posix(), package.packages)
        47│ 
        48│         return module

  KeyError

  'format'

  at /usr/lib/python3.11/site-packages/poetry/core/masonry/utils/module.py:79 in __init__
       75│             self._package_includes.append(
       76│                 PackageInclude(
       77│                     self._path,
       78│                     package["include"],
    →  79│                     formats=package["format"],
       80│                     source=package.get("from"),
       81│                     target=package.get("to"),
       82│                 )
       83│             )

Raviu56 avatar Mar 19 '25 20:03 Raviu56