QT Webengine for Ubuntu - python

I have several different qt packages installed for my development environment on Ubuntu 15.04 (3.19.0-51-generic), and I can't seem to get my imports correct. The error I am running into in PyCharm is:
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: No module named 'PyQt5.QtWebEngineWidgets'
The following packages I have installed already, which I believe to be relevant are as follows:
python3-pyqt5
python3-pyqt5-dbg
python-pyqt5
python-pyqt5-dbg
pyqt5-dev-tools
pyqt5-dev
python-pyqt5.qtwebkit
python3-pyqt5.qtwebkit
python-pyqt5.qtwebkit-dbg
python3-pyqt5.qtwebkit-dbg
What am I missing here? Note that the project explicitly requires the following in its README:
Qt 5.5+
PyQt5.6+
Furthermore, I understand that webengine and webkit are two different things (I was giving it a stab). I can't find any Webengine for PyQT5 anywhere in the official Vivid repository. I tried installing libqt5webengine5-dev and libqt5webengine5 from https://launchpad.net/~ethereum/+archive/ubuntu/ethereum-qt packages with the same result, perhaps I need to add something to Python path. Can anyone lend a hand (Im normally a .NET developer :/)?

Related

ImportError: DLL load failed while importing QtCore, QtGUI

I just upgraded my Python to 3.8.3 and pyside2 to 5.15.0 and now it's showing me:
from PySide2 import QtCore, QtGui, QtWidgets
ImportError: DLL load failed while importing QtCore: The specified module could not be found.
My Environment variables are in the path and I have the latest version of both Python and PySide2...
Why is this happening??
I tried reinstalling PySide2 but nothing happens...
I think you failed to install it. Probably it collides something...
I updated PySide6.2.4 → 6.3.0 today. I run into this error again.
In my case, QtWidgets...
On windows, we usually have Local files and Roaming files.
My installation leads my files into Local files, but I don't know why, Roaming file also has python file. And the file has site-packages , naturally Pyside6.2.4 was in it. So I removed the python file in Roaming.
And then, I reinstalled PySide6. Installation itself is no problem, error didn't occur. (Because Local files already have python file which has site-packages containing Pyside6... installation had no effect.)
But I checked the installed folder, the number of files seemed to be less than usual... there are no characters like QtWidgets...
In spite of reinstalling again, the condition never changed.
I read commandline message carefully, I found out I installed other files at the same time. PySide6_Addons_6.3.0.dist-info, PySide6_Essentials-6.3.0.dist-info PySide6-6.3.0.dist-info.
Because these files are not removed in the previous handling, installation seemed to be in vain.
So I deleted PySide6, PySide6_Addons_6.3.0.dist-info, PySide6_Essentials-6.3.0.dist-info PySide6-6.3.0.dist-info all.
After that, I reinstalled PySide6.3.0. My installation sucessed.
In general, if we downloaded a python, we would download from python.org
You can download it into any drive.
If you download python, python automatically makes a Lib module at the same directory.
And then, you must set a pass for them.
I don't make sure which directory to add, it will be necessary procedure.
In my environment system path environment as follows:
Scripts module will be created for mainly command-script.
For example, they will have pyside2-rcc.exe or pyside2-uic.exe, and pip.exe.
I was warned when I made Qt-resource file because of the lack of path.
If you can't do pip, you may be able to do the same thing by writing py -m command in front of the pip command.
Moreover, if you installed PySide2, you should install into the site-packages belonging to the same directory of python.exe.
You go into the directory python.exe exists with command-prompt, you command pip the PySide2 module.(from .whl will be better)
After that, site-packages module of the Lib module will get the PySide2 packages.
For the test, I recommend you boot Python IDE and write "from PySide2 import QtCore, QtWidgets, QtGui and other codes.
Even if you follow my introduction, you may have the same problem.In that case, it is possible to be a time for transition of some other environments.
For example, AFAIK, PySide6.0 couldn't use QtWebEngine .But with PySide6.2 makes it.
I ran into the same problem when I was using Spyder with Anaconda, and I couldn't find out what is the reason. I don't make sure whether QtWebEngine can be used with Spyder with PySide6.2 even now because Anaconda can't use PySide6.x yet.AFAIK, PySide5.15 couldn't use QtWebEngine.
At any rate, I think we should know the basic, minimal environment for using python & pyside.
Anaconda is very useful, but I had no exact knowledge about controling directories for python, I was very confused.Sometimes, there may be also the problem at the spider side. (In addition to it, Anaconda recommends conda, but I often want to use pip.)I couldn't distinguish where the problem was.It makes me more confused.I have been trying to solve this problem in only the Anaconda environment.
For that reason, I think this basic installation will be a good mark.If we can execute python with this basic environment, the problem is in your
package controller.Otherwise, we cannot help waiting for the time to solve it.
I also ran into this problem.
I couldn't execute my code as it is.
When I update my Anaconda3 for python3.7.x to python3.8.3., and update my PySide2,
this error hannpened.
I have followed this solution:
https://bugreports.qt.io/browse/PYSIDE-1323
Thanks to this, I could unexpectedly do 'from PySide2 import QtCore, QtGui, QtWidgets' on the Anaconda Prompt, console.
Nonetheless, I have the same error on the spyder, IPython.
I couldn't understand why it is. I couldn't execute codes from Spyder, but I can execute from Anaconda Prompt...(It seems to me they are the same thing, on the surface at least.)
So, as my final way, I changed the current console to an external console.
It is just the same to be executed from Console Application attached by Windows.
(>python module_name.py)
I could execute my file by this way... (But unvisible errors came!)
Until this bug is repaired, I execute my file by an external console.

Qt library incompatibility with Pycharm new installation

I installed a new version of Pycharm (2019.3.1) and running my old codes on them. But I am getting error for qt library incompatibility. I tried to update the qt package from conda (as I am using conda distribution for the python).
I noticed the following behavior -
The error comes only for the plotting (which makes sense as qt is for graphical purposes).
There is no problem in code compilation and running, as it shows the result for the 1 epoch (can be seen in the below image.
My installed qt version is 5.9 (you can see in the second image)
The same code runs perfectly in spider but throwing the below error in pycharm. Please help me to fix this problem. thanks
From error message you posted it is clear that you have library incompatibility problem.
Somehow it appears you have 2 Qt versions installed - 5.9.7 and 5.12.4 and these versions have conflict with each other.
You need to verify Run configuration in PyCharm to see which python environment it uses. And then check why 2 Qt are available in your system.
Anothe option that comes to my mind - your PyQt5 or PySide2 (whatever you use) library is built with Qt 5.12.4 while your system have 5.9.7 and it brings a conflict.

How to support alternate dependencies in a Python package?

I have written a utility library in Python that works with the Qt framework. My code is pure Python and is compatible with both PyQt5 and PySide2. My main module could either be run on its own from the command line with python -m or it could be imported into another project. Is there a clean way to specify that the project needs either PyQt5 or PySide2 in its a wheel distribution?
Here is what I have found in my research but I am asking in case there is a better way to package the project than these options:
I could add logic to setup.py in a source distribution of the project to check for PyQt5 and PySide2. However, wheels are recommended way to distribute Python projects, and from what I can tell this kind of install-time logic is not possible with wheels. Alternatively, I could not specify either PySide2 or PyQt5 as dependencies and recommend in the install instructions that one of them be installed together with my project.
Use extras_require:
setup(
…
extras_require={
'pyqt5': ['PyQt5'],
'pyside2': ['PySide2'],
},
)
and teach your users to run either
pip install 'yourpackage[pyqt5]'
or
pip install 'yourpackage[pyside2]'
If you don't want to make either a strict requirement (which makes sense), I'd just throw a runtime error if neither is available.
For example
try:
import PyQt5 as some_common_name
except ImportError:
try:
import PySide2 as some_common_name
except ImportError:
raise ImportError('Please install either PyQt5 or PySide2') from None
My particular case is somewhat niche (so I am not accepting this as the answer). I realized the package was really doing two things: acting as a library and as a command line tool. I decided to split it into two packages: package and package-cli. package does not explicitly depend on PyQt5 or PySide2 but specifies that one of them must be installed in the documentation. Since package is a library, it is intended to be integrated into another project where it is easy to list package and PyQt5 together in the requirements.txt. For package-cli, I just choose one of PyQt5 or PySide2 to be the explicit dependency. package-cli depends on package and PyQt5 and just adds a console_script to call the main module in package.

The PIL library import fails

Being a complete begginer in python, I decided to install the python interpreter 3.4.4, and also PyDev plugin for eclipse IDE. I am also using windows 10.
I have encountered a problem regarding certain imports, namely : from PIL import Image, ImageTk, which is apparently an unresolved import.
I have looked at certain questions which were similar to my situation, but most of them gave a solution like installing packaged from the linux apt-get. Here are some topics I visited :
Uninstalling and reinstalling Pillow and pip,
Installing pillow-imaging-tk on Ubuntu,
This topic which left me very confused,
This one seemed helpful, but is on Unix OS again
So please, could someone explain to me why I am seeing this error, and how could I correct it if I absolutely want to use Eclipse, Pydev, windows 10 and Python 3.
Found the solution, here's what I did:
Set the PYTHONPATH like it is shown in this article, make sure python.exe is accessible via cmd,
Via cmd, type pip install pillow. Alternatively, you can enter the same command from Windows+R,
(Not sure if relevant step) Via eclipse, Windows->Preferences->PyDev->PythonInterpreterremove your interpreter to re-add it,
Restart eclipse.
For Python import problems in PyDev, the project web site has a page on interpreter configuration that is a good place to start. I recently had a similar problem that I solved by adding a module to the forced builtins tab.

Troubles installing PyQt4

I'm following this guide.
Python is at C:\Python31
PyQt4 is at C:\Python31\pyqt
sip is at C:\Python31\sip
Qt is at C:\Qt\4.6.0
I followed the instructions on that guide, but when I tried to test it (from PyQt4.Qt install *), it said the module didn't exist. I checked all the files that guide said should exist, and none of them existed.
What should I do?
Oh:
sip installed fine. from sip import * didn't yield errors, print(SIP_VERSION_STR) output 4.10-snapshot-20091204.
There is pre-built version already, why you still need to build yourself?
http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-Py3.1-gpl-4.6.2-2.exe

Categories

Resources