Ubuntu安装torch出现的问题

1. /torch/install/bin/luarocks: No such file or directory Installing common Lua packages

详细问题:

vatsal@vatsal-Inspiron-7559:~/torch$ ./install.sh
Prefix set to /home/vatsal/torch/install
Installing Lua version: LUAJIT21
/home/vatsal/anaconda2/lib/libreadline.so: undefined reference to tputs' /home/vatsal/anaconda2/lib/libreadline.so: undefined reference totgoto'
/home/vatsal/anaconda2/lib/libreadline.so: undefined reference to tgetflag' /home/vatsal/anaconda2/lib/libreadline.so: undefined reference toUP'
/home/vatsal/anaconda2/lib/libreadline.so: undefined reference to tgetent' /home/vatsal/anaconda2/lib/libreadline.so: undefined reference totgetnum'
/home/vatsal/anaconda2/lib/libreadline.so: undefined reference to PC' /home/vatsal/anaconda2/lib/libreadline.so: undefined reference totgetstr'
/home/vatsal/anaconda2/lib/libreadline.so: undefined reference to `BC'
collect2: error: ld returned 1 exit status
make[2]: *** [exe/luajit-rocks/luajit-2.1/luajit] Error 1
make[1]: *** [exe/luajit-rocks/luajit-2.1/CMakeFiles/luajit.dir/all] Error 2
make: *** [all] Error 2
./install.sh: line 82: /home/vatsal/torch/install/bin/luarocks: No such file or directory
Installing common Lua packages
./install.sh: line 86: /home/vatsal/torch/install/bin/luarocks: No such file or directory

解决方式:

mv ~/anaconda2/lib/libreadline.so ~/libreadline.so

注意这里移动之后一定要将anaconda禁用,可以注释掉~/.bashrc中anaconda的环境变量。

vi ~/.bashrc

# export PATH="/home/intern/anaconda2/bin:$PATH"

修改完成之后

source ~/.bashrc

之后一定要重启终端!!不然anaconda还是生效的。再之后进行如下操作,该问题解决。

make clean
./clean.sh
./install.sh
mv ~/libreadline.so ~/anaconda2/lib/libreadline.so

2. Error generating file  torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath.cu.o

详细问题:

1 error detected in the compilation of "/tmp/tmpxft_000005a7_00000000-6_THCTensorMathPairwise.cpp1.ii".
CMake Error at THC_generated_THCTensorMathPairwise.cu.o.cmake:267 (message):
  Error generating file
  /home/vipaacc/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMathPairwise.cu.o

lib/THC/CMakeFiles/THC.dir/build.make:4216: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMathPairwise.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMathPairwise.cu.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/vipaacc/torch/extra/cutorch/lib/THC/generic/THCTensorMath.cu(393): error: more than one operator "==" matches these operands:
            function "operator==(const __half &, const __half &)"
            function "operator==(half, half)"
            operand types are: half == half

/home/vipaacc/torch/extra/cutorch/lib/THC/generic/THCTensorMath.cu(414): error: more than one operator "==" matches these operands:
            function "operator==(const __half &, const __half &)"
            function "operator==(half, half)"
            operand types are: half == half

2 errors detected in the compilation of "/tmp/tmpxft_00000605_00000000-6_THCTensorMath.cpp1.ii".
CMake Error at THC_generated_THCTensorMath.cu.o.cmake:267 (message):
  Error generating file
  /home/vipaacc/torch/extra/cutorch/build/lib/THC/CMakeFiles/THC.dir//./THC_generated_THCTensorMath.cu.o


lib/THC/CMakeFiles/THC.dir/build.make:2735: recipe for target 'lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o' failed
make[2]: *** [lib/THC/CMakeFiles/THC.dir/THC_generated_THCTensorMath.cu.o] Error 1
CMakeFiles/Makefile2:172: recipe for target 'lib/THC/CMakeFiles/THC.dir/all' failed
make[1]: *** [lib/THC/CMakeFiles/THC.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

Error: Build error: Failed building.

解决方法

直接输入下面命令

export TORCH_NVCC_FLAGS="-D__CUDA_NO_HALF_OPERATORS__"

安装过程中主要碰到这两个问题,解决之后的确安装成功了。

猜你喜欢

转载自blog.csdn.net/u010949998/article/details/81747722