Tensorflow CUDA GTX 1070导入错误 [英] Tensorflow CUDA GTX 1070 import error
问题描述
我正在尝试安装具有CUDA支持的Tensorflow.这是我的规格:
I'm trying to install Tensorflow with CUDA support. Here are my specs:
- NVIDIA GTX 1070
- CUDA 7.5
- Cudnn v5.0
我已经通过pip
安装程序安装了Tensorflow-我在想你的答案是从源代码安装,但是我想确保没有快速修复程序.
I have installed Tensorflow via the pip
installation -- so I'm picturing your answer being to install from source, but I want to make sure there isn't a quick fix.
错误是:
volcart@volcart-Precision-Tower-7910:~$ python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 98, in <module>
from tensorflow.python.platform import test
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/test.py", line 77, in <module>
import mock # pylint: disable=g-import-not-at-top,unused-import
File "/usr/local/lib/python2.7/dist-packages/mock/__init__.py", line 2, in <module>
import mock.mock as _mock
File "/usr/local/lib/python2.7/dist-packages/mock/mock.py", line 71, in <module>
_v = VersionInfo('mock').semantic_version()
File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 460, in semantic_version
self._semantic = self._get_version_from_pkg_resources()
File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 447, in _get_version_from_pkg_resources
result_string = packaging.get_version(self.package)
File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 725, in get_version
raise Exception("Versioning for this project requires either an sdist"
Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?
我从主目录运行python
控制台-不在Tensorflow目录中.
I am running the python
console from the home directory -- not in the Tensorflow directory.
已安装GIT和CUDA:
GIT and CUDA both installed:
volcart@volcart-Precision-Tower-7910:~$ git --version
git version 2.5.0
volcart@volcart-Precision-Tower-7910:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
我通过此测试验证了CUDA的功能(在此处找到):
I verified CUDA is functional via this test (found here):
/usr/local/cuda/bin/cuda-install-samples-7.5.sh ~/cuda-samples
cd ~/cuda-samples/NVIDIA*Samples
make -j $(($(nproc) + 1))
Tensorflow成功安装:
Tensorflow successfully installs:
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl
sudo -H pip install --upgrade $TF_BINARY_URL
我的GPU看起来不错:
My GPU seems to be fine:
volcart@volcart-Precision-Tower-7910:~$ nvidia-smi
Thu Aug 4 17:31:47 2016
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 367.35 Driver Version: 367.35 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 1070 Off | 0000:03:00.0 On | N/A |
| 0% 41C P8 12W / 185W | 499MiB / 8104MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 900 G /usr/bin/X 272MiB |
| 0 1679 G compiz 154MiB |
| 0 2287 G ...s-passed-by-fd --v8-snapshot-passed-by-fd 69MiB |
+-----------------------------------------------------------------------------+
推荐答案
从错误日志看,看起来与模拟或pbr软件包的某种版本不匹配,可能来自较早的安装.在这种情况下,从源代码构建将无济于事,您需要从头开始安装Python依赖项,即,通过在新环境中使用virtualenv install
From error log, looks like some kind of version mismatch with mock or pbr packages, perhaps from an earlier install. In such cases building from source won't help, what you need is to install Python dependencies from scratch, ie, by using virtualenv install in new env
这篇关于Tensorflow CUDA GTX 1070导入错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!