RVC-Project / RVC-Project/Retrieval-based-Voice-Conversion-WebUI

Docker build results in non-working container due to incompatible version of numpy (2.x instead of 1.x)

Open
#2,136 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
38.4k
Forks
5.3k
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce:
  1. git clone git@github.com:RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git
  2. cd Retrieval-based-Voice-Conversion-WebUI
  3. docker compose build
  4. docker compose up
Output
WARN[0000] /home/user/Documents/code/Retrieval-based-Voice-Conversion-WebUI/docker-compose.yml: `version` is obsolete 
[+] Running 1/0
 ✔ Container rvc  Created                                                                                                                                                       0.0s 
Attaching to rvc
rvc  | 
rvc  | ==========
rvc  | == CUDA ==
rvc  | ==========
rvc  | 
rvc  | CUDA Version 11.6.2
rvc  | 
rvc  | Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
rvc  | 
rvc  | This container image and its contents are governed by the NVIDIA Deep Learning Container License.
rvc  | By pulling and using the container, you accept the terms and conditions of this license:
rvc  | https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
rvc  | 
rvc  | A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
rvc  | 
rvc  | 
rvc  | A module that was compiled using NumPy 1.x cannot be run in
rvc  | NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
rvc  | versions of NumPy, modules must be compiled with NumPy 2.0.
rvc  | Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
rvc  | 
rvc  | If you are a user of the module, the easiest solution will be to
rvc  | downgrade to 'numpy<2' or try to upgrade the affected module.
rvc  | We expect that some modules will need time to support NumPy 2.
rvc  | 
rvc  | Traceback (most recent call last):  File "/app/infer-web.py", line 8, in <module>
rvc  |     from infer.modules.vc.modules import VC
rvc  |   File "/app/infer/modules/vc/modules.py", line 18, in <module>
rvc  |     from infer.modules.vc.pipeline import Pipeline
rvc  |   File "/app/infer/modules/vc/pipeline.py", line 11, in <module>
rvc  |     import faiss
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/__init__.py", line 16, in <module>
rvc  |     from .loader import *
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/loader.py", line 87, in <module>
rvc  |     from .swigfaiss_avx2 import *
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/swigfaiss_avx2.py", line 10, in <module>
rvc  |     from . import _swigfaiss_avx2
rvc  | AttributeError: _ARRAY_API not found
rvc  | 
rvc  | A module that was compiled using NumPy 1.x cannot be run in
rvc  | NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
rvc  | versions of NumPy, modules must be compiled with NumPy 2.0.
rvc  | Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
rvc  | 
rvc  | If you are a user of the module, the easiest solution will be to
rvc  | downgrade to 'numpy<2' or try to upgrade the affected module.
rvc  | We expect that some modules will need time to support NumPy 2.
rvc  | 
rvc  | Traceback (most recent call last):  File "/app/infer-web.py", line 8, in <module>
rvc  |     from infer.modules.vc.modules import VC
rvc  |   File "/app/infer/modules/vc/modules.py", line 18, in <module>
rvc  |     from infer.modules.vc.pipeline import Pipeline
rvc  |   File "/app/infer/modules/vc/pipeline.py", line 11, in <module>
rvc  |     import faiss
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/__init__.py", line 16, in <module>
rvc  |     from .loader import *
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/loader.py", line 98, in <module>
rvc  |     from .swigfaiss import *
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/swigfaiss.py", line 10, in <module>
rvc  |     from . import _swigfaiss
rvc  | AttributeError: _ARRAY_API not found
rvc  | Traceback (most recent call last):
rvc  |   File "/app/infer-web.py", line 8, in <module>
rvc  |     from infer.modules.vc.modules import VC
rvc  |   File "/app/infer/modules/vc/modules.py", line 18, in <module>
rvc  |     from infer.modules.vc.pipeline import Pipeline
rvc  |   File "/app/infer/modules/vc/pipeline.py", line 11, in <module>
rvc  |     import faiss
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/__init__.py", line 16, in <module>
rvc  |     from .loader import *
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/loader.py", line 98, in <module>
rvc  |     from .swigfaiss import *
rvc  |   File "/usr/local/lib/python3.9/dist-packages/faiss/swigfaiss.py", line 10, in <module>
rvc  |     from . import _swigfaiss
rvc  | ImportError: numpy.core.multiarray failed to import
rvc exited with code 1
Cause

As explained on numpy website, it is caused by using numpy 2.x when numpy 1.x is expected:

If you see a message such as:

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

Either as an ImportError or with:

AttributeError: _ARRAY_API not found

Then you are using NumPy 2 together with a module that was build with NumPy 1. NumPy 2 made some changes that require rebuilding such modules to avoid possibly incorrect results or crashes.

As the error message suggests, the easiest solution is likely to downgrade NumPy to numpy<2. Alternatively, you can search the traceback (from the back) to find the first line that isn’t inside NumPy to see which module needs to be updated.

NumPy 2 was released in the first half of 2024 and especially smaller modules downstream are expected need time to adapt and publish a new version.

Fix

In requirements.txt replace line
numpy
with
numpy==1.26.4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with requirements.txt and the Docker build path used by docker compose build. Confirm that the unpinned numpy dependency produces the reported faiss import failure, then verify the pinned dependency by rebuilding and starting the container with docker compose up. Done means the container starts without the _ARRAY_API or numpy.core.multiarray errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, numpy, python
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.