Ich habe Tensorflow installiert mit der Anaconda-Umgebung wie in der tensorflow website erwähnt und nachdem ich meinen Python-Installationspfad geändert hat.WIE: Importieren Sie TensorFlow in Jupyter Notebook von Conda mit GPU-Unterstützung?
[email protected]:~$ which python
/home/dennis/anaconda2/bin/python
Und Jupyter wurde installiert. Ich nahm an, dass, wenn ich in der Lage wäre, Tensorflow in der Conda-Umgebung zu importieren und zu verwenden, dass ich in der Lage sein werde, dasselbe in Jupyter zu tun. Aber das war nicht der Fall ist -
in meinem System importieren tensorflow (ohne dass die Umgebung zu aktivieren)
[email protected]:~$ python
Python 2.7.11 |Anaconda 4.1.0 (64-bit)| (default, Jun 15 2016, 15:21:30)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow
>>> exit()
importieren tensorflow in Conda Umgebung
[email protected]:~$ source activate tensorflow
prepending /home/dennis/anaconda2/envs/tensorflow/bin to PATH
(tensorflow) [email protected]:~$ python
Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul 2 2016, 17:42:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> 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:102] Couldn't open CUDA library libcudnn.so. LD_LIBRARY_PATH: /usr/local/cuda-7.5/lib64
I tensorflow/stream_executor/cuda/cuda_dnn.cc:2092] Unable to load cuDNN DSO
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 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Wie die obige Import war erfolgreich Ich habe versucht, das gleiche in jupyter (gestartet jupyter in der Umgebung), aber ich habe die Folgefehler beim Import -
ImportError Traceback (most recent call last)
<ipython-input-1-41389fad42b5> in <module>()
----> 1 import tensorflow as tf
ImportError: No module named tensorflow
Meine Vermutung ist, dass das Notebook nicht in der Umgebung von Conda ausgeführt wird. Kannst du mir sagen, wie ich es zwinge, dasselbe zu tun?
Oder Sie können mir nur mit Details darüber, wie in jupyter importieren tensorflow
EDIT # 1:
Ich habe die Installation erfolgreich installiert tensorflow in Anaconda conda install -c jjhelmus tensorflow=0.9.0
Befehl. [Quelle: conda.anaconda.org/jjhelmus]
Aber diese deaktiviert die GPU-Unterstützung, so einen Code wie unten einen Fehler zurückgibt
with tf.Session() as sess:
with tf.device("/gpu:0"): #GPUs are not enabled on the system so it throws an error
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
result = sess.run([product])
print result
So, wie aktiviere ich GPU-Unterstützung? Gibt es eine alternative Lösung, um Tensorflow in Conda mit GPU-Unterstützung zu installieren?
EDIT # 2:
Es here erwähnt wird, ist, dass GPU-Unterstützung nur möglich, wenn die Quelle für das Ziel GPU gebaut wird. Wenn das stimmt, geben Sie bitte Details darüber, wie es gemacht werden kann, so dass ich eine GPU-fähige Tensorflow-Installation habe.
auf welcher plattform bist du? Wenn Sie Linux verwenden, hat Google jetzt eine vordefinierte Binärdatei erstellt, die Sie sehr einfach mit Anaconda verwenden können. https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html#anaconda-installation – user2561747