fairseq icon indicating copy to clipboard operation
fairseq copied to clipboard

fairseq install error

Open kli017 opened this issue 3 years ago • 1 comments

Hello, I met a error when I trying to install fairseq with cmd pip3 install --editable ./" the error message like below: `Getting requirements to build editable ... error error: subprocess-exited-with-error

× Getting requirements to build editable did not run successfully. │ exit code: 1 ╰─> [23 lines of output] Traceback (most recent call last): File "/home/likai/miniconda3/envs/fairseq/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in main() File "/home/likai/miniconda3/envs/fairseq/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "/home/likai/miniconda3/envs/fairseq/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 144, in get_requires_for_build_editable return hook(config_settings) File "/tmp/pip-build-env-da1j7k9z/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 446, in get_requires_for_build_editable return self.get_requires_for_build_wheel(config_settings) File "/tmp/pip-build-env-da1j7k9z/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/pip-build-env-da1j7k9z/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 320, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-da1j7k9z/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup exec(code, locals()) File "", line 12, in File "/tmp/pip-build-env-da1j7k9z/overlay/lib/python3.8/site-packages/torch/init.py", line 191, in _load_global_deps() File "/tmp/pip-build-env-da1j7k9z/overlay/lib/python3.8/site-packages/torch/init.py", line 153, in _load_global_deps ctypes.CDLL(lib_path, mode=ctypes.RTLD_GLOBAL) File "/home/likai/miniconda3/envs/fairseq/lib/python3.8/ctypes/init.py", line 373, in init self._handle = _dlopen(self._name, mode) OSError: /tmp/pip-build-env-da1j7k9z/overlay/lib/python3.8/site-packages/torch/lib/../../nvidia/cublas/lib/libcublas.so.11: symbol cublasLtHSHMatmulAlgoInit version libcublasLt.so.11 not defined in file libcublasLt.so.11 with link time reference [end of output]

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

Environment

  • fairseq Version (e.g., 1.0 or main):
  • PyTorch Version: 1.10.1+cu111
  • OS (e.g., Linux): Linux
  • How you installed fairseq (pip, source):
  • Build command you used (if compiling from source): pip3 install --editable ./
  • Python version: python3.8.13
  • CUDA/cuDNN version: cuda11.1
  • GPU models and configuration: A100

kli017 avatar Nov 03 '22 07:11 kli017

Same problems, with Environment

  • PyTorch Version: 1.12.1+cu113
  • OS (e.g., Linux): Linux
  • How you installed fairseq (pip, source):
  • Build command you used (if compiling from source): pip3 install --editable ./
  • Python version: python3.8.13
  • CUDA/cuDNN version: cuda11.3
  • GPU models and configuration: GeForce GTX 1080 Ti

Solved, anyone with same problem can try with the pip flag --no-build-isolation see https://lightrun.com/answers/h5py-h5py-source-build-can-only-find-system-installation-of-cython-not---user-or-venv

In my situation, it seems that due to environment setting or other things, pip install --editable uses exactly the system settings and not my conda environment, so it continuely uses the system environment and enhence can't find the cuda dll or other things to build ...(and take a long time to download dependecies)

Labyrintbs avatar Nov 08 '22 10:11 Labyrintbs

Thank you @Labyrintbs. you have saved my day.

MovingKyu avatar Jan 09 '23 04:01 MovingKyu

I had the same problem, running on Linux server. Whenever I tried to install fairseq I got Failed building wheel for fairseq. Aparently, the problem was in C++ compiler. Follow steps below, if you have Linux, you will just need to install g++:

  1. Install / Update packages sudo apt update && sudo apt install build-essential
  2. Check list of available g++ apt search '^g\+\+-[0-9]+$'
  3. Install at least version 12 or later from the list of available versions sudo apt install g++-12

PS: Here are error logs I used to get before this solution

 pip install fairseq
 
 ....
 
gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/include -fPIC -O2 -isystem /opt/conda/include -fPIC -I/opt/conda/include/python3.10 -c fairseq/clib/libbleu/libbleu.cpp -o build/temp.linux-x86_64-cpython-310/fairseq/clib/libbleu/libbleu.o -std=c++11 -O3
      error: command 'gcc' failed: No such file or directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fairseq
  Building wheel for antlr4-python3-runtime (setup.py) ... done
  Created wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.8-py3-none-any.whl size=141209 sha256=5f5d56effcc196ca1d5eb3fe94da5ead9ba550f6e5bf9d4f29b7454f624705fe
  Stored in directory: /root/.cache/pip/wheels/a7/20/bd/e1477d664f22d99989fd28ee1a43d6633dddb5cb9e801350d5
Successfully built antlr4-python3-runtime
Failed to build fairseq
ERROR: Could not build wheels for fairseq, which is required to install pyproject.toml-based projects

Nik-Kras avatar May 03 '24 13:05 Nik-Kras

我在 Linux 服务器上运行时遇到了同样的问题。每当我尝试安装时,我都会得到.当然,问题出在C++编译器中。请按照以下步骤操作,如果您使用的是 Linux,则只需安装 g++:fairseq``Failed building wheel for fairseq

  1. 安装/更新软件包sudo apt update && sudo apt install build-essential
  2. 检查可用 g++ 的列表apt search '^g\+\+-[0-9]+$'
  3. 从可用版本列表中至少安装版本 12 或更高版本sudo apt install g++-12

PS:这是我在此解决方案之前曾经获得的错误日志

 pip install fairseq
 
 ....
 
gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/include -fPIC -O2 -isystem /opt/conda/include -fPIC -I/opt/conda/include/python3.10 -c fairseq/clib/libbleu/libbleu.cpp -o build/temp.linux-x86_64-cpython-310/fairseq/clib/libbleu/libbleu.o -std=c++11 -O3
      error: command 'gcc' failed: No such file or directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fairseq
  Building wheel for antlr4-python3-runtime (setup.py) ... done
  Created wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.8-py3-none-any.whl size=141209 sha256=5f5d56effcc196ca1d5eb3fe94da5ead9ba550f6e5bf9d4f29b7454f624705fe
  Stored in directory: /root/.cache/pip/wheels/a7/20/bd/e1477d664f22d99989fd28ee1a43d6633dddb5cb9e801350d5
Successfully built antlr4-python3-runtime
Failed to build fairseq
ERROR: Could not build wheels for fairseq, which is required to install pyproject.toml-based projects

我在linux服务器上遇到了和您之前相同的问题,“ERROR: Could not build wheels for fairseq, which is required to install pyproject.toml-based projects”,请问您可以详细说一下,如何安装“g++:fairseqFailed building wheel for fairseq”吗,我对这里并不了解,十分感谢,

qinghuanyyz avatar May 14 '24 03:05 qinghuanyyz

Find a way to update gcc and g++ to version 9 and above

我在 Linux 服务器上运行时遇到了同样的问题。每当我尝试安装时,我都会得到.当然,问题出在C++编译器中。请按照以下步骤操作,如果您使用的是 Linux,则只需安装 g++: fairseqFailed building wheel for fairseq ``

  1. 安装/更新软件包sudo apt update && sudo apt install build-essential
  2. 检查可用 g++ 的列表apt search '^g\+\+-[0-9]+$'
  3. 从可用版本列表中至少安装版本 12 或更高版本sudo apt install g++-12

PS:这是我在此解决方案之前曾经获得的错误日志

 pip install fairseq
 
 ....
 
gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/conda/include -fPIC -O2 -isystem /opt/conda/include -fPIC -I/opt/conda/include/python3.10 -c fairseq/clib/libbleu/libbleu.cpp -o build/temp.linux-x86_64-cpython-310/fairseq/clib/libbleu/libbleu.o -std=c++11 -O3
      error: command 'gcc' failed: No such file or directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for fairseq
  Building wheel for antlr4-python3-runtime (setup.py) ... done
  Created wheel for antlr4-python3-runtime: filename=antlr4_python3_runtime-4.8-py3-none-any.whl size=141209 sha256=5f5d56effcc196ca1d5eb3fe94da5ead9ba550f6e5bf9d4f29b7454f624705fe
  Stored in directory: /root/.cache/pip/wheels/a7/20/bd/e1477d664f22d99989fd28ee1a43d6633dddb5cb9e801350d5
Successfully built antlr4-python3-runtime
Failed to build fairseq
ERROR: Could not build wheels for fairseq, which is required to install pyproject.toml-based projects

我在linux服务器上遇到了和您之前相同的问题,“ERROR: Could not build wheels for fairseq, which is required to install pyproject.toml-based projects”,请问您可以详细说一下,如何安装“g++:fairseqFailed building wheel for fairseq”吗,我对这里并不了解,十分感谢,

NefelibataJay avatar Jun 05 '24 05:06 NefelibataJay