As i am doing background subtraction on a video, opencv 2.4.6 is not supporting, like web cam will not respond.
my guide suggested me to download and install opencv 2.4.8, and i did so, but it is giving me an error
ImportError
<ipython-input-1-72fbbcfe2587> in <module>()
----> 1 import cv2
ImportError: numpy.core.multiarray failed to import
i have uninstalled the earlier version and then i have installed the new version, and done all the prerequisites.
Thank you for the support!
OpenCV relies on numpy, do you have numpy installed?
Related
I'm having an issue with my tensorflow on windows 10 (python 3.7, tf 2.1.0, keras 2.3.1, pillow 7.1.1). I had some code I wrote on an osx machine and was porting over to windows. I am using conda envs and have all the necessary packages installed (tensorflow, keras, pillow, opencv, etc) but I am getting the following error
Traceback (most recent call last):
...
"...\venv\lib\site-packages\keras_preprocessing\image\utils.py", line 108, in load_img
raise ImportError('Could not import PIL.Image. '
ImportError: Could not import PIL.Image. The use of `load_img` requires PIL.
I have tried reinstalling pillow, tensorflow, keras, creating a new environment, installing with pip and repeated this in about every location I can think of but this issue remains persistent. Any help would be greatly appreciated.
Thank you
One solution that might work for your case:
First, you need to : pip install pillow (uninstall + reinstall / upgrade it it's the case)
Second, you need to change your imports in this way:
from IPython.display import display
from PIL import Image
This solution can be found in the following thread:
ImportError: Could not import the Python Imaging Library (PIL) required to load image files on tensorflow
I have installed Python 3.6.4. When I import cv2, it throws this error:
DLL load failed: The specified module could not be found.
I have OpenCV version 2.4.13.
What should i do?
It's possible that you have Python 2 and 3 installed and Python 3 doesn't know about your opencv installation. Try this:
pip3 install opencv-python
That will install opencv for Python 3 and hopefully that fixes your problem.
Try doing this:
Go to command prompt and "cd" the directory of python.
Enter this if you are running Python 3.x.x
pip3 install opencv-python
OR
2.If on Python 2.x.x
pip2 install opencv-python
DO NOT USE:
pip install opencv
That was my mistake and had to dig a lot to find a solution.
In my situation,
ImportError Traceback (most recent call last)
in ()
10 import os.path
11 from keras.models import load_model
---> 12 import cv2
13 from utils.utils import get_yolo_boxes, makedirs
14 from PIL import Image
ImportError: DLL load failed: The specified module could not be found.
Face this ImportError in the pass week, and I solved with enter below scripts in the Anaconda Prompt.
conda install -c menpo opencv
And here is my environment:
Python 3.6.5 Anaconda
Keras 2.2.2
tensorflow 1.9.0
For more details, here is the log I tried to solved this ImportError:
micky619/holiday-similarity#3
This can happen if you are using windows 10 N distribution, the N distributions does not come pre installed with windows media feature pack, which is required after OpenCV version 3.4 and onwards.
The preferred solution is to install the feature pack at : https://www.microsoft.com/en-us/software-download/mediafeaturepack
Be careful to choose the version that works with your current version of windows.
If that is not an option, fall back to an earlier version of OpenCV that does not have dll dependencies, you can do that by:pip install opencv-python=3.3.0.9
If the problem still persists try using Dependency walker to find out where specifically your problems stem from and then try fixing them individually.
Since windows rolled out it's N version this problem has been seen at many places, and has many impacts across the windows environment, the fastest way to identify if you have this problem is open youtube in Edge browser, if it says HTML5 media plugin not found, this is the problem.
when I ran conda-forge to get xgboost running, it seems to have affected few running packages, one of them being PIL. It was running properly until I ran conda-forge, but now I am getting the following error.
ImportError Traceback (most recent call last)
<ipython-input-3-588a23339ee5> in <module>()
5 import matplotlib.pyplot as plt
6 import scipy
----> 7 from PIL import Image
8 #from pillow import Image
9 from scipy import ndimage
C:\Anaconda3\lib\site-packages\PIL\Image.py in <module>()
54 # Also note that Image.core is not a publicly documented interface,
55 # and should be considered private and subject to change.
---> 56 from . import _imaging as core
57 if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None):
58 raise ImportError("The _imaging extension was built for another "
ImportError: DLL load failed: The specified module could not be found.
when I try to install PIL again using conda install pil, I get the following error message
(C:\Anaconda3) C:\Users\P Srinivasa Rao>conda install pil
Fetching package metadata ...............
Solving package specifications: .
UnsatisfiableError: The following specifications were found to be in conflict:
- pil -> python 2.6*
- python 3.6*
Use "conda info <package>" to see the dependencies for each package.
I then installed pillow, which seems to have gone well. But when I run from PIL import image, I still get the same error as above. I tried from pillow import image, it says no module found named pillow
Any advice on how to resolve this issue and get PIL working again?
I am using anaconda3 on windows 10, 64bit.
The problem looks like you have both pythons 2.x versions and a 3.x version. try the following
create a conda environment with python 3.6
conda create -n pil-env python=3.6
load PIL
conda install Pillow==4.0.0
I found Pillow 4.0.0 to be the most stable while using it on 3.6
I want to install opencv on Windows 7 64 bit and I'm using Python 3.5.1 32-bit.
I downloaded the .whl file for opencv as said in the answer in this question: Install opencv for Python 3.3 given by #user3731622. But when I try to do:
import cv2
I get the following error:
ImportError: numpy.core.multiarray failed to import
What am I doing wrong ?
Thanks
Are you sure it's bumpy in the error you get? multiarray is a part of numpy.
In this post: ImportError: numpy.core.multiarray failed to import
the solution is to install numpy. Do you have that installed?
Does anyone know why I am getting this error?
I have Ubuntu 32-Bit , and Python 32-Bit and Installed Pillow using pip
Here is the code:
import Image
import pytesseract
print pytesseract.image_to_string(Image.open('1.jpg'))
Here is the error :
Traceback (most recent call last):
File "/home/siamak/workspace/test/com/tower/test/ocr.py", line 1, in
import Image
ImportError: No module named Image
You have to do:
from PIL import Image
Image is a submodule of PIL, so you have to use the from...import syntax.
I tested it on Linux Mint , and CentOS and it works perfectly .
For some reason it doesn't work on Ubuntu 32 and 64 .
I am assuming it is related to the PIL installation
Thanks
I also had this problem where,
from PIL import Image
gave this same error as the one in your comment:
from PIL import _imaging as core
ImportError: /home/jer/.local/lib/python2.7/site-packages/PIL/_imaging.so:
undefined symbol: PyUnicodeUCS4_AsLatin1String
It seems a locally installed version of Pillow is the culprit. We can uninstall the local version with,
pip uninstall Pillow
This left the system version of Pillow installed, which worked fine.