在aarch64上安装Tensorflow:错误:找不到满足需求tensorflow的版本

时间:2019-06-01 19:57:25

标签: python tensorflow pip arm64

我想在aarch64(Ubuntu 16.04; Linux on DeX)上安装Tensorflow。

尝试1::遵循与经典x86_64体系结构相同的步骤(在此处工作);参见here

sudo apt update
sudo apt install python3-dev python3-pip virtualenv # the latter was required under aarch64, not under x86_64
sudo -H pip3 install --upgrade virtualenv
mkdir /usr/local/tensorflow
virtualenv --system-site-packages -p python3 /usr/local/tensorflow
source /usr/local/tensorflow/bin/activate
pip3 install --upgrade tensorflow # fails with 'Error: Could not find a version that satisfies the requirement tensorflow (from versions: none)' and 'Error: No matching distribution found for tensorflow'

与尝试1相关的帖子,但对于Windows是this here。也有人找到其他文章(标题相似),但似乎都没有涉及ARM体系结构。

尝试2:关注these instructions

sudo apt update
sudo apt install python3-dev python3-pip
mkdir /usr/local/tensorflow
cd /usr/local/tensorflow
wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v1.8.0/tensorflow-1.8.0-cp35-none-linux_aarch64.whl
sudo -H pip3 install tensorflow-1.8.0-cp35-none-linux_aarch64.whl
# => reports 'Failed building wheel for ...'. Still seems to somehow progress
#    but then 'import tensorflow as tf' in a Python 3.5.2 session produces a lot
#    of traceback output and essentially shows that the installation did not work.

第三次尝试中,我尝试遵循these instructions,但 无法安装here的步骤2中的Bazel失败,因为没有aarch64版本(即使下载了.tar.gz,编译也会失败,并显示ERROR: Must specify PROTOC if not bootstrapping from the distribution artifact ...

更多信息:python --version显示2.7.12,而python3 --version显示3.5.2

更新

我尝试了hoefling关于尝试1的建议。在pip3 install tensorflow --extra-index-url=https://www.piwheels.org/simple之前运行pip3 install --upgrade tensorflow使后者工作时没有明显的错误,但是启动了python3并使用了{{1 }}我仍然获得大量的回溯输出:

import tensorflow as tf

2 个答案:

答案 0 :(得分:0)

我在https://github.com/lhelontra/tensorflow-on-arm/issues/13上发现了问题。简而言之,我在aarch64下缺少某些预备知识。解决方法如下:

# Preliminaries
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-4.9
sudo apt install --only-upgrade libstdc++6

# Installation similar to Ubuntu on x86_64
sudo apt update
sudo apt install python3-dev python3-pip virtualenv
sudo -H pip3 install --upgrade virtualenv
mkdir /usr/local/tensorflow
virtualenv --system-site-packages -p python3 /usr/local/tensorflow/
source /usr/local/tensorflow/bin/activate
pip3 install --upgrade tensorflow
deactivate

# Test
source /usr/local/tensorflow/bin/activate
$ python3
>>> import tensorflow as tf
>>> hello = tf.constant("Hello, World!")
>>> sess = tf.Session()
>>> print(sess.run(hello))

答案 1 :(得分:0)

大家好,我下载并安装后解决了我的CPU上的上述导入张量流错误 Microsoft Visual C ++ 2015-2019可再发行组件(x64) 笔记本电脑上的VC_redist.x64版本。希望对您有所帮助。

我最初安装了Anaconda 3.7 python版本,然后现在使用conda命令提示符
从Anaconda成功安装了张量流,并且可以正常工作。但是在导入张量流时,我遇到了上述问题。
我什至安装了msv140dll,但直到下载并运行后它仍然无法正常工作 VC_redist.x64版本。之后一切正常