PyQt5 (Qt5.2.1) Installation - Can't import QtWebkitIems - qt

I've installed Qt5.2.1 / SIP 4.5.15 and PyQt5 on my Ubuntu 12.4 desktop. Everything seemed OK until I try to import QtWebKitWidgets. This module is very important in my code.
>>> from PyQt5 import QtWebkitWidgets
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name QtWebkitItems
>>>
No error raised during the installation phase. in my /opt/Qt5.2.1/5.2.1/gcc_64/lib directory I can see the corresponding Qt libs.
Does anyone have an idea ?
Thank you in advance

I'm not sure where you're getting "QtWebkitItems" from (a web-search gets no hits other than this page), but the real problem is a simple typo. The import statement should be:
from PyQt5 import QtWebKitWidgets # upper-case K!
PS: it's nicely ironic that you managed to spell it right in your question, and even highlighted it in bold!

Related

gradio importing error on jupyter notebook: SyntaxError: future feature annotations is not defined

So I am pretty new to the ML world and currently following fastai's deep learning course. I tried to import gradio on my local machine's Jupyter. (using mamba). Whenever I try to import the module as
import gradio as gr
it gives me this error:
Traceback (most recent call last):
File "/home/eren/.local/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3343, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-43eca54f7d45>", line 1, in <module>
import gradio as gr
File "/home/eren/.local/lib/python3.6/site-packages/gradio/__init__.py", line 3, in <module>
import gradio.components as components
File "/home/eren/.local/lib/python3.6/site-packages/gradio/components.py", line 5
from __future__ import annotations
^
SyntaxError: future feature annotations is not defined
Any idea about what I need to do is appreciated.
I tried installing gradio in the environment, the error:
Looking for: ['gradio']
conda-forge/linux-64 No change
conda-forge/noarch 10.9MB # 2.1MB/s 5.3s
Pinned packages:
- python 3.10.*
Could not solve for environment specs
Encountered problems while solving:
- nothing provides requested gradio
The environment can't be solved, aborting the operation
From the traceback it looks like you're using python version 3.6.
At the moment, gradio supports python versions 3.7 and above (as seen here)
Prerequisite: Gradio requires Python 3.7 or higher, that's all!
As mentioned in this answer, the future feature annotations is only implemented in python 3.7 onwards.

Can't setup PySide6, error occured when running "from PySide6.QtCore import Qt" in python

I tried to install pyside6, its installation was successful (Successfully installed pyside6-6.2.4 shiboken6-6.2.4).
But I can't run the "Hello World Program" of PySide6, and when executing
from PySide6 import QtCore, QtWidgets, QtGui, error occurs:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libQt6Core.so.6: cannot open shared object file: No such file or directory
P.S.
My python version: 3.8.10; pyside version: 6.2.4; Linux kernel: 4.4.0-19041-Microsoft
Problem Solved by:
strip --remove-section=.note.ABI-tag ~/env/lib/python3.8/sitepackages/PySide6/Qt/lib/libQt6Core.so.6
This problem seemed to result from an outdated kernel (or, underdeveloped wsl kernel). Indeed, update wsl to wsl2 may solve this problem further.
Reference:
Why does PySide6 on GitLab CI result in ImportError?
https://askubuntu.com/questions/1034313/ubuntu-18-4-libqt5core-so-5-cannot-open-shared-object-file-no-such-file-or-dir/1163268#1163268

How do I fix Issue running pexpect-serial example

Pexpect serial https://pypi.org/project/pexpect-serial/ throwing an exception while running example. This in on windows. How do I fix?
import serial
from pexpect_serial import SerialSpawn
Traceback (most recent call last):
File "", line 1, in
File "C:\python36\lib\site-packages\pexpect_serial_init_.py", line 1, in
from .serial_spawn import SerialSpawn
File "C:\python36\lib\site-packages\pexpect_serial\serial_spawn.py", line 24, in
from pexpect import spawn
ImportError: cannot import name 'spawn'
found an alternative project that works on windows
pexpect-serial-terminal

How do I reset nbdev_build_docs

I had an import error that i have long cleared but nbdev_build_docs is stuck on that line. When I search through the project folder the line is not found
The error is:
from nbdev.showdoc import show_doc
from pyintegrators.twitter import *
------------------
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-f63d9caafaed> in <module>
1 from nbdev.showdoc import show_doc
----> 2 from pyintegrators.twitter import *
ModuleNotFoundError: No module named 'pyintegrators.twitter'
ModuleNotFoundError: No module named 'pyintegrators.twitter'
Yet when I search the project directory for that error i get No results found
It looks like I am dealing with a cache. How do I make it forget?
I am using macOs

Cannot import numpy in jupyter notebook

I was running some model in jupyter notebook, but my computer crashed all of a sudden. Once I restarted my computer, I was not able to import numpy in my jupyter notebook, and got the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
~\miniconda3\envs\fraud_detection\lib\site-packages\numpy\core\__init__.py in <module>
21 try:
---> 22 from . import multiarray
23 except ImportError as exc:
~\miniconda3\envs\fraud_detection\lib\site-packages\numpy\core\multiarray.py in <module>
11
---> 12 from . import overrides
13 from . import _multiarray_umath
~\miniconda3\envs\fraud_detection\lib\site-packages\numpy\core\overrides.py in <module>
6
----> 7 from numpy.core._multiarray_umath import (
8 add_docstring, implement_array_function, _get_implementing_args)
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-1-d4cdadb62aa7> in <module>
----> 1 import numpy
~\miniconda3\envs\fraud_detection\lib\site-packages\numpy\__init__.py in <module>
138 from . import _distributor_init
139
--> 140 from . import core
141 from .core import *
142 from . import compat
~\miniconda3\envs\fraud_detection\lib\site-packages\numpy\core\__init__.py in <module>
46 """ % (sys.version_info[0], sys.version_info[1], sys.executable,
47 __version__, exc)
---> 48 raise ImportError(msg)
49 finally:
50 for envkey in env_added:
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.8 from "C:\Users\miniconda3\envs\fraud_detection\python.exe"
* The NumPy version is: "1.19.1"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.
I tried deleting the whole anaconda and jupyter notebook, but it still did not work. Oddly, when I launched python in conda command shell I could successfully import numpy. Your help is much appreciated!!

Resources