ImportError: No module named downsample - python

I am using Theano. The OS is Ubuntu. The Theano is UPTODATE. I am wondering why I am getting by from theano.tensor.signal.downsample import max_pool_2d command.
ImportError: No module named downsample.

update theano and lasagne
pip install --upgrade https://github.com/Theano/Theano/archive/master.zip
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip
Lasagne vs Theano possible version mismatch (Windows)

The downsample module has been moved to pool, so try declaring it as:
from theano.tensor.signal.pool import pool_2d
After changing delete your theano cache with the command:
theano-cache purge

Try to update the Theano using this link.
pip install --upgrade https://github.com/Lasagne/Lasagne/archive/master.zip

Same issue [theano v.0.9.0dev1.dev-2...]; changed
from theano.tensor.signal import downsample
pooled_out = downsample.max_pool_2d( ... )
to
from theano.tensor.signal import pool
pooled_out = pool.pool_2d( ... )
in /lib/python2.7/site-packages/lasagne/layers/pool.py

Related

How to fix "ModuleNotFoundError: No module named 'keras.layers.advanced_activations' "

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

Cannot import umap: cannot import name 'structref' from 'numba.experimental'

I tried to import umap in my jupyter notebook but had the following error:
ImportError: cannot import name 'structref' from 'numba.experimental' (C:\Users\name\Anaconda3\lib\site-packages\numba\experimental\__init__.py)
I tried to update conda but doesn't work. What can I do ?
The numba.experimental subpackage was added in version 0.51.0. You can check your version of number using:
import numba
numba.__version__
If it is less then 0.51.0, you will need to install a newer version.
conda install numba=0.51.*

How do I import 'umap' package in python?

After install 'umap' package, I can't import
I tried reinstall pre version (1.3.10, 1.4.0rc1).
But, It's not working
How can I do?
!pip3 install umap-learn
!pip3 install umap-learn[plot]
import umap
This is the error I get:
No module named 'umap'
you probably confused umap and umap-learn libs,
if that's the case, the code below'll solve your problem
https://umap-learn.readthedocs.io/en/latest/basic_usage.html
pip uninstall umap
pip install umap-learn
import umap.umap_ as umap
reducer = umap.UMAP()

ModuleNotFoundError: No module named 'connections'

I am using pybrain library. When I import
from pybrain.structure import SigmoidLayer
I get the error
ModuleNotFoundError: No module named 'connections'
I am quite confused about the installation of pybrain. I am using python 3.6 and windows 10.
How did you install pybrain and which version of python are you using?
When i install it using pip3 and try
from pybrain.structure import SigmoidLayer
i get the same error as you, i then tried to install connections via pip3.
This fails with a syntax error in connections.
I then tried it with python2:
pip2 install pybrain connections scipy
this works.
So if you are using python2 you just need this:
pip install connections

How to fix ' ModuleNotFoundError: No module named 'tensorflow.python.keras' importing ImagePrediction?

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

Categories