When I try to install pydot it says that I have already installed it.
But whenever I try to import it I get an error saying :
Failed to import pydot. You must install pydot and graphviz for pydotprint to work.
This is my code:
model.summary()
import pydot
from keras.utils import plot_model
plot_model(model, to_file='model.png')
I am using python 3.6.3 on jupyter notebook.
download the msi version of graphviz from >http://www.graphviz.org/Download_windows.php
add C:\Program Files (x86)\Graphviz2.38\bin to my system variables in PATH
Related
I'm trying to import imageai
from imageai.Detection import VideoObjectDetection
but get error message below
ModuleNotFoundError: No module named 'keras.layers.advanced_activations'
My tensorflow version 2.9.1,
keras version 2.9.0,
keras-preprocessing version 1.1.2,
image ai version 2.1.5,
I installed the imageai via pip install imageai-2.0.2-py3-none-any.whl and download from here.
The following code is an example for calling several types of advanced activation, Try to call it by
from keras.layers import ELU, PReLU, LeakyReLU
The import works with keras version 2.9.0 as below.
from keras.layers import LeakyReLU
I encountered the same error today. Downgrading my keras to 2.1.0 and tensorflow to 2.2.0 got rid of the error.
I faced the same error. ModuleNotFoundError: No module named 'keras.layers.advanced_activations'
To solve this problem:
Try to install TensorFlow 2.8.2 which is compatible with Keras 2.8.0
pip install tensorflow==2.8.2
Please install imageai using this link or use below code as you must install few libraries before installing imageai.
pip install cython pillow>=7.0.0 numpy>=1.18.1 opencv-python>=4.1.2 torch>=1.9.0 --extra-index-url https://download.pytorch.org/whl/cpu torchvision>=0.10.0 --extra-index-url https://download.pytorch.org/whl/cpu pytest==7.1.3 tqdm==4.64.1 scipy>=1.7.3 matplotlib>=3.4.3 mock==4.0.3
pip install imageai --upgrade
then import VideoObjectDetection as below:
from imageai.Detection import VideoObjectDetection
I am trying to run MPL Neural Network using the scikit-learn library running on Jupyter Notebook. However, I have been trying to import the MPLClassifier but failed. I also have tried solution from here, SKlearn import MLPClassifier fails. I followed the steps and installed everything but could not import the module from SKlearn which are,
Installed the SKlearn using pip install scikit-neuralnetwork
Installed the mingw package using conda install mingw libpython and conda install -c free mingw, as the package is not available when using https://jmeubank.github.io/tdm-gcc/
Checked its availability using conda list
It is giving the following error,
cannot import name 'MPLClassifier' from 'sklearn.neural_network'
May I get help on other alternatives to import the module?
I want to run tensorflow for image recognition. I have followed all the steps for it and both keras and tensorflow are installed on my computer.
Steps in this post: https://github.com/OlafenwaMoses/ImageAI/
But when I try:
from imageai.Prediction import ImagePrediction
I keep getting the error:
from tensorflow.python.keras.preprocessing import image
ModuleNotFoundError: No module named 'tensorflow.python.keras'
I think the error comes from my installation of 'tensorflow'. When I tried the method:
pip3 install --upgrade tensorflow
I got the error:
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow
So I used instead:
python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
I got it from this post: TensorFlow not found using pip
My guess is that the first error drives me to the second, but I don't know how to fix any of them.
Any suggestions?
My code until the problem is:
import tensorflow
from imageai.Prediction import ImagePrediction
Try writing
from keras.preprocessing import image
Instead of
from tensorflow.python.keras.preprocessing import image
And do the same with all Keras calls.
Make sure you have the latest version of tensorflow (2.0)
import tensorflow as tf
print(tf.__version__)
from tensorflow.keras.preprocessessing.text import Tokenizer
I'm trying plot my model on the google colab.
from keras.utils import plot_model
plot_model(model, to_file="model.png")
and I got this error:
ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
I've installed pydot-ng and graphviz and I'm still can't get through this error.
To install pydot, run:
!pip install -q pydot
Then, restart your VM to reload keras which should then detect pydot's existence. (Runtime menu -> Restart runtime...)
I'm trying to use tensorflow-gpu. Using Anaconda, I installed the libraries and active both (tensorflow and tensorflow-gpu) I have also installed Keras in this anaconda environment as well
Next I launch Spider IDE within my Anaconda environment and run my py script, that is when I get the following error:
cannot import tensorflow - Import Error: cannot import name 'self_check'
I'm totally lost. Any recommendations?
Using Python 3.5
Thanks
pip install --upgrade tensorflow
or
you can uninstall the tensorflow and re-install it.