pythonjsonpipmodelspleeter

ModuleNotFoundError: No module named 'json'


When I was running pip install spleeter,an error occurred. I can import json model in other spirits normally, but there is a wrong happend here. The detailed information is as follows:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting spleeter
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/10/0b/1ee10015ae2269c1cd1ae5439ae8d48d8680dd984638b4b787d1e4ce4e6b/spleeter-2.1.0-py3-none-any.whl (50 kB)
Collecting ffmpeg-python==0.2.0 (from spleeter)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/d7/0c/56be52741f75bad4dc6555991fabd2e07b432d333da82c11ad701123888a/ffmpeg_python-0.2.0-py3-none-any.whl (25 kB)
Collecting httpx<0.17.0,>=0.16.1 (from httpx[http2]<0.17.0,>=0.16.1->spleeter)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2d/c6/59aa4188e7eddb9e89ec67a51598ca6bfc09f1b38c9b45f7ee45af7a4df4/httpx-0.16.1-py3-none-any.whl (65 kB)
Collecting librosa==0.8.0 (from spleeter)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/26/4d/c22d8ca74ca2c13cd4ac430fa353954886104321877b65fa871939e78591/librosa-0.8.0.tar.gz (183 kB)
  Preparing metadata (setup.py) ... done
Collecting norbert==0.2.1 (from spleeter)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/22/85/1e4f09c84d28b5541a4a8eece320902c4d2fa264dfe51f779548396f0fea/norbert-0.2.1-py2.py3-none-any.whl (11 kB)
Collecting numpy<1.19.0,>=1.16.0 (from spleeter)
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/01/1b/d3ddcabd5817be02df0e6ee20d64f77ff6d0d97f83b77f65e98c8a651981/numpy-1.18.5.zip (5.4 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [4 lines of output]
      Traceback (most recent call last):
        File "D:\Python\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 15, in <module>
          import json
      ModuleNotFoundError: No module named 'json'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel 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.

My python version is 3.11.1 and pip version is 24.3.1.

I had retried for many times, but the error haven't disappeared. I'd like to run spleeter model on my computer noreamlly.


Solution

  • Just as @phd told you,
    Sometimes a library can't be installed on a version of Python due to it not being updated or there are hidden conflicts with other updated libraries.

    1. Try using a Virtual environment, then in this virtual environment install all that you need to run your program
      if this doesn't work
    2. try a higher (or lower) version of Python in a virtual environment too.

      you can install multiple versions of Python on your machine and use whichever one you like for your project.
      Edit: I made it more clarified.