Gewusst WIE: Importieren TensorFlow in Jupyter Notebook von Conda mit GPU-Unterstützung?
Habe ich installiert tensorflow mit dem anaconda-Umgebung wie bereits erwähnt in der tensorflow website und nach meiner python-installation Pfad geändert.
dennis@dennis-HP:~$ which python
/home/dennis/anaconda2/bin/python
Und Jupyter installiert wurde. Ich nahm an, dass, wenn ich war in der Lage zu importieren und zu verwenden tensorflow in der conda-Umgebung, dass ich in der Lage, das gleiche zu tun in Jupyter. Aber das war nicht der Fall -
Importieren tensorflow in meinem system (ohne Aktivierung der Umgebung)
dennis@dennis-HP:~$ 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
dennis@dennis-HP:~$ source activate tensorflow
prepending /home/dennis/anaconda2/envs/tensorflow/bin to PATH
(tensorflow) dennis@dennis-HP:~$ 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
Als die oben import erfolgreich war, habe ich versucht, das gleiche zu tun in jupyter (gestartet jupyter in der Umgebung) aber ich bekam die folgende Fehlermeldung 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 ausführen, in der Umgebung von conda. So, können Sie mir sagen, wie ich es zwingen, das gleiche zu tun?
Oder Sie können nur geben Sie mir mit Informationen zum importieren tensorflow in jupyter
EDIT #1:
Habe ich erfolgreich installiert tensorflow in anaconda installation mit conda install -c jjhelmus tensorflow=0.9.0
Befehl. [Quelle: conda.anaconda.org/jjhelmus]
Aber dies deaktiviert die GPU-Unterstützung, so dass ein code wie unten gibt einen Fehler zurück,
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 die GPU-Unterstützung? Gibt es eine Alternative Lösung zu installieren tensorflow in conda mit GPU-Unterstützung?
EDIT #2:
Wird erwähnt hierdass die GPU-Unterstützung ist nur möglich, wenn die Quelle wurde für die Ziel-GPU. Wenn das wahr ist, geben Sie bitte Einzelheiten darüber, wie es getan werden kann, so, dass ich einen GPU aktiviert tensorflow installation.
InformationsquelleAutor der Frage Naveen Dennis | 2016-07-06
Du musst angemeldet sein, um einen Kommentar abzugeben.
Haben Sie jemals installiert jupyter innerhalb der tensorflow Umgebung?
Typ
which jupyter
zu finden. Das Ergebnis:Wenn nicht installiert ist, geben Sie
pip install jupyter
innerhalb der tensorflow Umgebung. Dann versuchenimport tensorflow
im notebook wieder.Hoffe, dass dies helfen kann.
InformationsquelleAutor der Antwort filick
Tensorflow 0.9 mit GPU-Anaconda Python 2
Für linuxGoogle fertige mit Cuda 7,5 und CuDNN v4 (https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html#anaconda-installation):
Pseudoscript: https://gist.github.com/nathanielatom/ccdf39d9f20dca4c9e418ea0e00ccd25
Für Macaus dem Quellcode installieren mit Cuda 7,5 und CuDNN v5.1 RC (https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html#installation-for-mac-os-x)
Pseudoscript: https://gist.github.com/nathanielatom/8c51c91d4bde3e37db0db705e8822e70
InformationsquelleAutor der Antwort user2561747