importing gnuradio while using pycharm on ubuntu - python

I would like to make calls from python to blocks in gnuradio 3.8 from PyCharm CE 2019.2 on Ubuntu 18.04. The project interpreter set in Pycharm is the virtual environment created when the pycharm project was created. I have seen suggestions (How do I import modules in pycharm?) to add a line like:
/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages
to the interpreter path (under File->Settings->Project:my_proj->Project Interpreter->Gear Symbol->Show All->Show Paths for Selected Interpreter).
From the python console, this results in the following error when I attempt to import gnuradio blocks:
PyDev console: starting.
Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
import gnuradio
from gnuradio import blocks
Traceback (most recent call last):
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/blocks_swig0.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: libgnuradio-blocks.so.3.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/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/__init__.py", line 32, in <module>
from .blocks_swig import *
File "/snap/pycharm-community/167/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/blocks_swig.py", line 24, in <module>
from .blocks_swig0 import *
File "/snap/pycharm-community/167/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/blocks_swig0.py", line 17, in <module>
_blocks_swig0 = swig_import_helper()
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/blocks_swig0.py", line 16, in swig_import_helper
return importlib.import_module('_blocks_swig0')
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_blocks_swig0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/blocks_swig0.py", line 14, in swig_import_helper
return importlib.import_module(mname)
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 658, in _load_unlocked
File "<frozen importlib._bootstrap>", line 571, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 922, in create_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
ImportError: libgnuradio-blocks.so.3.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 "<input>", line 1, in <module>
File "/snap/pycharm-community/167/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/__init__.py", line 36, in <module>
from .blocks_swig import *
File "/snap/pycharm-community/167/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/blocks_swig.py", line 24, in <module>
from .blocks_swig0 import *
File "/snap/pycharm-community/167/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/blocks_swig0.py", line 17, in <module>
_blocks_swig0 = swig_import_helper()
File "/home/my_name/devel/gnuradio3_8/lib/python3.6/dist-packages/gnuradio/blocks/blocks_swig0.py", line 16, in swig_import_helper
return importlib.import_module('_blocks_swig0')
File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_blocks_swig0'
I believe that I have libgnuradio installed:
~/devel/gnuradio3_8/lib$ ls
cmake libgnuradio-qtgui.so.3.8.0
libgnuradio-analog.so libgnuradio-qtgui.so.3.8.0.0
libgnuradio-analog.so.3.8.0 libgnuradio-runtime.so
libgnuradio-analog.so.3.8.0.0 libgnuradio-runtime.so.3.8.0
libgnuradio-audio.so libgnuradio-runtime.so.3.8.0.0
libgnuradio-audio.so.3.8.0 libgnuradio-trellis.so
libgnuradio-audio.so.3.8.0.0 libgnuradio-trellis.so.3.8.0
libgnuradio-blocks.so libgnuradio-trellis.so.3.8.0.0
libgnuradio-blocks.so.3.8.0 libgnuradio-uhd.so
libgnuradio-blocks.so.3.8.0.0 libgnuradio-uhd.so.3.8.0
libgnuradio-channels.so libgnuradio-uhd.so.3.8.0.0
libgnuradio-channels.so.3.8.0 libgnuradio-utilities.so
libgnuradio-channels.so.3.8.0.0 libgnuradio-utilities.so.1.0.0git
libgnuradio-digital.so libgnuradio-utilities.so.v1.0-compat-xxx-xunknown
libgnuradio-digital.so.3.8.0 libgnuradio-vocoder.so
libgnuradio-digital.so.3.8.0.0 libgnuradio-vocoder.so.3.8.0
libgnuradio-dtv.so libgnuradio-vocoder.so.3.8.0.0
libgnuradio-dtv.so.3.8.0 libgnuradio-wavelet.so
libgnuradio-dtv.so.3.8.0.0 libgnuradio-wavelet.so.3.8.0
libgnuradio-fec.so libgnuradio-wavelet.so.3.8.0.0
libgnuradio-fec.so.3.8.0 libgnuradio-zeromq.so
libgnuradio-fec.so.3.8.0.0 libgnuradio-zeromq.so.3.8.0
libgnuradio-fft.so libgnuradio-zeromq.so.3.8.0.0
libgnuradio-fft.so.3.8.0 libuhd.so
libgnuradio-fft.so.3.8.0.0 libuhd.so.3.14.1
libgnuradio-filter.so libvolk.so
libgnuradio-filter.so.3.8.0 libvolk.so.2.0
libgnuradio-filter.so.3.8.0.0 pkgconfig
libgnuradio-pmt.so python2.7
libgnuradio-pmt.so.3.8.0 python3
libgnuradio-pmt.so.3.8.0.0 python3.6
libgnuradio-qtgui.so uhd
What is the right way to import gnuradio?

ImportError: libgnuradio-blocks.so.3.8.0: cannot open shared object file: No such file or directory
Yes. I have gnuradio3.7 in the usual place and 3.8 is here under my home directory
You need to add the path were you've installed gnuradio libs (~/devel/gnuradio3_8/lib) to the LD_LIBRARY_PATH environment variable.
I'm not familiar with pycharm but from your terminal you could execute
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/devel/gnuradio3_8/lib
and then start pycharm from the same terminal or add the same to your ~/.bash_profile
In case you've installed gnuradio using pybombs there will be A setup_env.sh script in ~/devel/gnuradio3_8 that you could source from the terminal
$ source setup_env.sh

Related

Installing tensorflow-GPU on Windows 10

Since December, I am trying to install it and facing no result, I have to ask help...
So I tried many many things.
I am under Windows 10 64.bit
Python 3.6.3
Anaconda3 5.0.1 pour windows x86_64
Nvidia 970 GTX
My current Nvidia CUDA version is 8.0 + Cudnn ( by reading many posts is looked the working setup )
From there I do that in command prompt:
-conda create -n tensorflow-gpu python=3.5.2 ( I have tried also 3.6.3 )
-activate tensorflow-gpu
-pip install tensorflow-gpu
-activate tensorflow-gpu
-Python
-import tensorflow as tf
And the result is
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Le module spécifié est introuvable.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 72, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Le module spécifié est introuvable.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\tanit\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
Failed to load the native TensorFlow runtime.
Any help is welcome

I tried to do tensorflow , but some errors occured

Anyone, please help me.
My environment is Windows10,Anaconda4.4.0,Python 3.5.4.
I installed Tensorflow and
import tensorflow as tf
typed this code.
But,
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Anaconda3\envs\tf1\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 938, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: 指定されたモジュールが見つかりません。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Anaconda3\envs\tf1\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Anaconda3\envs\tf1\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 938, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: 指定されたモジュールが見つかりません。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\envs\tf1\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Anaconda3\envs\tf1\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
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.
I saw a lot of sites,and tried a lot of things to do this.
These are all that I checked.
Fitst, cublas64_80.dll,nvblas64_80.dll,cudnn64_5.dll are ilocated in
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin
And, this location are set as "PATH".
What should I do? Please help me.
Thank you.
I'd bet you have installed Tensor-flow is a different Python virtual environment.
To resolve:
* Open a Conda terminal
* Open AnacondaNavigator
* Environment tab
* Green arrow by environment name
* Open terminal
In terminal hit> "conda install -c conda-forge tensorflow"
Watch it install, close terminal, reopen your Notebook, and It should work.

Can't import tensorflow on windows 7

EDIT: After user1735003's comment on how the tensforflow documentation explicitly states that it supports only Python 3.5.x on Windows, I removed the earlier 3.6.2 version and installed 3.5.2 isntead. I get the same error, though.
I have a Windows 7 professional x64, using Python 3.5.2. When I try to import tensorflow, I get the follwoing error:
Traceback (most recent call last):
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_int
ernal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
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 "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py"
, line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_int
ernal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_int
ernal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <m
odule>
from tensorflow.python import *
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 49
, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py"
, line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_int
ernal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
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 "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py"
, line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_int
ernal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_int
ernal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
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.
Python installed at: C:\Users\Ritwik\AppData\Local\Programs\Python\Python35\python.exe
I've installed tensorflow using pip as suggested in the documentation.
pip3 install --upgrade tensorflow
I don't have an NVIDIA GPU.
From the documentation:
TensorFlow only supports version 3.5.x of Python on Windows.
EDIT
See a generic answer here for _pywrap_tensorflow_internal errors.

import tensorflow generates error for tensorflow-gpu

I've installed all the necessary GPU drives / cudNN etc. and made all the configurations necessary by following the instructions from the official Tensorflow page, but when trying to import tensorflow I get the following error trace.
I do want to mention that I have looked at the common problems section at the bottom of the official TF install page, which says that I should install / reinstall Visual C++ 2015 redistributable (x64 version), and I made sure it's part of PATH system environment variable, but still I get errors.
By the way, I'm using Python 3.5.3.
`import tensorflow as tf`
Traceback (most recent call last): File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname) File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 666, in _load_unlocked File "<frozen importlib._bootstrap>", line 577, in module_from_spec File "<frozen importlib._bootstrap_external>", line 906, in create_module File "<frozen importlib._bootstrap>", line 222, in
_call_with_frames_removed 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 "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal') File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import * File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname) File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 666, in _load_unlocked File "<frozen importlib._bootstrap>", line 577, in module_from_spec File "<frozen importlib._bootstrap_external>", line 906, in create_module File "<frozen importlib._bootstrap>", line 222, in
_call_with_frames_removed 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 "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal') File "C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named '_pywrap_tensorflow_internal'
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.
If I try and install Tensorflow for CPU it works without any problems.
Update:
I've checked my %PATH% environment variable and the files are specified:
(C:\Users\radu.gheorghiu\AppData\Local\Continuum\Anaconda3\envs\tflow) C:\Users\radu.gheorghiu\AnacondaProjects>echo %path%
...
F:\gpuDrivers\cuda\bin\cudnn64_6.dll;
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Remote Debugger\x64\msvcp140.dll
Maybe am I not referencing to the correct msvcp140.dll?

Can't run sample code of tensorflow-gpu

I'm trying to install tensorflow-gpu, I follow the instruction at
https://nitishmutha.github.io/tensorflow/2017/01/22/TensorFlow-with-gpu-for-windows.html
everything seems work fine until i import tensorflow
Here is my computer configure:
Windows10
Anaconda 3.4.1.1
Python 3.5.2
Nvidia driver 381.90
Nvidia Gpu Computing Toolkit v8.0
cudnn 8.0
I'm trying to solve it for hours, can anyone give me some hints. Thank you very much
C:\Users\kaich>activate tensorflow-gpu
(tensorflow-gpu) C:\Users\kaich>python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: 找不到指定的模組。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\__init__.py", line 51, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: 找不到指定的模組。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Users\kaich\Anaconda3\envs\tensorflow-gpu\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
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.
After giving activate tensorflow-gpu execute the following command in the shell.
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl

Categories