Ich installierte tensorflow-gpu
auf meinem System unter Ubuntu 16.04. import tensorflow
funktioniert gut, lädt CUDA auf Python CLI und IPython auf dem Terminal. Aber beim Importieren in IPython QtConsole
erhalte ich den folgenden Fehler.TensorFlow Importieren in Python CLI und IPython CLI aber nicht in IPython QtConsole
ImportErrorTraceback (most recent call last)
<ipython-input-25-41389fad42b5> in <module>()
----> 1 import tensorflow as tf
/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py in <module>()
22
23 # pylint: disable=wildcard-import
---> 24 from tensorflow.python import *
25 # pylint: enable=wildcard-import
26
/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py in <module>()
70 for some common reasons and solutions. Include the entire stack trace
71 above this error message when asking for help.""" % traceback.format_exc()
---> 72 raise ImportError(msg)
73
74 # Protocol buffers
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 61, in <module>
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
ImportError: libcudart.so.8.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Die angegebene URL ist ein toter Link.
Ich überprüfte die env vars der QtConsole und es hatte nicht die Änderungen, die ich in meiner .bashrc
Datei gemacht habe. Ich änderte die Variablen mit !export $ENV_VAR=VALUE
. Ich versuchte später !echo $PATH
, aber die Änderungen wurden nicht wiedergegeben. Seltsame O_o
Ich versuchte, os.environ
Wörterbuch zu ändern. Das spiegelte meine Änderungen wider, konnte aber immer noch nicht importieren tensorflow
Wie behebe ich dieses Problem?
EDIT: 1. Importieren tensorflow als auch auf Jupyter Notebook funktioniert, aber nicht in ipython QtConsole
- Ich habe versucht, wie
jupyter qtconsole
laufen stattipython qtconsole
, gleiche Fehlermeldung
Ich habe den Kernel entfernt, könnten Sie auf den 'PBR' Teil näher eingehen? Ich weiß nicht, was das ist oder wie man die pbr-Version findet ('pbr.__version__') gibt mir einen Fehler –
Sie könnten 'pip list' von Ihrem venv ausführen, um zu überprüfen, welche Version von pbr läuft. Sie können dann die Export-Anweisung zu Ihrem Bash-Profil hinzufügen, indem Sie etwas in den Zeilen von [this] tun (https://stackoverflow.com/questions/14524590/how-to-add-export-statement-in-a-bash- Profil-Datei? rq = 1). Ich musste 'export PBR_VERSION = 3.1.1' zu meinem bashrc hinzufügen, damit es funktioniert. Hoffentlich hilft dir das! – naki
Es funktioniert! Danke vielmals :) –