I tried to install fairseq by using both pip and installing from source. But the error happen:
ERROR: Could not build wheels for fairseq which use PEP 517 and cannot be installed directly
The full error log is very long, below is some snipset:
`
$ pip3 install fairseq
Collecting fairseq
Using cached fairseq-0.10.0.tar.gz (677 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Collecting editdistance
Using cached editdistance-0.5.3.tar.gz (27 kB)
Requirement already satisfied: hydra-core in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (1.0.4)
Requirement already satisfied: cython in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (0.29.21)
Requirement already satisfied: sacrebleu>=1.4.12 in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (1.4.14)
Requirement already satisfied: tqdm in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (4.52.0)
Requirement already satisfied: regex in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (2020.11.13)
Requirement already satisfied: numpy in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (1.19.2)
Requirement already satisfied: torch in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (1.7.0+cpu)
Requirement already satisfied: dataclasses in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (0.6)
Requirement already satisfied: cffi in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from fairseq) (1.14.3)
Requirement already satisfied: antlr4-python3-runtime==4.8 in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from hydra-core->fairseq) (4.8)
Requirement already satisfied: importlib-resources; python_version < "3.9" in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from hydra-core->fairseq) (3.3.0)
Requirement already satisfied: omegaconf>=2.0.5 in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from hydra-core->fairseq) (2.0.5)
Requirement already satisfied: portalocker in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from sacrebleu>=1.4.12->fairseq) (2.0.0)
Requirement already satisfied: typing-extensions in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from torch->fairseq) (3.7.4.3)
Requirement already satisfied: future in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from torch->fairseq) (0.18.2)
Requirement already satisfied: pycparser in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from cffi->fairseq) (2.20)
Requirement already satisfied: PyYAML>=5.1.* in /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages (from omegaconf>=2.0.5->hydra-core->fairseq) (5.3.1)
Building wheels for collected packages: fairseq, editdistance
Building wheel for fairseq (PEP 517) ... error
ERROR: Command errored out with exit status 1:
command: /home/local/anaconda3/envs/phobert/bin/python /home/local/anaconda3/envs/phobert/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpi0w5grx5
cwd: /tmp/pip-install-1s172n6m/fairseq
Complete output (674 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/fairseq
copying fairseq/sequence_generator.py -> build/lib.linux-x86_64-3.8/fairseq
copying fairseq/binarizer.py -> build/lib.linux-x86_64-3.8/fairseq
....
creating build/temp.linux-x86_64-3.8/fairseq/clib
creating build/temp.linux-x86_64-3.8/fairseq/clib/libbleu
gcc -pthread -B /home/local/anaconda3/envs/phobert/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/local/anaconda3/envs/phobert/include/python3.8 -c fairseq/clib/libbleu/libbleu.cpp -o build/temp.linux-x86_64-3.8/fairseq/clib/libbleu/libbleu.o -std=c++11 -O3
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
ERROR: Failed building wheel for fairseq
Building wheel for editdistance (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/local/anaconda3/envs/phobert/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1s172n6m/editdistance/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1s172n6m/editdistance/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-qe4g1iqi
cwd: /tmp/pip-install-1s172n6m/editdistance/
Complete output (16 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/editdistance
copying editdistance/__init__.py -> build/lib.linux-x86_64-3.8/editdistance
copying editdistance/_editdistance.h -> build/lib.linux-x86_64-3.8/editdistance
copying editdistance/def.h -> build/lib.linux-x86_64-3.8/editdistance
running build_ext
building 'editdistance.bycython' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/editdistance
gcc -pthread -B /home/local/anaconda3/envs/phobert/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./editdistance -I/home/local/anaconda3/envs/phobert/include/python3.8 -c editdistance/_editdistance.cpp -o build/temp.linux-x86_64-3.8/editdistance/_editdistance.o
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'gcc' failed with exit status 1
ERROR: Failed building wheel for editdistance
Running setup.py clean for editdistance
Failed to build fairseq editdistance
ERROR: Could not build wheels for fairseq which use PEP 517 and cannot be installed directly
`
Can you try pip install editdistance and see if that works?
editdistance isn't actually a strict requirement btw, it's only required for some of the wav2vec models. You can try removing it from setup.py if necessary.
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
try sudo apt install g++
pip install editdistance
Thank you guy, this works for my case.
Most helpful comment
gcc: error trying to exec 'cc1plus': execvp: No such file or directorytry
sudo apt install g++