Python cv2 throws strange symbol error when importing - python-3.x

typically I can find the solution to any errors I have online, but I just cannot find the solution to this particular problem anywhere.
So I've installed OpenCV4 on my ubuntu 20.04 using pip3, but upon typing the following commands:
$ python3
import cv2
I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/jordan/.local/lib/python3.7/site-packages/cv2/__init__.py", line 5, in <module>
from .cv2 import *
ImportError: /usr/lib/x86_64-linux-gnu/librsvg-2.so.2: undefined symbol: cairo_tag_end
I am not entirely sure what the error means. My guess is that it's something to do with the environment variables, but I don't know how to fix that anyways. I really hope someone can help me fix this.

Related

ImportError: cannot import name 'cpyHook' from partially initialized module 'pyWinhook'

This has been plaguing me for a while now, and I'm not sure what to do about it. I've tried modifying the init.py pyWinhook script's imports, but to no avail. Here's the whole error:
Traceback (most recent call last):
File "d:\myuser\Documents\Python\evil_programs\keylogger.py", line 6, in <module>
import pyWinhook as pyHook
File "C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\__init__.py", line 1, in <module>
from .HookManager import *
File "C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\HookManager.py", line 1, in <module>
from . import cpyHook
ImportError: cannot import name 'cpyHook' from partially initialized module 'pyWinhook' (most likely due to a circular import) (C:\Users\myuser\AppData\Roaming\Python\Python310\site-packages\pyWinhook\__init__.py)
Thanks in advance
The way I fixed this is by installing Python 3.8.
Python 3.10 and 3.11 produced this issue.
I got this idea from the executable name on GitHub "pyWinhook-1.6.2.win-amd64-py3.8.exe"
Why it does not work with newer python, I have no clue.

my-voice-analysis myspsolution module not found error

we are using python library my-voice-analysis but getting myspsolution import error please tell what is the solution
import myspsolution as mysp
p="Audio" # Audio File title
c=r"speech.wav"
mysp.myspgend(p,c)
Traceback (most recent call last):
File "C:\Users\ADITYA\AppData\Local\Programs\Python\Python36\sp.py", line 1, in <module>
import myspsolution as mysp
ModuleNotFoundError: No module named 'myspsolution'
i know its a bit late and you probs dont need it anymore but
replace
import myspsolution as mysp
with
mysp=__import__("my-voice-analysis")

ModuleNotFoundError: No module named 'torch._C'

I want to import the torch,but then the interpreter return this result,i have no idea how to deal with it
Traceback (most recent call last):
File "D:/Programing/tool/Python/learn_ml_the_hard_way/ML/scipy1.py", line 1, in <module>
import torch
File "D:\Programing\python\Anaconda3.5\lib\site-packages\torch\__init__.py", line 84, in <module>
from torch._C import *
ModuleNotFoundError: No module named 'torch._C'
I had the same problem and followed the instructions in this link
You can also find the torch path with this command if needed:
sudo find / -iname torch
In my case it was issue with python version, created python 3.7 environment and re-installed it. worked just fine
Initially I was running in a Conda environment got this error. Just deactivated the environment now it works.

Jupyter Notebook in Anaconda Not Loading

Whenever I try to open Jupyter Notebook from the Anaconda GUI (or conda terminal), I get the following error:
Traceback (most recent call last):
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 10, in
import sqlite3
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\sqlite3\__init__.py", line 23, in
from sqlite3.dbapi2 import *
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\sqlite3\dbapi2.py", line 27, in
from _sqlite3 import *
ImportError: DLL load failed: The specified procedure could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in
from notebook.notebookapp import main
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\notebookapp.py", line 86, in
from .services.sessions.sessionmanager import SessionManager
File "C:\Users\loops\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 13, in
from pysqlite2 import dbapi2 as sqlite3
ModuleNotFoundError: No module named 'pysqlite2'
I've gone so far as to uninstall Python, uninstall Anaconda, remove all python related path variables, and reinstall Anaconda with Python. This still has not worked. Is there any way to resolve this error? I've looked on many different sites but I haven't found much help.
EDIT: To add more context, it broke randomly one day and I don't have the slightest idea why. Anaconda had worked for a year or so prior. I checked both scripts that are referenced in the error prompt and they both exist in the directory.
I had the same problem.
The issue seems to arise from the missing of sqlite3.dll in the path ".\Anaconda\Dlls".(if using an env, you should put it under the env directory like ".\your env\DLLS") I solved it by simply copying that .dll file from others and put it under the path mentioned above.
You can download the sqlite3.dll from this link: sqlite3.dll

creating network using pybrain

I want to create a network using pybrain..I have installed anaconda on my windows(64bit)..so I have the dependencies installed...when I run the code
>>> from pybrain.tools.shortcuts import buildNetwork
in Idle I face this error:
>>>Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
from pybrain.tools.shortcuts import buildNetwork
File "C:\Users\ata\Anaconda3\lib\site-packages\pybrain\tools\shortcuts.py", line 14
except ImportError, e:
^
SyntaxError: invalid syntax
I have shrtcuts code:enter image description here
I also have the buildNetwork function:enter image description here
I ll be grateful if someone can tell me the reason...
The problem is that pybrain doesnt work for python 3,although in its website it is written that it works for python 2.5+.

Resources