I am getting below error while doing from keras.models import Sequential
~\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py
in
81 for some common reasons and solutions. Include the entire stack trace
82 above this error message when asking for help.""" % traceback.format_exc()
---> 83 raise ImportError(msg)
84
85 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-long
ImportError: Traceback (most recent call last): File
"C:\Users\joe\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 64, in
from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
Here is the result of pip freeze
alabaster==0.7.12
anaconda-client==1.7.2
anaconda-navigator==1.9.12
anaconda-project==0.8.3
....
conda==4.9.2
conda-build==3.18.11
Keras==2.3.1
Keras-Applications # file:///tmp/build/80754af9/keras-applications_1594366238411/work
Keras-Preprocessing==1.1.2
tensorflow==2.3.1
tensorflow-estimator==2.3.0
Per answer at Failed to load the native TensorFlow runtime. Python 3.5.2 I tried below
conda create -n gpu_env tensorflow-gpu
conda activate gpu_env
Which gives below result on pip freeze
jupyter-core==4.6.3
Keras-Applications # file:///tmp/build/80754af9/keras-applications_1594366238411/work
Keras-Preprocessing==1.1.0
tensorflow==2.1.0
tensorflow-estimator==2.1.0
termcolor==1.1.0
But when I open the jupyter notebook and execute the program get the same error.Not sure what's the issue here ?
I was able to solve this with
pip uninstall tensorflow
pip install tensorflow==1.15
you are using Anaconda it will support
Tensorflow == 2.1.0
Keras == 2.3.1
create a new environment for tensorflow
conda create -n tf tensorflow
activate tf
then install keras
pip install keras==2.3.1
Related
I am following a Real time object detection on https://automaticaddison.com/real-time-object-recognition-using-a-webcam-and-deep-learning/#top and I have hit a road block I followed all the instructions and checked for any errors but still got this error
(I am using windows)
Traceback (most recent call last): File "object_detection_test.py",
line 15, in <module>
from utils import label_map_util File "C:\Users\1rock\Documents\TensorFlow\models\research\object_detection\utils\label_map_util.py",
line 27, in <module>
import tensorflow.compat.v1 as tf ModuleNotFoundError: No module named 'tensorflow.compat.v1'
I used pip install --ignore-installed --upgrade tensorflow==1.9 just what the link above said and whilst running I got these packages and their versions and an error hope it would be relevant to the question
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
ipywidgets 7.6.0 requires jupyterlab-widgets>=1.0.0, which is not installed.
Successfully installed absl-py-0.11.0 astor-0.8.1 gast-0.4.0 grpcio-1.34.0 importlib-metadata-3.3.0 markdown-3.3.3 numpy-1.19.4 protobuf-3.14.0 setuptools-51.0.0.post20201207 six-1.15.0 tensorboard-1.9.0 tensorflow-1.9.0 termcolor-1.1.0 typing-extensions-3.7.4.3 werkzeug-1.0.1 wheel-0.36.2 zipp-3.4.0
I used pip install --ignore-installed --upgrade tensorflow==1.9
line 27, in
import tensorflow.compat.v1 as tf ModuleNotFoundError: No module named 'tensorflow.compat.v1'
TF 1.9 and earlier do not have compat module. To use it you need TF 1.10+. Its better to use conda install everywhere possible with conda virtual enviroment.
Also since you are using tensorflow models make sure you has corresponding version of repository, for example latest TF1.x version located here
I am trying to import tensorflow but every time i do import tensorflow i get this annoying error it says
"Failed to load the native TensorFlow runtime." i have looked my error into
https://www.tensorflow.org/install/errors but i did not find my answer yet i probably missed it But....
My error:
ImportError: Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 64, in <module>
from tensorflow.python._pywrap_tensorflow_internal import *
ImportError: DLL load failed: The specified module could not be found.
I used pip install tensorflow also if i do pip install tensorflow in my console i get "Requirement already satisfied: tensorflow in c:\programdata\anaconda3\lib\site-packages (2.3.1)"
but when i do import tensorflow i get my Import Error
also my pip version is 20.2.4
you are using Anaconda it will support
Tensorflow == 2.1.0
create a new environment for tensorflow
conda create -n tf tensorflow
activate tf
I figured how to do it for me i just needed to do:
pip install tensorflow==1.15
I"m going through this tutorial to set up pytorch (v1.3.0 through conda) with tensorboard https://pytorch.org/tutorials/intermediate/tensorboard_tutorial.html#
but on the step
from torch.utils.tensorboard import SummaryWriter
# default `log_dir` is "runs" - we'll be more specific here
writer = SummaryWriter('runs/fashion_mnist_experiment_1')
I keep getting the error
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
C:\ProgramData\Anaconda3\envs\fastai_v1\lib\site-packages\torch\utils\tensorboard\__init__.py in
1 try:
----> 2 from tensorboard.summary.writer.record_writer import RecordWriter # noqa F401
3 except ImportError:
ModuleNotFoundError: No module named 'tensorboard.summary'; 'tensorboard' is not a package
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
c:\Users\matt\Documents\code\playground\tensorboard.py in
----> 1 from torch.utils.tensorboard import SummaryWriter
2
3 # default `log_dir` is "runs" - we'll be more specific here
4 writer = SummaryWriter('runs/fashion_mnist_experiment_1')
C:\ProgramData\Anaconda3\envs\fastai_v1\lib\site-packages\torch\utils\tensorboard\__init__.py in
2 from tensorboard.summary.writer.record_writer import RecordWriter # noqa F401
3 except ImportError:
----> 4 raise ImportError('TensorBoard logging requires TensorBoard with Python summary writer installed. '
5 'This should be available in 1.14 or above.')
6 from .writer import FileWriter, SummaryWriter # noqa F401
ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed. This should be available in 1.14 or above.
Does anyone have any suggestions?
The error log says, among other things,
ImportError: TensorBoard logging requires TensorBoard with Python summary writer installed. This should be available in 1.14 or above.
So, when it tries to import TensorBoard, it's unable to do so because it's missing it in the search path. You can install the latest version (without specifying any version number), as in:
$ conda install -c conda-forge tensorboard
Apart from that, you might also need to install protobuf:
$ conda install -c conda-forge protobuf
These installations should fix the ImportErrors.
I came across the same error, I solved by taking the following steps:
Removed all installation of Tensorflow or Tensorboard from the conda environment.
Then by activating the same conda environment, type "pip install -U tb-nightly"
Then type, "pip install -U future"
done
I think it's a version problem.
just run this:
pip install tensorboard==1.14.0
(not pip install tensorboard==1.14)
or just install the tensoflow 1.14.0, which contains the tensorboard 1.14.0:
pip install tensorflow==1.14.0
This version of tensorflow worked for me in pytorch 1.2.
I've done:
conda install -y tensorboard
before with no problems, so Im not sure why that wouldn't work. It's the simplest.
I met the same error, and my conda also didn't work that time, so I chose to use tensorboardX, it is almost absolutely the same as tensorboard(also its operations).
Just install it with pip install tensorboardX
And you can import it with from tensorboardX import SummaryWriter
I want to use tensorflow.js for browser. When I installed tf.js on my system (Windows 10 64-bit, Pycharm community 2019.1) using conda virtual env, the following error occurs:
(tjfs) A:\modakatech\tjfs>tensorflowjs_converter --version
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
ImportError: numpy.core.multiarray failed to import
The above exception was the direct cause of the following exception:
Traceback (most recent call last):File "<frozen importlib._bootstrap>",
line 980, in _find_and_load SystemError:
<class'_frozen_importlib._ModuleLockManager'> returned a result with an
error set ImportError: numpy.core._multiarray_umath failed to import
ImportError: numpy.core.umath failed to import
2019-06-03 10:49:29.186367: F tensorflow/python/lib/core/bfloat16.cc:675]
Check failed: PyBfloat16_Type.tp_base != nullptr
tensorflow.js installation requires package numpy==1.15.1, keras and more.
I have tried to upgrade numpy to latest version but tensorflow.js showing that numpy version should be numpy==1.15.1. My current version of numpy is 1.16 which is incompatible.
Pycharm Error->ERROR: tensorflowjs 1.1.2 has requirement numpy==1.15.1, but you'll have
numpy 1.16.4 which is incompatible.
You should uninstall your numpy
pip uninstall numpy
and install the proper version
pip install numpy==1.15.1
Edit:
If you are using conda - To uninstall use:
conda remove -n *your_env_name* numpy
To install specific version:
conda install -n *your_env_name* numpy=1.15.1
the program can be downloaded from:
The error:
Traceback (most recent call last):
File "/home/imatrix/download/ chrisruk/cnn-master/train_cnn.py", line 7, in import tflearn
File "/usr/local/lib/python2.7/dist-packages/tflearn/init.py",
line 21, in from .layers import normalization File
"/usr/local/lib/python2.7/dist-packages/tflearn/layers/init.py",
line 10, in from .recurrent import lstm, gru, simple_rnn,
bidirectional_rnn, \ File
"/usr/local/lib/python2.7/dist-packages/tflearn/layers/recurrent.py",
line 8, in ImportError: No module named core_rnn
Assuming Tf 0.12 onwards these have been moved to:
tf.contrib.rnn [followed by whichever core_rnn. you need ]
Most probably the error is because of incompatible versions of tflearn and tensorflow. (Probably you have updated tflearn, but didn't update tensorflow).
Try remove tensorflow and tflearn packages and install the latest version:
pip uninstall tflearn
pip uninstall tensorflow
pip install -I tensorflow
pip install -I tflearn
Or if you don't want to use tensorflow v1.0 then install older versions of both packages:
pip uninstall tflearn
pip uninstall tensorflow
pip install -I tensorflow==0.12.1
pip install -I tflearn==0.2.1