Pyusb isn't working - python

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.

Related

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.

Mingus/lilypond on python

I can import mingus but sublibraries such as mingus.extra.lilypond give me an error:
import mingus.core.notes
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import mingus.core.notes
File "C:\Users\PharaohZz\AppData\Local\Programs\Python\Python36\lib\site-packages\mingus\core\notes.py", line 29, in <module>
from mt_exceptions import NoteFormatError, RangeError, FormatError
ModuleNotFoundError: No module named 'mt_exceptions'
or
import mingus.extra.lilypond
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import mingus.extra.lilypond
File "C:\Users\PharaohZz\AppData\Local\Programs\Python\Python36\lib\site-packages\mingus\extra\__init__.py", line 20, in <module>
import lilypond
ModuleNotFoundError: No module named 'lilypond'
You can fix this problem by first uninstalling mingus (pip uninstall mingus).
Then build the library from it's source. To do this:
Download the files from git hub using the command git clone https://github.com/bspaans/python-mingus .
Enter the directory using cd python-mingus.
Finally install it using the command python setup.py install.
This fixed the problem for me.

Python 3 Modules Do Not Work

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

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.

pySerial not working on Python3.2.2

I installed the 32 bit version of Python 3.2.2 and want to get the pySerial package to work. I most definitely have the pyWin32 package install but still when I try to import serial it gives me this error
>>> import serial
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python32\lib\site-packages\serial\__init__.py", line 19, in <module>
from serialwin32 import *
ImportError: No module named serialwin32
>>>
Any help?
Search around in your C:/Python32/Lib/site-packages/serial/. See if you can find a file named serialwin32. If not, you should try uninstalling pywin32 and reinstalling it.

Categories