A solution for "error: command 'gcc' failed with exit status 1"
ninmiao opened this issue · 2 comments
I met the error when I try to install the pyworld 0.2.10 under WSL(Ubuntu 20.04) with Python 3.6.12.
I found the inappropriate gcc version would fail the installation with "error: command 'gcc' failed with exit status 1" as follows.
My solution is degrading the gcc version into gcc-7. As my test, gcc 7.5.0 can pass the compile of pyworld 0.2.10.
Collecting pyworld==0.2.10
Using cached pyworld-0.2.10.tar.gz (73 kB)
Collecting numpy
Using cached numpy-1.19.5-cp36-cp36m-manylinux2010_x86_64.whl (14.8 MB)
Collecting cython>=0.24.0
Using cached Cython-0.29.24-cp36-cp36m-manylinux1_x86_64.whl (2.0 MB)
Building wheels for collected packages: pyworld
Building wheel for pyworld (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/li/miniconda3/envs/fastspeech2/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-pcy279a0/pyworld_3eaf2492f9fc4999ac69c02051599e29/setup.py'"'"'; __file__='"'"'/tmp/pip-install-pcy279a0/pyworld_3eaf2492f9fc4999ac69c02051599e29/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-_we7kem9
cwd: /tmp/pip-install-pcy279a0/pyworld_3eaf2492f9fc4999ac69c02051599e29/
Complete output (19 lines):
/home/li/miniconda3/envs/fastspeech2/lib/python3.6/site-packages/setuptools/dist.py:720: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
% (opt, underscore_opt)
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/pyworld
copying pyworld/__init__.py -> build/lib.linux-x86_64-3.6/pyworld
running build_ext
building 'pyworld.pyworld' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/pyworld
creating build/temp.linux-x86_64-3.6/lib
creating build/temp.linux-x86_64-3.6/lib/World
creating build/temp.linux-x86_64-3.6/lib/World/src
gcc -pthread -B /home/li/miniconda3/envs/fastspeech2/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Ilib/World/src -I/home/li/miniconda3/envs/fastspeech2/include/python3.6m -I/tmp/pip-install-pcy279a0/pyworld_3eaf2492f9fc4999ac69c02051599e29/.eggs/numpy-1.19.5-py3.6-linux-x86_64.egg/numpy/core/include -c pyworld/pyworld.cpp -o build/temp.linux-x86_64-3.6/pyworld/pyworld.o
gcc: error: pyworld/pyworld.cpp: No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyworld
Running setup.py clean for pyworld
Failed to build pyworld
Just a bit more helpful info..
Pyworld 0.3.0 needs gcc 7.5... I have gcc 9 on the latest ubuntu LTS
I know the target gcc version by checking python's gcc version...
python -VV
Python 3.9.5 (default, Jun 4 2021, 12:28:51)
[GCC 7.5.0]
So... I can install gcc-7 and g++-7
sudo apt-get install gcc-7 g++-7
Then I need to setup my alternatives, so that I can easily assign different binary applications to the gcc command..
I give gcc-9 a higher priority than gcc-7, so it will be used by default..
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 20 --slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 10 --slave /usr/bin/g++ g++ /usr/bin/g++-7
Then, to choose which app gets associated with gcc, I run this..
sudo update-alternatives --config gcc
There are 2 choices for the alternative gcc (providing /usr/bin/gcc).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/gcc-9 20 auto mode
1 /usr/bin/gcc-7 10 manual mode
2 /usr/bin/gcc-9 20 manual mode
Press <enter> to keep the current choice[*], or type selection number: 1
update-alternatives: using /usr/bin/gcc-7 to provide /usr/bin/gcc (gcc) in manual mode
And then to switch back, just run sudo update-alternatives --config gcc
again and choose auto mode.
Closed due to inactivity. thx for the discussions.