The error you're encountering happens during the installation of numpy 1.18.5 from source because the build system hits a NameError inside numpy's internal distutils script. This usually happens due to incompatibilities between old package versions and modern versions of build tools, setuptools, pip, or Python itself.
Why this happens:
- You are trying to install numpy 1.18.5, which is quite old and may not support your Python version well.
- Building numpy from source requires C compilers and proper build environment (which you might already have, but still the old numpy version has problems).
- Newer pip/setuptools/packaging tools became stricter and sometimes break older packages' install scripts.
- Numpy 1.18.5 predates widespread adoption of
pyproject.toml PEP 517/518 builds, so that might confuse modern installers.
- Also, installing old versions can be challenging on Windows and Python >=3.8 or 3.9.
Solutions:
A) Use a more recent numpy version compatible with your other packages
- Check if your project really requires numpy 1.18.5. That old numpy is from early 2020.
- If possible, edit your
requirements.txt and raise numpy version to at least 1.19.x or 1.20+ or latest (depending on your Python version).
Example: Change line
numpy==1.18.5
to
numpy>=1.20.3
or even
numpy
and try installing again.
If other packages require strict numpy version, you may have to do some upgrades or modify code accordingly.
B) Install numpy via wheels (prebuilt binaries) manually first
Try installing numpy directly before pip install -r requirements.txt:
pip install numpy==1.18.5 --only-binary=:all:
This forces pip to use prebuilt wheels and not build from source.
If that version wheel for your Python/OS is not available, it will fail.
Try without the version restriction:
pip install numpy --only-binary=:all:
Once numpy is installed, run
pip install -r requirements.txt --no-deps
to avoid reinstalling numpy and other dependencies (one by one).
C) Upgrade pip, setuptools, wheel packages
Old pip/setuptools can cause build errors.
Run:
pip install --upgrade pip setuptools wheel
Then try again:
pip install -r requirements.txt
Sometimes just upgrading tooling fixes the problem.
D) Use a matching Python version for old numpy
- numpy 1.18.5 was released around mid-2020, tested mostly on Python 3.6, 3.7.
- If you have Python 3.8 or 3.9, old numpy wheels may not be available.
- Consider creating a virtual environment with Python 3.7 if you can install that and set it up with your VITS code.
What I recommend you do right now:
- Upgrade your pip, setuptools, wheel:
pip install --upgrade pip setuptools wheel
- Manually install the latest numpy wheel first:
pip install numpy --only-binary=:all:
or if you want to try the exact old version and it works:
pip install numpy==1.18.5 --only-binary=:all:
- Then try to install the rest but skip numpy:
Edit your requirements.txt to temporarily remove or comment out the numpy==1.18.5 line (add # at the start).
Then install:
pip install -r requirements.txt
- Check if all packages except numpy work fine.
Bonus: paste here your Python version inside venv:
python --version
That helps to know compatibility.
If nothing works:
- You can share your
requirements.txt here so I can suggest better versions.
- You can share your Python version in your environment.
- We can update all dependencies to current versions known to work.
One last note
Sometimes, in Windows + Python 3.8+ environments, installing libraries like numpy or librosa with strict old version pins causes huge trouble.
It might be easier to:
- Create a clean environment with Python 3.7 or 3.6
- Use updated or no pinned versions in requirements.txt
- Install libs step by step with prebuilt wheels
Feel free to share your requirements.txt (or at least the first 10 lines) so I can help you rewrite a compatible one!