glample / fastBPE

Fast BPE
MIT License
656 stars 96 forks source link

Can't install in Ubuntu 20.04 #45

Closed 1mike12 closed 4 years ago

1mike12 commented 4 years ago

Not sure what's going on I thought this was working a few weeks ago when I tried it in ubuntu 18 in WSL2, now on actual ubuntu 20 it's not working.

OS (e.g., Linux): ubuntu 20.04 python 3.8

pip3 install fastBPE
Collecting fastBPE
  Using cached fastBPE-0.1.0.tar.gz (35 kB)
Building wheels for collected packages: fastBPE
  Building wheel for fastBPE (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gutktu1d/fastBPE/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gutktu1d/fastBPE/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-hlyefd0c
       cwd: /tmp/pip-install-gutktu1d/fastBPE/
  Complete output (12 lines):
  running bdist_wheel
  running build
  running build_py
  package init file 'fastBPE/__init__.py' not found (or not a regular file)
  running build_ext
  building 'fastBPE' extension
  creating build
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/fastBPE
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -IfastBPE -I/usr/include/python3.8 -c fastBPE/fastBPE.cpp -o build/temp.linux-x86_64-3.8/fastBPE/fastBPE.o -std=c++11 -Ofast -pthread
  unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for fastBPE
  Running setup.py clean for fastBPE
Failed to build fastBPE
Installing collected packages: fastBPE
    Running setup.py install for fastBPE ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gutktu1d/fastBPE/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gutktu1d/fastBPE/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-h1vszop2/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/mike/.local/include/python3.8/fastBPE
         cwd: /tmp/pip-install-gutktu1d/fastBPE/
    Complete output (12 lines):
    running install
    running build
    running build_py
    package init file 'fastBPE/__init__.py' not found (or not a regular file)
    running build_ext
    building 'fastBPE' extension
    creating build
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/fastBPE
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -IfastBPE -I/usr/include/python3.8 -c fastBPE/fastBPE.cpp -o build/temp.linux-x86_64-3.8/fastBPE/fastBPE.o -std=c++11 -Ofast -pthread
    unable to execute 'x86_64-linux-gnu-gcc': No such file or directory
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gutktu1d/fastBPE/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gutktu1d/fastBPE/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-h1vszop2/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/mike/.local/include/python3.8/fastBPE Check the logs for full command output.
1mike12 commented 4 years ago

I figured out this was because I changed the gcc version.

Fairseq / pytorch requires cuda 10.2, which cannot be installed with gcc-9 which I guess comes default in 20.04?. I had to run

sudo apt-get remove gcc gcc-9
sudo apt-get remove g++

sudo apt install gcc-8 g++-8

sudo ln -s /usr/bin/gcc-8 /usr/bin/gcc
sudo ln -s /usr/bin/g++-8 /usr/bin/g++

to get cuda working, but this breaks installation of fastBPE, so then I did the opposite of the above commands and re-intsalled gcc-9