Ubuntu 安装 Torch(未成功)

阿里云全新主机,Ubuntu 20.04 64位。

记录一下整个折腾过程吧。有点乱,仅为记录,参考慎重。

1. 首先安装git

Workbench远程连接

sudo apt-get update

sudo apt-get install git

2. 然后参考Torch官网安装教程:http://torch.ch/docs/getting-started.html

Torch can be installed to your home folder in ~/torch by running these three commands:

# in a terminal, run the commands WITHOUT sudo
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch; bash install-deps;
./install.sh

[git clone https://github.com/torch/distro.git ~/torch --recursive]是一个漫长的[Receiving objects]过程,有点耗时,视乎网速,耐心耐心!

运行:cd ~/torch; bash install-deps;
报错:E: Package 'python-software-properties' has no installation candidate

[2021.2.4 PM 很晚了,明天继续。]

[2021.2.5 AM 早上好,继续折腾。]

解决方法:

sudo apt-get install software-properties-common

If Ubuntu <= 12.04:

sudo apt-get install python-software-properties

 但继续运行:cd ~/torch; bash install-deps;

依然报错,可能是Torch没安装好,

删除Torch(参考官网教程),再次安装。

If you ever need to uninstall torch, simply run the command:

rm -rf ~/torch

再次安装:

git clone https://github.com/torch/distro.git ~/torch --recursive

再安装依然报错……

OK,不折腾了,到此为止。

[2021.2.5 PM 不甘心,继续折腾。]

把阿里云服务器的操作系统更换为:Ubuntu  16.04 64位

再次安装出现以下报错,试了多次问题依旧。

Cloning into 'exe/luajit-rocks'...
remote: Enumerating objects: 2737, done.
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
fatal: clone of 'https://github.com/torch/luajit-rocks.git' into submodule path 'exe/luajit-rocks' failed

解决方法:

sudo apt-get purge git
sudo apt-get install git
# from: https://blog.csdn.net/shida_csdn/article/details/91048171
# 注:百度各种解决方法,试了很多,这个OK

安装依然报错:

Cloning into '/tmp/tmp.vBYYNUuoej/OpenBLAS'...
remote: Enumerating objects: 62, done.
remote: Counting objects: 100% (62/62), done.
remote: Compressing objects: 100% (43/43), done.
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error. Cannot clone OpenBLAS.

Shxt,杠上了。。。

[2021.2.10 PM 这几天断断续续在继续安装ing,也不知道安装了多少次,一直出现上面的OpenBLAS报错……Now,continue installing...]

改变思路,先安装OpenBLAS,参考:https://blog.csdn.net/tekkie/article/details/90903108

cd ~
mkdir install
cd install
git clone git://github.com/xianyi/OpenBLAS.git
cd OpenBLAS
make -j4 #-j表示编译线程数,建议根据自己cpu核数配置确定,最好不要全开,机器容易卡死
sudo make install #默认安装在/opt/OpenBLAS下
#也可以执行以下命令,指定安装目录
sudo make --PREFIX=/usr/local/OpenBLAS/ install #--PREFIX=表示安装目录前缀
# 应为:make PREFIX=/usr/local/OpenBLAS/ install

OpenBLAS安装很顺利,但跑去跑“bash install-deps;”还是会再次安装OpenBLAS,算了……

 [想了想,先安装个图形界面吧。]

参考:
搭建阿里云ecs服务器(安装图形化界面)
https://segmentfault.com/a/1190000016166599

很顺利,但进入的是Guest账号,参考网上的修改指引,搞定root账号。

[到此为止。]

[嗯,今天是2021年2月12日,大年初一,首先嘛,给大家拜个早年,新的一年,折腾精神不能停……]

把阿里云服务器的操作系统更换为:Ubuntu  14.04 64位,^_^

继续安装:git clone https://github.com/torch/distro.git ~/torch --recursive

第一次:

Cloning into 'extra/nn'...
fatal: unable to access 'https://github.com/torch/nn.git/': GnuTLS recv error (-9): A TLS packet with unexpected length was received.
Clone of 'https://github.com/torch/nn.git' into submodule path 'extra/nn' failed

第二次:

Cloning into 'extra/cunn'...
remote: Enumerating objects: 3995, done.
error: RPC failed; result=56, HTTP code = 200iB | 1024 bytes/s   
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Clone of 'https://github.com/torch/cunn.git' into submodule path 'extra/cunn' failed

重复前面的:

sudo apt-get purge git
sudo apt-get install git

OK,work!

继续安装:cd ~/torch; bash install-deps;

报错:

Cloning into '/tmp/tmp.Cx8JPgGT24/OpenBLAS'...
remote: Enumerating objects: 45576, done.
error: RPC failed; result=18, HTTP code = 200MiB | 22.00 KiB/s    
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error. Cannot clone OpenBLAS.

 搞毛!但前面单独安装OpenBLAS没有任何问题。

难不成是 /tmp/ 文件夹的问题,之前百度也看见过有人说改文件夹权限的(未尝试)。

先不管,再百度一下解决方法:

https://blog.csdn.net/qq_34754747/article/details/106211636

因为git库上面放了一些数据,整个库较大。curl的postBuffer 默认值较小,配置下个这个值,就不会出现该错误了

git config --global http.postBuffer 1024288000
# 检查:git config --list

 再次执行:bash install-deps;,报错:

Cloning into '/tmp/tmp.PD2gwFIZy8/OpenBLAS'...
fatal: Out of memory, malloc failed (tried to allocate 1024288000 bytes)
Error. Cannot clone OpenBLAS.

好像数值设得有点大了,改成:

git config --global http.postBuffer 24288000
# 参考:https://www.zhyd.me/article/49

 【折腾了好久都没有安装成功,算啦不搞了,散了散了!~ The End. ~

posted @ 2021-02-04 15:48  ec04  阅读(948)  评论(0编辑  收藏  举报