installing opencv for python without success - python

I followed this tutorial on how to install opencv on my mac (running 10.10.3). I also tried all of the suggestions listed in the stackoverflow post mentioned in the article.
When I run the line import cv the console returns:
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named cv
Does anyone have any suggestions as to what I can do to get opencv working?

Related

AttributeError: partially initialized module 'face_recognition' has no attribute 'face_encodings'

I am trying to make face recognition script in python with the help of below given link found on google.
https://www.mygreatlearning.com/blog/face-recognition/
I have installed:
OpenCV
dlib and
face_recognition
libraries.
Also, installed Visual C++ for CMake.
And now I am trying to "extract features from Face" using code given in above link.
While running script, I am getting below error:
Traceback (most recent call last):
File "C:\Users\ajay.arora2\AppData\Local\Programs\Python\Python38-32\extract_features_from_face.py", line 2, in <module>
import face_recognition
File "C:\Users\ajay.arora2\AppData\Local\Programs\Python\Python38-32\face_recognition.py", line 32, in <module>
encodings = face_recognition.face_encodings(rgb)
AttributeError: partially initialized module 'face_recognition' has no attribute 'face_encodings' (most likely due to a circular import)
I have tried re-installing face_recognition module.
Please suggest any workaround.
Thanks in advance.
Most probably you have named your file the same as the library "face_recognition".
Circular import happens when you want to import something from the same file.

Issues with onnxruntime on Ubuntu 16.04

I'm trying to run inference on an ONNX model on Ubuntu 16.04 using onnxruntime. But the import statement gives me this error:
>>> import onnxruntime
/opt/conda/lib/python3.6/site-packages/onnxruntime/capi/_pybind_state.py:13: UserWarning: Cannot load onnxruntime.capi. Error: '/opt/conda/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.cpython-36m-x86_64-linux-gnu.so: cannot enable executable stack as shared object requires: Permission denied'
warnings.warn("Cannot load onnxruntime.capi. Error: '{0}'".format(str(e)))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/conda/lib/python3.6/site-packages/onnxruntime/__init__.py", line 12, in <module>
from onnxruntime.capi._pybind_state import get_all_providers, get_available_providers, get_device, set_seed, RunOptions, SessionOptions, set_default_logger_severity, NodeArg, ModelMetadata, GraphOptimizationLevel, ExecutionMode, OrtDevice, SessionIOBinding
ImportError: cannot import name 'get_all_providers'
After searching online, I have tried using execstack -c on the .so mentioned in the warning. But I get this message and the issue still persists:
section file offsets not monotonically increasing
I would really appreciate some pointers to fix this.
P.S. I even tried installing onnxruntime-gpu (I have CUDA 10.0) but I get the same error.
Not sure if you've SELinux installed? https://ceisoftware.zendesk.com/hc/en-us/articles/202370087-Cannot-enable-executable-stack-as-shared-object-requires-Permission-denied. This doesn't seem to

Module name not found for cv2

Currently, I'm using this to guide me with my project " https://github.com/hanyazou/TelloPy/blob/develop-0.7.0/tellopy/examples/video_effect.py "
but I have some issues running it, but to my knowledge, I believed I have cv2 installed in my PC. I'm using Windows 10-64bits if that helps..
The error was:
Traceback (most recent call last):
File "video_effect.py" , line 5, in module
import cv2.cv2 as cv2 # for avoidance of pylint error
ImportError: No module found cv2

unable to install opencv in mac for python.. below is the error. else suggest a better way to install opencv

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/cv2.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/glog/lib/libglog.0.3.5.dylib
Referenced from: /usr/local/Cellar/opencv/3.4.3_1/lib/libopencv_sfm.3.4.dylib
Reason: image not found
above is the error - how to fix ?
I searched for this problem and also got to github.com/opencv/opencv/issues/8652 where they recommended installing the missing library.
However, our error message references a different library -- glog: brew install glog worked for me!

Python Path error - No Module Found error

I'm having issues running ortools on Linux. I downloaded it from google's site (https://developers.google.com/optimization/) and installed it using "make install," but when I go to use it in python I get the following:
Traceback (most recent call last):
File "regular.py", line 42, in <module>
from ortools.constraint_solver import pywrapcp
File "/home/m3/summer/ortools_examples/examples/python/ortools.py", line 2, in <module>
ImportError: No module named linear_solver
It looks like despite installing ortools, its still not in my python path correctly, so when I call it in the file, it doesn't find anything and returns an error, right? Any advice on how to solve this?

Categories

Resources