deepin怎么安装tensorflow-gpu版本?
Tofloor
poster avatar
marsggbo
deepin
2017-06-30 00:47
Author
百度了好久,基本上都是Ubuntu的教程,而且要下载的一些软件也没有deepin版本的,很绝望啊。。。

Reply Favorite View the author
All Replies
avatar
jingle
deepin
2017-06-30 01:06
#1
Reply View the author
avatar
158******91
deepin
2017-06-30 02:04
#2
可以考虑docker安装,很方便。
安装docker:sudo apt-get install docker-ce
然后安装tensorflow,见:
https://hub.docker.com/r/tensorflow/tensorflow/
Reply View the author
avatar
marsggbo
deepin
2017-07-01 06:17
#3
https://bbs.deepin.org/post/141773
安装Ubuntu的试试 http://blog.csdn.net/zhaoyu106/article/details/52793183/

就是因为用不惯Ubuntu才又装回了deepin~~~~大爱deepin啊~~~
Reply View the author
avatar
marsggbo
deepin
2017-07-01 06:18
#4
https://bbs.deepin.org/post/141773
可以考虑docker安装,很方便。
安装docker:sudo apt-get install docker-ce
然后安装tensorflow,见:

E: 无法定位软件包 docker-ce

这个该怎么解决?
Reply View the author
avatar
158******91
deepin
2017-07-01 18:16
#5
https://bbs.deepin.org/post/141773
E: 无法定位软件包 docker-ce

这个该怎么解决?

参考下官方文档:
https://docs.docker.com/engine/i ... sing-the-repository
Reply View the author
avatar
jingle
deepin
2017-07-01 18:33
#6
请勿重复发帖,另外一个我删了
Reply View the author
avatar
pigrunrun
deepin
2017-07-20 17:40
#7
楼主成功了么,如果成功了我也准备装deepin。否则只好Ubuntu了

另外楼主装的是CPU版,还是GPU版
Reply View the author
avatar
pigrunrun
deepin
2017-07-21 09:19
#8
正在读取软件包列表... 完成
W: 仓库 “https://download.docker.com/linux/debian unstable Release” 没有 Release 文件。
N: 无法认证来自该源的数据,所以使用它会带来潜在风险。
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
W: 目标 Packages (stable/binary-all/Packages) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次
E: 无法下载 https://download.docker.com/linux/debian/dists/unstable/stable/binary-armhf/Packages  404  Not Found
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
W: 目标 Packages (stable/binary-all/Packages) 在 /etc/apt/sources.list:3 和 /etc/apt/sources.list.d/docker.list:1 中被配置了多次

dock-ce 按指导装,还是提示错误。
Reply View the author
avatar
134******40
deepin
2017-07-21 16:45
#9
https://bbs.deepin.org/post/141773
正在读取软件包列表... 完成
W: 仓库 “https://download.docker.com/linux/debian unstable Release” 没 ...

官方指导不行,按照这个指导装
https://wiki.deepin.org/index.php?title=Docker
Reply View the author
avatar
catbb49294929
deepin
2017-07-21 17:00
#10
本帖最后由 catbb49294929 于 2017-7-21 09:05 编辑

第一句:curl -sSL https://get.docker.com/ | sh
第二句:docker pull tensorflow/tensorflow

使用方法:数据卷在启动前复制一份出来:
$ docker run --name=tmp -d tensorflow/tensorflow
$ docker cp tmp:/notebooks ~/你的目录
$ docker run -dit --name=tf-cpu \
    -p 8888:8888 \
    -p 6006:6006 \
    -v ~/你的目录:/notebooks \
    -e PASSWORD=你的密码 \
    --restart=always \
    tensorflow/tensorflow

然后打开8888端口即可打开Notebook界面。

选择版本:https://hub.docker.com/r/tensorflow/tensorflow/tags/

例如GPU版本(GPU调用只支持N卡,https://github.com/NVIDIA/nvidia-docker):
nvidia-docker run -dit --name=tf-gpu ... ... tensorflow/tensorflow:latest-gpu



Reply View the author
avatar
134******40
deepin
2017-07-21 17:11
#11
先删除/etc/apt/sources.list.d/docker.list
Reply View the author
avatar
miaoever
deepin
2017-07-22 08:11
#12
跟着官方 ubuntu 教程一步步装,没问题的,亲测。

https://www.tensorflow.org/install/install_sources
Reply View the author
avatar
159******79
deepin
2017-07-22 17:32
#13
http://www.jianshu.com/p/6a1d9522b7c6
Reply View the author
avatar
pigrunrun
deepin
2017-07-23 07:25
#14
本帖最后由 pigrunrun 于 2017-7-22 23:26 编辑

CPU版本装好了,使用的Anaconda方式,总结如下:

1)在清华大学 TUNA 镜像源(https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/)选择对应的操作系统与所需的Python版本下载Anaconda安装包
$ bash Anaconda2-4.4.0-Linux-x86_64.sh   #Python 2.7版本
过程中一路回车或者yes

2)然后需要设置conda的path,否则后续的操作都会错误
# 将anaconda的bin目录加入PATH,根据版本不同,也可能是~/anaconda3/bin
echo 'export PATH="~/anaconda2/binPATH"' >> ~/.bashrc
# 更新bashrc以立即生效
source ~/.bashrc

3)网上的建议是官方下载更新工具包的速度很慢,所以继续添加清华大学 TUNA提供的Anaconda仓库镜像。但是经过实测,使用清华的镜像总是出现某些包下载不到,所以我建议不添加镜像,官方下载成功率高(特别提醒,还是会有失败的包。。。),且速度不慢!
输入以下命令搜索当前可用的tensorflow版本
$ anaconda search -t conda tensorflow
我选的是某个1.1的版本
$ anaconda show lcls-rhel7/tensorflow
按最后一行提示进行安装
To install this package with conda run:
    $  conda install --channel https://conda.anaconda.org/lcls-rhel7 tensorflow

4)很遗憾上述命令执行完后,还是提醒了有一个包没有成功就是最主要的tensorflow的包。这个时候我就去清华的镜像把对应缺失的包找到
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/linux-64/
比如,我在里面找到了上述安装过程中缺失的tensorflow,并使用了本地安装命令
$ conda install --use-local ~/Downloads/tensorflow-1.1.0-np112py27_0.tar.bz2

5)这个时候表面上已经安装完了,进入python测试一下,使用
$ python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
看是否不报错,或者报错缺失什么模块。
我第一次报缺失 google protobuf,找了下解决办法,是使用pip把他装上
$ pip install protobuf
继续测试,报缺失mock,继续使用pip把它补安装上
$ pip install mock

然后,又提示错误 Fontconfig error: "/.config/fontconfig/conf.d/99-deepin.conf", line 1: Unsupported version '2.0',
这个在知乎上查到了解决办法,就是直接打开上述的这个文件,将文件中的第一行xml版本2.0,更改为1.0

然后,还会有warning
The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
这个告警无解,所知道的处理办法,就是用bazel进行源码安装tensorflow可以解决这个问题。但不处理无任何影响

6)到此为止,deepin上tensorflow安装完毕,所有坑被填完。可以正常运行相关测试程序,测试如下,正常显示:
import tensorflow as tf
import numpy
import matplotlib.pyplot as plt
rng = numpy.random

learning_rate = 0.01
training_epochs = 1000
display_step = 50

train_X = numpy.asarray([3.3,4.4,5.5,7.997,5.654,.71,6.93,4.168,9.779,6.182,7.59,2.167,
                         7.042,10.791,5.313,9.27,3.1])

train_Y = numpy.asarray([1.7,2.76,3.366,2.596,2.53,1.221,1.694,1.573,3.465,1.65,2.09,
                         2.827,3.19,2.904,2.42,2.94,1.3])
n_samples = train_X.shape[0]
X = tf.placeholder("float")
Y = tf.placeholder("float")

W = tf.Variable(rng.randn(), name="weight")
b = tf.Variable(rng.randn(), name="bias")

pred = tf.add(tf.multiply(X, W), b)

cost = tf.reduce_sum(tf.pow(pred-Y, 2))/(2*n_samples)

optimizer = tf.train.GradientDescentOptimizer(learning_rate).minimize(cost)

init = tf.initialize_all_variables()
with tf.Session() as sess:
    sess.run(init)


    for epoch in range(training_epochs):
        for (x, y) in zip(train_X, train_Y):
            sess.run(optimizer, feed_dict={X: x, Y: y})

    print "opt donw!"
    training_cost = sess.run(cost, feed_dict={X: train_X, Y: train_Y})
    print "Training cost=", training_cost, "W=", sess.run(W), "b=", sess.run(b), '\n'


    plt.plot(train_X, train_Y, 'ro', label='Original data')
    plt.plot(train_X, sess.run(W) * train_X + sess.run(b), label='Fitted line')
    plt.legend()
    plt.show()


Reply View the author