Python 3 Modules Do Not Work - python

I recently tried to install Pillow, for Python 3.5. From the command line, from PIL import Image works, but that does not work for IDLE. When I installed Pillow, it said that it was installed to C:\Users\arkj7\AppData\Local\Programs\Python\Python35-32\Lib\site-packages
When I try to import Image from Pillow, it says,
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from PIL import Image
File "C:\Users\arkj7\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\PIL\Image.py", line 67, in <module>
from PIL import _imaging as core
ImportError: cannot import name '_imaging'
but when I run import PIL it seems to work. I am running Windows 10.
Edit: No other modules work, they give similar error messages.
2nd Edit: This just keeps getting weirder, when I try to import PyEnchant, it works from the command line, but not IDLE. It gives me the error message:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import enchant
File "C:\Users\arkj7\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\enchant\__init__.py", line 92, in <module>
from enchant import _enchant as _e
File "C:\Users\arkj7\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\enchant\_enchant.py", line 102, in <module>
raise WinError()
OSError: [WinError 193] <no description>
However, modules like translate, work just fine.
Edit 3:
All modules except PIL, PyEnchant, and OpenCV work. OpenCV works from the command line, where I am running Python 3.5.2, but not from IDLE, where I am also running Python 3.5.2. I got OpenCV from here, and I used opencv_python-3.1.0-cp35-cp35m-win32.whl. I installed it using pip install opencv_python-3.1.0-cp35-cp35m-win32.whl, and I get this error message from IDLE:
>>> import cv2
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import cv2
ImportError: No module named 'cv2'
Edit 4:
I installed PyOpenGL like this, pip install PyOpenGL PyOpenGL_accelerate. From the command prompt, some things work, and others don't, this is what I get:
>>> import OpenGL
>>> from OpenGLContext import testingcontext
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'OpenGLContext'
>>> from OpenGL.GL import *
This is what I get from IDLE:
>>> import OpenGL
>>> from OpenGLContext import testingcontext
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
from OpenGLContext import testingcontext
ImportError: No module named 'OpenGLContext'
>>> import OpenGLContext
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import OpenGLContext
ImportError: No module named 'OpenGLContext'
>>> from OpenGL.GL import *
OpenGL_accelerate seems to be installed, but unable to import error checking entry point!
Unable to load ArrayDatatype accelerator from OpenGL_accelerate
Unable to load converters accelerators (wrapper, arraydatatype) from OpenGL_accelerate
Unable to load arrayhelpers accelerator from OpenGL_accelerate
OpenGL_accelerate seems to be installed, but unable to import expected wrapper entry points!
Unable to load VBO accelerator from OpenGL_accelerate

Related

Error while importing Cartopy in python- DLL load failed while importing trace

I have installed cartopy using whl package but when I try to import it, it gives me the error-
>>> import cartopy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\python38\lib\site-packages\cartopy\__init__.py", line 110, in <module>
import cartopy.crs
File "C:\python38\lib\site-packages\cartopy\crs.py", line 27, in <module>
import cartopy.trace
ImportError: DLL load failed while importing trace: The specified module could not be found.
>>>
I have already install geos on my python, what else is missing here?

trying to import cv2 on raspbrry pi. import error

I have been having huge isuess h intalling opencv on a raspberry pi, i believe it has poperly installed thie but will not import when testing import cv2 in python.
below is the error i got when trying to import cv2 using geany.
Traceback (most recent call last):
File "test.py", line 1, in <module>
import cv2
File "/home/pi/.local/lib/python3.5/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
ImportError: libImath-2_2.so.12: cannot open shared object file: No such file or directory
please help me fix this error, i have been trying to get this working for 2 weeks.
I tried the solution below
"Install the following packages with apt-get:
libilmbase-dev
libopenexr-dev
libgstreamer1.0-dev
"
and got the error below
Traceback (most recent call last):
File "test.py", line 1, in <module>
import cv2
File "/home/pi/.local/lib/python3.5/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
ImportError: libavresample.so.3: cannot open shared object file: No such file or directory
I'm pretty sure I've found the solution from the commented link.
Manually installing libraries using apt get as they can't be found solves the issue.

Pyusb isn't working

I got Pyusb with pip install pyusb but when I try to import usb.core I get:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import usb.core
File "C:\Users\Owner\Desktop\usb.py", line 1, in <module>
import pyusb
ImportError: No module named 'pyusb'
I also tried installing pyusb-1.0.2.tar.gz manuall with pip, but that didn't fix the issue.
I think you want import usb instead of import pyusb.

ImportError: No module named 'baseapi'

I can`t use the pyfcm module because of bellow error message.
How do I fix this error??
>>> from pyfcm import FCMNotification
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
from pyfcm import FCMNotification
File "C:\Anaconda3\lib\site-packages\pyfcm\__init__.py", line 6, in <module>
from .fcm import FCMNotification
File "C:\Anaconda3\lib\site-packages\pyfcm\fcm.py", line 1, in <module>
from baseapi import BaseAPI
ImportError: No module named 'baseapi'
If you are running Linux, try running this command in the shell: pip install baseapi.
If you are using an IDE, look for a prompt asking if you want to install this package.

Biopython: ImportError: No module named TreeConstruction

Someone knows why I get the following error?
>>> from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import Bio.Phylo.TreeConstruction
ImportError: No module named TreeConstruction
And also:
>>> from Bio.Phylo.Consensus import *
Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
from Bio.Phylo.Consensus import *
ImportError: No module named Consensus
Thanks to all for you time =)
Ok. Fixed!
The problem was that in the python IDLE, the version of biopython was 1.63, whereas the code
>>>from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor
works nice for version 1.65. So, the solution was delete the folder where biopython 1.63 was installed and download and later (re)install the biopython 1.65.

Categories