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.
Related
I am trying to run a python script using ASE library, I have installed ase (https://wiki.fysik.dtu.dk/ase/install.html)and run my python script using this library on my terminal. I have made a virtual env named 'MLC_env' and have already installed the ase library there.
There is a folder 'Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase' which got installed over there. Now the the website (https://pypi.org/project/ase/) says Add ~/ase to your $PYTHONPATH environment variable and add ~/ase/bin to $PATH (assuming ~/ase is where your ASE folder is).
I am not able to figure out what exactly I have to do? How to add this ase folder to my pythonpath? Any suggestions will be helpful.
I tried to follow this answer Permanently add a directory to PYTHONPATH? , according to this I can try doing export PYTHONPATH="${PYTHONPATH}:/my/other/path"" where ~/ase will be the full path name of the ase folder. Shall I go ahead with this? any suggestions.
Python script
from ase import Atoms
atoms = Atoms('N2')
print(atoms.positions)
Error: While trying to run the above python script
(MLC_env) (base) anshumansinha#Anshumans-MacBook-Pro-3 Q1 % python3 struct.py
Traceback (most recent call last):
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/compat/py3k.py", line 24, in <module>
import pickle5 as pickle
File "/Users/anshumansinha/.local/lib/python3.10/site-packages/pickle5/__init__.py", line 1, in <module>
from .pickle import *
File "/Users/anshumansinha/.local/lib/python3.10/site-packages/pickle5/pickle.py", line 33, in <module>
from struct import pack, unpack
File "/Users/anshumansinha/Desktop/MLC/HW1/Q1/struct.py", line 1, in <module>
from ase import Atoms
ImportError: cannot import name 'Atoms' from partially initialized module 'ase' (most likely due to a circular import) (/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/core/__init__.py", line 23, in <module>
from . import multiarray
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/core/multiarray.py", line 10, in <module>
from . import overrides
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/core/overrides.py", line 8, in <module>
from numpy.compat._inspect import getargspec
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/compat/__init__.py", line 12, in <module>
from . import py3k
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/compat/py3k.py", line 26, in <module>
import pickle
File "/Users/anshumansinha/miniforge3/lib/python3.10/pickle.py", line 33, in <module>
from struct import pack, unpack
File "/Users/anshumansinha/Desktop/MLC/HW1/Q1/struct.py", line 1, in <module>
from ase import Atoms
ImportError: cannot import name 'Atoms' from partially initialized module 'ase' (most likely due to a circular import) (/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/anshumansinha/Desktop/MLC/HW1/Q1/struct.py", line 1, in <module>
from ase import Atoms
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/__init__.py", line 17, in <module>
from ase.atom import Atom
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/atom.py", line 3, in <module>
import numpy as np
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/__init__.py", line 141, in <module>
from . import core
File "/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/numpy/core/__init__.py", line 49, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.10 from "/Users/anshumansinha/Desktop/MLC/MLC_env/bin/python3"
* The NumPy version is: "1.24.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: cannot import name 'Atoms' from partially initialized module 'ase' (most likely due to a circular import) (/Users/anshumansinha/Desktop/MLC/MLC_env/lib/python3.10/site-packages/ase/__init__.py)
I want to open an image in python script but when importing skimage.io I get the following error. I have installed pip install scikit-image several times but I always get this error. Can anyone help me?
Traceback (most recent call last):
File "C:/Users/Admin/Desktop/BA Code/PSR-Staining/main.py", line 9, in
import skimage.io
File "C:\Users\Admin\Desktop\BA Code\PSR-Staining\venv\lib\site-packages\skimage_init_.py", line 127, in
from .util.dtype import (img_as_float32,
File "C:\Users\Admin\Desktop\BA Code\PSR-Staining\venv\lib\site-packages\skimage\util_init_.py", line 17, in
from ._map_array import map_array
File "C:\Users\Admin\Desktop\BA Code\PSR-Staining\venv\lib\site-packages\skimage\util_map_array.py", line 2, in
from ._remap import _map_array
ImportError: DLL load failed while importing _remap: The given module is not found.
Can you try pip install msvc-runtime? See discussion here.
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.
I'm trying to distribute this code through git+pip . I was able to properly create the setup.py file for deployment but after installing the package with:
https://github.com/EKami/kaggle-data-downloader
Running this import gives me an error:
>>> from kaggle_data_downloader import KaggleDataDownloader
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/Ekami/Programs/anaconda/envs/tensorflow/lib/python3.6/site-packages/kaggle_data_downloader/KaggleDataDownloader.py", line 3, in <module>
import utils
ModuleNotFoundError: No module named 'utils'
But with:
>>> import kaggle_data_downloader.utils
It works. It seems KaggleDataDownloader cannot find kaggle_data_downloader.utils. I think I missed something in the setup.py file. Any idea?
Thanks.
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