ModuleNotFoundError: No module named 'tensorflow' how to fix this? - machine-learning

*i got this problem on anaconda 3 and i install keras and i want to use tensorflow with keras , and not theano okay and when i import keras got this error can anybody help my with that *
Using TensorFlow backend.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-c74e2bd4ca71> in <module>()
----> 1 import keras
C:\Users\LibnT\Anaconda3\lib\site-packages\keras\__init__.py in <module>()
1 from __future__ import absolute_import
2
----> 3 from . import activations
4 from . import applications
5 from . import backend
C:\Users\LibnT\Anaconda3\lib\site-packages\keras\activations.py in <module>()
1 from __future__ import absolute_import
2 import six
----> 3 from . import backend as K
4 from .utils.generic_utils import deserialize_keras_object
5
C:\Users\LibnT\Anaconda3\lib\site-packages\keras\backend\__init__.py in <module>()
62 elif _BACKEND == 'tensorflow':
63 sys.stderr.write('Using TensorFlow backend.\n')
---> 64 from .tensorflow_backend import *
65 else:
66 raise ValueError('Unknown backend: ' + str(_BACKEND))
C:\Users\LibnT\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py in <module>()
----> 1 import tensorflow as tf
2 from tensorflow.python.training import moving_averages
3 from tensorflow.python.ops import tensor_array_ops
4 from tensorflow.python.ops import control_flow_ops
5 from tensorflow.python.ops import functional_ops
ModuleNotFoundError: No module named 'tensorflow'

Related

ImportError: cannot import name 'is_directory'

I've been trying to read pdf pages as an image, for extraction purposes.
I found that layoutparser serves this purpose by identifying blocks of text. However, when I try to Create a Detectron2-based Layout Detection Model, I encounter the following:
import layoutparser as lp
model = lp.Detectron2LayoutModel( config_path ='lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config',
extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.65],
label_map={0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"})
Error: [enter image description here][1]
ImportError Traceback (most recent
call last)
<ipython-input-16-eab7187a31c8> in <module>()
1 import layoutparser as lp
----> 2 model = lp.Detectron2LayoutModel( config_path ='lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config',
3 extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.65],
4 label_map={0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"})
5 layout = model.detect(image) # You need to load the image somewhere else, e.g., image = cv2.imread(...)
31 frames
/usr/local/lib/python3.7/dist-packages/PIL/ImageFont.py in <module>()
35 from . import Image
36 from ._deprecate import deprecate
---> 37 from ._util import is_directory, is_path
38
39
ImportError: cannot import name 'is_directory' from 'PIL._util' (/usr/local/lib/python3.7/dist-packages/PIL/_util.py)
I tried with pillow version <=6.2.2. It worked for me.
You might have installed a higher version of pillow. Try the following command to downgrade the pillow package. You should install pillow version less than or equal to 6.2.2.
pip install --upgrade pillow==6.2.2
You can simply install detectron2 from github :
!pip install 'git+https://github.com/facebookresearch/detectron2.git#v0.4#egg=detectron2'

lazypredict.Supervised.LazyClassifier. ImportError: Cannot import name '_raise_dep_warning_if_not_pytest' from 'sklearn.utils.deprecation'

I tried:
from lazypredict.Supervised import LazyClassifier
But got the following traceback:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-f518cae57501> in <module>
10 from sklearn.linear_model import LogisticRegression
11 from sklearn.ensemble import RandomForestClassifier
---> 12 from lazypredict.Supervised import LazyClassifier
13 from sklearn.model_selection import GridSearchCV
14 from sklearn.metrics import accuracy_score
~\AppData\Roaming\Python\Python38\site-packages\lazypredict\Supervised.py in <module>
14 from sklearn.preprocessing import StandardScaler, OneHotEncoder, OrdinalEncoder
15 from sklearn.compose import ColumnTransformer
---> 16 from sklearn.utils.testing import all_estimators
17 from sklearn.base import RegressorMixin
18 from sklearn.base import ClassifierMixin
S:\anaconda\lib\site-packages\sklearn\utils\testing.py in <module>
5 from . import _testing # type: ignore
6 from ..externals._pep562 import Pep562
----> 7 from ..utils.deprecation import _raise_dep_warning_if_not_pytest
8
9 deprecated_path = 'sklearn.utils.testing'
ImportError: cannot import name '_raise_dep_warning_if_not_pytest' from 'sklearn.utils.deprecation' (S:\anaconda\lib\site-packages\sklearn\utils\deprecation.py)
I was working in a Jupyter notebook, and have already tried upgrading scikit-learn too.
This is most likely caused by incompatible versions of lazypredict and scikit-learn. Per the current LazyPredict requirements file, it needs scikit-learn==0.23.1.
This should be fixed with:
pip uninstall scikit-learn -y
pip install scikit-learn==0.23.1
In case it helps someone else, the above solution to install scikit-learn version 0.23.1 didn't work for me. I'm using Anaconda and did conda update --all and then ran conda install scikit-learn-intelex and the import worked for me afterwards.
my error was resolved by doing this:
!pip uninstall scikit-learn -y
!pip install scikit-learn==0.24

ModuleNotFoundError: No module named 'py2neo'

Following error occurs when following Neo4j online training for Data Science.
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-993ba54a3148> in <module>()
1 from py2neo import Graph
2 import pandas as pd
3 import matplotlib
4 import matplotlib.pyplot as plt
5
ModuleNotFoundError: No module named 'py2neo'
you probably skipped the first notebook:
!pip install py2neo==4.1.3 pandas matplotlib sklearn
should help you out.
You can just do
pip install py2neo
This worked for me

Import error geopandas, fiona

I have an error with import geopandas, fiona.
When I'm trying to import geopandas
import geopandas as gpd
It returns me
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-8-77a0d94ee2c6> in <module>()
5 #ret = add(1,3)
6 #print(ret)
----> 7 import geopandas as gpd
~\Anaconda3\lib\site-packages\geopandas\__init__.py in <module>()
2 from geopandas.geodataframe import GeoDataFrame
3
----> 4 from geopandas.io.file import read_file
5 from geopandas.io.sql import read_postgis
6 from geopandas.tools import sjoin
~\Anaconda3\lib\site-packages\geopandas\io\file.py in <module>()
1 import os
2
----> 3 import fiona
4 import numpy as np
5 import six
~\Anaconda3\lib\site-packages\fiona\__init__.py in <module>()
67 from six import string_types
68
---> 69 from fiona.collection import Collection, BytesCollection, vsi_path
70 from fiona._drivers import driver_count, GDALEnv
71 from fiona.drvsupport import supported_drivers
~\Anaconda3\lib\site-packages\fiona\collection.py in <module>()
7
8 from fiona import compat
----> 9 from fiona.ogrext import Iterator, ItemsIterator, KeysIterator
10 from fiona.ogrext import Session, WritingSession
11 from fiona.ogrext import (
ImportError: DLL load failed: The specified module could not be found.
I used "conda install -c conda-forge geopandas" and found that geopandas is installed on C:\Users\Kim\Anaconda3(by "conda list" in anaconda prompt ). But when I typed
import sys
'geopandas' in sys.modules
It has returned me "False"
I thought reinstalling anaconda could help me but it wasn't.
Is anyone has solved this problem?
FYI, I'm using windows 10 64bit
I had same problem and following commands help me.
First of all I added conda channels (last channel has highest priority).
conda config --add channels conda-forge
conda config --add channels anaconda
Then try to create new environment using conda.
conda create -n geoPython3 python=3.6 geopandas=0.4.0 gdal=2.2.4
Let me know if it helps.

How install utils on colab?

How manually install util on google colab?
!pip install web.py==0.40.dev0
import utils
Error
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-13-a4c82eaa1619> in <module>()
20 import torch.backends.cudnn
21 get_ipython().system('pip install web.py==0.40.dev0')
---> 22 from Utils import *
23 from PIL import Image
24 from torch import nn
ModuleNotFoundError: No module named 'Utils'
---------------------------------------------------------------------------
How to correct this mistake correctly?
try change to !pip install python-utils but
Installing collected packages: python-utils
**Successfully installed python-utils-2.3.0**
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-e6796b5aa862> in <module>()
20 import torch.backends.cudnn
21 get_ipython().system('pip install python-utils')
---> 22 import utils
23 from PIL import Image
24 from torch import nn
ModuleNotFoundError: **No module named 'utils'**
please try this if this may help in your code
!install pip
!pip install utils
import utils

Resources