How to fix "using tensorflow backend" Keras import error? - python

I am currently starting Deep Learning with Keras. After I create a new Python file on Jupyter Notebook, I import Keras, only to find an error to appear. The error only occurs while importing Keras (As far as I know) and there is no error when I am importing other libraries such as numpy and pandas. Please help me fix this issue.
I have tried updating tensorflow, updating keras, using some code from other answers on Stack Overflow, but all was unsuccessful. I am currently trying "conda install -c conda-forge tensorflow=1.12.0", but it is taking quite some time to run.
from keras.models import Sequential
from keras.layers import Dense
import numpy
Using TensorFlow backend.
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
ImportError: numpy.core.multiarray failed to import
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
ImportError: numpy.core.umath failed to import
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
ImportError: numpy.core.umath failed to import

Related

Python - Anaconda - ModuleNotFoundError: No module named 'graphlab'

I try to run the following command on a jupyter notebook:
import graphlab
and I get the following error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_11156\3500426333.py in <module>
----> 1 import graphlab
ModuleNotFoundError: No module named 'graphlab'
Any ideas how I can fix this error?

How can I solve the error of importing numpy in Jupyterlab?

While I was trying to import numpy in JupyterLab, I am getting this error :
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_13388/3593848235.py in <module>
----> 1 import numpy as np
ModuleNotFoundError: No module named 'numpy'
Do you have any idea how I can solve this problem?
Thanks

DataFrameSelector in sklearn_features.transformers

Is the DataFrameSelector in sklearn_features.transformers the only one? Or are there more?
I am getting the following error on running the following code in the Jupyter notebook.-
from sklearn_features.transformers import DataFrameSelector
ModuleNotFoundError Traceback (most recent call
last) in
----> 1 from sklearn_features.transformers import DataFrameSelector
ModuleNotFoundError: No module named 'sklearn_features
You need to install it before importing. It is not present in your python path
Try in a cell before the following command:
!pip install sklearn_features
and then
from sklearn_features.transformers import DataFrameSelector
Example from colab

Getting error "Failed to load the native TensorFlow runtime"

I am trying to import tensorflow an keras with following code.
import tensorflow as tf
import numpy as np
from tensorflow import keras
I am getting the following error.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~\anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in <module>
63 try:
---> 64 from tensorflow.python._pywrap_tensorflow_internal import *
65 # This try catch logic is because there is no bazel equivalent for py_extension.
ImportError: DLL load failed: The specified module could not be found.
ImportError: Traceback (most recent call last):
File "C:\Users\User\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.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
Please help me with useful solutions. I have tried to solve with updates pip, python, and tensorflow versions. Still it is not working.

Missing pkg_resources.py31compat

I tried to set up a virtualenv and I have setuptools (39.0.1). And I got
In [1]: import pkg_resources.py31compat
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-136e80f945a9> in <module>()
----> 1 import pkg_resources.py31compat
ImportError: No module named py31compat
I read elsewhere that installing the latest setuptools should fix this. But apparently, it didn't work.
Please help.
(additional info in comments)

Categories

Resources