Ubuntu python Qt import fail - python

I am not able to launch git-cola on Ubuntu 20.04. As a troubleshooting exercise, I did this:
darnstein#EXTP346360104:Downloads$ python3
Python 3.8.10 (default, Sep 28 2021, 16:10:42)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5.QtWidgets import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /usr/lib/python3/dist-packages/PyQt5/QtWidgets.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZTI13QOpenGLWidget, version Qt_5
What should I do to resolve the undefined symbol?
I have packages python3-qt5 python3-pyqt5 installed already.

Related

Error importing cv2 in Python after opencv installation

I've successfully installed OpenCV, but when I try to import it in Python, I get the errors below.
In Python 2.7, I'm getting this
[imukunya#li165-244 site-packages]$ python
Python 2.7.5 (default, Oct 30 2018, 23:45:53)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
In Python 3.6, I'm getting this error
[imukunya#li165-244 site-packages]$ python3.6
Python 3.6.5 (default, Apr 10 2018, 17:08:37)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dynamic module does not define module export function (PyInit_cv2)
I've already tried installing NumPy using $~python3 -m pip install numpy -I
Please try to execute the below command. Then please verify whether your code is working.
python -m pip install opencv-contrib-python

Error updating Django

I get the following error when I type "pip install -U Django":
Collecting Django Using cached Django-2.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/tn/d7vg_zcd5pq0cq3sltw0j7pc0000gn/T/pip-build-xIsFov/Django/setup.py", line 32, in <module>
version = __import__('django').get_version()
File "django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django/utils/version.py", line 61, in <module>
#functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/tn/d7vg_zcd5pq0cq3sltw0j7pc0000gn/T/pip-build-xIsFov/Django/
I read that this relates to the version of python. But if I type python3 in terminal I get :
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
The error has to do with:
#functools.lru_cache()
The functools if python-2.x has no lru_cache decorator, indeed:
$ python2
Python 2.7.13 (default, Nov 23 2017, 15:37:09)
[GCC 6.3.0 20170406] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> functools.lru_cache
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'lru_cache'
>>>
$ python3
Python 3.5.3 (default, Nov 23 2017, 11:34:05)
[GCC 6.3.0 20170406] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> functools.lru_cache
<function lru_cache at 0x7f23e3e8b378>
So that means that you aimed to install django-2.0 in a python-2.x environment, which is not supported.
If you plan to use it globally with python-3.x, you need to use a package manager for python-3.x, which is for instance pip3 (not pip). So you can install it with:
pip3 install -U Django

How to fix ImportError in PyQt5?

I install new version of Anaconda (Python 3.6) and now I can not import PyQt.
I reinstalled it three times and add <>\Anaconda3.6\Lib\site-packages\PyQt5\Qt\bin to PATH variable. But it did not help.
$ python
Python 3.6.0 |Anaconda 4.3.1 (64-bit)| (default, Dec 23 2016, 11:57:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5.QtCore
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: Could not find the specified module
Try to add file python3.dll from python.org to your anaconda's directory.
In my case i had there only python36.dll

Importing from lxml.etree fails on Python 3.4 running RHEL 2.6.18-371.11.1.el5

I installed the latest version of lxml.etree compatible with Python 3.4. However when I try importing the package, I hit the following error:
> python
Python 3.4.1 (default, Nov 12 2014, 13:34:29)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from lxml import etree
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: /users/vinapai/nxapi/pyats/lib/python3.4/site-packages/lxml/etree.cpython-34m.so: undefined symbol: xmlMemDisplayLast
>>>
I tried using both pip install and easy_install and tried different packages of lxml but consistently hit this error. Any help would be greatly appreciated.

pygtk error after update

After manual updating python and python3 in Fedora 19 or Fedora 20 (x86_64) to versions 2.7.6 and 3.3.3 respectively I have got this error:
python
Python 2.7.6 (default, Dec 17 2013, 23:13:55)
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pygtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pygtk
Same happens if running python2 or python2.7.
After that I manually installed pygtk (from web site pygtk.org version 2.24, I hope it is the very version I need), but it haven't helped.

Categories

Resources