I am new to pycharm, tensorflow and python. I have this simple program:
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
To set the tensorflow module i followed this: settings > selecte 'Add Local' > selected /home/manish/dev/tensorflow/bin/python3.4. I have my tensorflow installed in /home/manish/dev/tensorflow/
I am getting this error:
/home/manish/dev/tensorflow/bin/python3.4 /home/manish/PycharmProjects/untitled/test.py
Traceback (most recent call last):
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/manish/dev/tensorflow/lib/python3.4/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/manish/PycharmProjects/untitled/test.py", line 1, in <module>
import tensorflow as tf
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/manish/dev/tensorflow/lib/python3.4/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/home/manish/dev/tensorflow/lib/python3.4/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Process finished with exit code 1
Open Pycharm through terminal instead of search bar.
Open terminal
Execute command: pycharm-community
Related
I am building a deep learning app, for that I need to import tensorflow and keras libraries in VSC but unfortunately, I couldn't import it though I have installed tensorflow successfully. Also I have checked the package in virtual environment(pip list), it is there. I have tried almost everything but i haven't found the solution.
Error:
Traceback (most recent call last):
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Rupak\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Rupak\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 41, in <module>
from tensorflow.python.tools import module_util as _module_util
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 50, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 69, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Rupak\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Rupak\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Rupak\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
It looks like you are using conda and pip together. It's best to not mix the to, so I would either switch to virtual environments and then try installing again, or stick with conda and install tensorflow using conda itself.
I am not sure whether you had founded this page, but this page seems provides some solutions to your problem. If you didn't find it, you'd better be careful about the information which the outputs provided. As it says: See https://www.tensorflow.org/install/errors
I'm working on YOLO Object detection on darkflow. Importing tensorflow does pop up an error and the error is following below. I've installed CUDA 10.0 and cuDNN 7.5 for 10.0 still got this issue don't know why and i've tried all the possible solutions.
My system is ASUS GL-502VS GTX1070
>import tensorflow as tf
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
>During handling of the above exception, another exception occurred:
>Traceback (most recent call last):
File "", line 1, in
File "C:\Anaconda3\lib\site-packages\tensorflow_init_.py", line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Anaconda3\lib\site-packages\tensorflow\python_init_.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Anaconda3\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Anaconda3\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
Try that before running the script:
export CUDA_HOME=/usr/bin/cuda # or /usr/bin/cuda-10, it depends on your installation
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$CUDA_HOME/lib64
first thing open your cmd(windows) or terminal(Linux) and open up python there and then import tensorflow import tensorflow and then if its get imported and run well than it state that you are having wrong python interpreter set for your project or your current interpreter does not have tensorflow install. then in case please change the interpreter or install tensorflow for that interpreter.
Edit: This seems to be a problem in some versions of Windows. I tried the same in Linux OS and it finally worked.
Inside my virtual environment, I installed tensorflow. Then tried to import it into python, but ImportError.
I've tried ALL hacks available on the internet, but none of them seem to work for me. Please help.
Tried downloading necessary DLLs (in system32 folder)
Tried changing environment path variable
Tried uninstalling and reinstalling Python and tensorflow in various ways
Tried upgrading setup tools
Basic import command
E:\tensor1>myenv\Scripts\activate.bat
(myenv) E:\tensor1>python
>>> import tensorflow
Whatever I try, this error is relentlessly showing up:
Traceback (most recent call last):
File "E:\tensor1\myenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.p
y", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "E:\tensor1\myenv\lib\site-packages\tensorflow\python\pywrap_tensorflow_i
nternal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\tensor1\myenv\lib\site-packages\tensorflow\python\pywrap_tensorflow_i
nternal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\samiam\AppData\Local\Programs\Python\Python37\lib\imp.py", line
242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\samiam\AppData\Local\Programs\Python\Python37\lib\imp.py", line
342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "E:\tensor1\myenv\lib\site-packages\tensorflow\__init__.py", line 28, in
<module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "E:\tensor1\myenv\lib\site-packages\tensorflow\python\__init__.py", line
49, in <module>
from tensorflow.python import pywrap_tensorflow
File "E:\tensor1\myenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.p
y", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "E:\tensor1\myenv\lib\site-packages\tensorflow\python\pywrap_tensorflow.p
y", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "E:\tensor1\myenv\lib\site-packages\tensorflow\python\pywrap_tensorflow_i
nternal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "E:\tensor1\myenv\lib\site-packages\tensorflow\python\pywrap_tensorflow_i
nternal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\samiam\AppData\Local\Programs\Python\Python37\lib\imp.py", line
242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\samiam\AppData\Local\Programs\Python\Python37\lib\imp.py", line
342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: A dynamic link library (DLL) initialization routine failed.
Failed to load the native TensorFlow runtime.
import error tensorflow in python 3.6.0
Failed to load the native TensorFlow runtime.
ImportError: DLL load failed: The specified module could not be found.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\Vignesh\AppData\Local\Programs\Python\Python36\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
>>>
It might be because it is installed as a Python 2 package and you're running Python 3 or the opposite.
To specifically install the package for Python 3, try entering this command:
pip3 install tensorflow
or
python3 -m pip install tensorflow
To specifically install the package for Python 2, try entering this command:
pip2 install tensorflow
or
python -m pip install tensorflow
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/init.py", line 61, in
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.4/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
ImportError: /opt/Xilinx/Vivado/2015.1/lib/lnx64.o/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by /usr/local/lib/python3.4/dist-packages/tensorflow/python/_pywrap_tensorflow.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "image_resize.py", line 10, in
import tensorflow as tf
File "/usr/local/lib/python3.4/dist-packages/tensorflow/init.py", line 24, in
from tensorflow.python import *
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/init.py", line 72, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/init.py", line 61, in
from tensorflow.python import pywrap_tensorflow
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in
_pywrap_tensorflow = swig_import_helper()
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
File "/usr/lib/python3.4/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
ImportError: /opt/Xilinx/Vivado/2015.1/lib/lnx64.o/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by /usr/local/lib/python3.4/dist-packages/tensorflow/python/_pywrap_tensorflow.so)
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.
i am using ubuntu 14.4
and python version 3.4
It looks like you installed Xilinx which includes an older version of libstdc++. If you remove it from your LD_LIBRARY_PATH, that should solve the issue.
I'm using Ubuntu 14.4 with python 3.5. I run the following and the python3 shell imported tensorflow perfectly fine.
sudo -H pip3 install tensorflow