When trying to load an image file with scipy.misc.imread(), I receive this unexpected error:
Traceback (most recent call last):
File "/home/ghita/PycharmProjects/image_processing/venv/test1.py", line 2, in <module>
from scipy.misc import imread, imsave
ImportError: cannot import name 'imread' from 'scipy.misc' (/home/ghita/PycharmProjects/image_processing/venv/lib/python3.8/site-packages/scipy/misc/__init__.py)
Why does this fail?
It looks like imread has been removed from scipy.misc. They now recommend that you use imread from the imageio package.
Related
I am trying to import the image module from pillow 5.1.0. Using python 3.6.5.
I typed in the following command
from PIL import image.
Upon doing this I get the following error.
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
from PIL import image
ImportError: cannot import name 'image'
Try from PIL import Image (note the capital 'I' in Image).
I have installed scikit-image from a binary but when I run this command:
from skimage.measure import structural_similarity
I get this error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from skimage.measure import structural_similarity as ssim
File "C:\Python27\lib\site-packages\skimage\measure\__init__.py", line 4, in <module>
from ._regionprops import regionprops, perimeter
File "C:\Python27\lib\site-packages\skimage\measure\_regionprops.py", line 8, in <module>
from . import _moments
File "C:\Python27\lib\site-packages\skimage\measure\_moments.py", line 3, in <module>
from . import _moments_cy
ImportError: DLL load failed: The specified module could not be found.
There is a file named _moments_cy.pyd in that directory, not sure if that's what it's asking for.
from skimage.metrics import structural_similarity as ssim
The module is now moved to metrics instead of measure.
I'm having a 'Cannot import name StringIO' error message when importing dateutil which tries to import StringIO but cannot find it. Here is complete trace:
(DEV)arbi#el-oued:~/Work/sentimentpy$ python core/main.py
Traceback (most recent call last):
File "core/main.py", line 7, in <module>
from io.reader import *
File "/home/arbi/Work/sentimentpy/core/io/reader.py", line 4, in <module>
from dateutil import parser
File "/home/arbi/DEV/local/lib/python2.7/site-packages/dateutil/parser.py", line 22, in <module>
from io import StringIO
ImportError: cannot import name StringIO
When I tried to use python3 to launch my program, i had this error:
(DEV)arbi#el-oued:~/Work/sentimentpy$ python3 core/main.py
Traceback (most recent call last):
File "core/main.py", line 1, in <module>
from analyzer.length import LengthAnalyzer
File "/home/arbi/Work/sentimentpy/core/analyzer/length.py", line 4, in <module>
from numpy
ImportError: No module named numpy
Why I'm having this? i've installed numpy in my virtualenv with: pip install numpy
You are masking the built-in io module because you have a package named io in your project:
Traceback (most recent call last):
File "core/main.py", line 7, in <module>
from io.reader import *
File "/home/arbi/Work/sentimentpy/core/io/reader.py", line 4, in <module>
The line from io import StringIO finds /home/arbi/Work/sentimentpy/core/io, not the built-in module.
Rename that package or move it into a new top-level package name that doesn't conflict.
Your second error is unrelated; you simply don't have numpy installed for Python 3.
I am having trouble with PIL import Image. I have Pillow installed. But when I try something like from PIL import Image it gives following error.
>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/Pillow-2.5.2-py2.7-macosx-10.5-i386.egg/PIL/Image.py", line 61, in <module>
from PIL import _imaging as core
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/Pillow-2.5.2-py2.7-macosx-10.5-i386.egg/PIL/_imaging.so, 2): Symbol not found: _TIFFClientOpen
Referenced from: /Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/Pillow-2.5.2-py2.7-macosx-10.5-i386.egg/PIL/_imaging.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/7.1/lib/python2.7/site-packages/Pillow-2.5.2-py2.7-macosx-10.5-i386.egg/PIL/_imaging.so
I have such code in the beginning of a file:
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
And it throws the error:
python3 main.pyTraceback (most recent call last):
File "main.py", line 1, in <module>
from PIL import Image
ImportError: No module named 'PIL'
According to many ad vices I should just replace import PIL with what I actually have. But is doesn't work as you can see.
It's on Ubuntu 14.04 and Python 3.4.0
According to this you should be able to do import Image instead of import PIL.