How to get QtWebEngineView in ptqt5 using python 3.4 on windows? - pyqt

I tried pyqt 5.5 but it's showing unused import...unable to find keyword qtwebengineview or qt webenginewidgets Thanks..appreciate your time

You can fix the issue now by updating to pyqt5.9,
pip install PyQt5 --update
should do the trick. Once it's installed you'll need to import it with:
from PyQt5.QtWebEngineWidgets import QWebEngineView

Related

PyInstaller weird PyQt5.sip import causes a failed EXE [duplicate]

After upgrading to python-pyqt5 5.12-2 I get this error when I try to import from QtWidgets
from PyQt5.QtWidgets import *
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.sip'
Any idea on how can I solve this issue?
The reason is a backward incompatible change in PyQt-5.11
In geoptics this fix works on old and new versions:
try:
# new location for sip
# https://www.riverbankcomputing.com/static/Docs/PyQt5/incompatibilities.html#pyqt-v5-11
from PyQt5 import sip
except ImportError:
import sip
As suggested here pyuic5 - ModuleNotFoundError: No module named PyQt5.sip
Try uninstalling and re-installing all PyQt related libraries:
pip uninstall PyQt5
pip uninstall PyQt5-sip
pip uninstall PyQtWebEngine
Then install them again, this will fix:
ModuleNotFoundError: No module named 'PyQt5.sip'
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'
PPS.:If you got problems uninstalling the libraries, go to your Python folder, like C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python<PYTHON-VERSION>\Lib\site-packages and manually delete the PyQt folders, them uninstall everything and install again (Make sure you have the latest Python version and upgraded your pip too)
If you're building sip and PyQt5 from source using make files, make sure to check PyQt5 install docs. In particular,
Note
When building PyQt5 v5.11 or later you must configure SIP to create a
private copy of the sip module using a command line similar to the
following:
python configure.py --sip-module PyQt5.sip
If you already have SIP installed and you just want to build and
install the private copy of the module then add the --no-tools option.
You should add PyQt5.sip to hidden imports; that should solve the issue.
I repaired this problem
This problem occurred when upgrading pyqt5 version 5.15.0
There was no problem when I reverted to the previous version.
I have
python -V: 3.7.4
PYQT5 5.14.1 and PYSIDE 5.14.1 works fine
In addition to the answer provided by Tadeu (https://stackoverflow.com/a/58880976/12455023) I would also suggest checking version of your libraries to make sure that they match.
Use pip show <library_name>
This will help you to make sure that no earlier installation is conflicting with your current installation.
In place of library_name use PyQt5, PyQt5-sip, PyQtWebEngine. If any of them is present in the system, then use pip uninstall <library_name>==<version_number> to remove that library.
Once you made sure that no other versions of these libraries are there, then you can reinstall the preferred version of that library.

How to use PyQt4 with Python 3.6?

I need to import PyQt4.QtGui, PyQt4.QtCore and PyQt4.QtWebKit for my script.
since i couldnt find a 3.6 version of PyQt4, i used the latest PyQt4 release i got:
PyQt4-4.11.4-gpl-Py3.4-Qt4.8.7-x64
When i tried to run my script it says
from PyQt4.QtGui import *
ImportError: DLL load failed: module not found.
i tried several "solutions" and read everything i found, but until now nothing helped.
Can't PyQT4 (x64) be used under Win10 Home with Python 3.6 (x64) being installed?
Or did i miss something?

How to install mpl_finance in python 3.6 [duplicate]

I am trying to import matplotlib.finance module in python so that I can make a Candlestick OCHL graph. My matplotlib.pyplot version is 2.00. I've tried to import it using the following commands:
import matplotlib.finance
from matplotlib.finance import candlestick_ohlc
I get this error:
warnings.warn(message, mplDeprecation, stacklevel=1)
MatplotlibDeprecationWarning: The finance module has been deprecated in mpl 2.0 and will be removed in mpl 2.2. Please use the module mpl_finance instead.
Then instead of using the above lines in python I tried using the following line:
import mpl_finance
I get this error:
ImportError: No module named 'mpl_finance'
What should I do to import candlestick from matplotlib.pyplot?
I've stopped using mpl_finance (and plotly) since they are too slow. Instead I've written an optimized finance plotting library, finplot, which I use to backtest up to 107 candles.
Here's a small example:
import yfinance as yf
import finplot as fplt
df = yf.download('SPY',start='2018-01-01', end = '2020-04-29')
fplt.candlestick_ochl(df[['Open','Close','High','Low']])
fplt.plot(df.Close.rolling(50).mean())
fplt.plot(df.Close.rolling(200).mean())
fplt.show()
Examples included show SMA, EMA, Bollinger bands, Accumulation/Distribution, Heikin Ashi, on balance volume, RSI, TD sequential, MACD, scatter plot indicators, heat maps, histograms, real-time updating charts and interactive measurements; all with sensible defaults ready for use.
I do dogfooding every day, drop me a note or a pull request if there is something you want. Hope you take it for a spin!
In 2020, one can now pip install mplfinance
What this warning tells you is that the finance module will be removed at some point.
At the moment you don't need to worry about this warning. It will only affect you when you update to a yet to be released version 2.2 of matplotlib, in which case you'll need to change your imports.
If you already want to be compatible with future versions now, you can download the mpl_finance module from
https://github.com/matplotlib/mpl_finance .
After having downloaded the files, you may install in the usual way,
python setup.py install
Alternatively you may try installing through pip,
pip install https://github.com/matplotlib/mpl_finance/archive/master.zip
The reason for this is that the people at matplotlib want to keep their code clean and not maintain a specialized sidepackage like this in the main code. They probably also do not want to maintain the package and spend resources on it, which can be better used in the core development.
Since mpl_finace is not on pip now, you may also want to use following command to install mpl_finance by pip:
pip install https://github.com/matplotlib/mpl_finance/archive/master.zip
mpl_finance is no longer part of matplotlib. Install the module directly from gitHub via pip
pip install https://github.com/matplotlib/mpl_finance/archive/master.zip
and import it with
from mpl_finance import candlestick_ohlc
Then it works the same as before.
There is a new version of matplotlib finance, with documentation, here:
https://pypi.org/project/mplfinance/
https://github.com/matplotlib/mplfinance
Install with:   pip install --upgrade mplfinance
Or with:   conda install -c conda-forge mplfinance
NOTE: The package name no longer has the dash or underscore:
It is now mplfinance (not mpl-finance, nor mpl_finance)
I'm working on google colab , i got the same problem . then what i did -for python3.6
import mpl_finance
from mpl_finance import candlestick_ohlc
Plotly.py, a web-browser based, interactive plotting module has finance plotting functions https://plot.ly/python/candlestick-charts/. And it is maintained.
Simply use pip install mpl_finance for Windows or pip3 install mpl_finance for Linux/Unix for installation.
Then use from mpl_finance import candlestick_ohlc to call the library in the Jupyter notebook!
Replace from matplotlib.finance import candlestick_ohlc with from mplfinance.original_flavor import candlestick_ohlc , That should work.

Use PyQt5.QtWebEngineWidgets on Windows: is it possible?

I am trying to build an app in PyQt5 (version 5.6+) in Python 3.6. It contains a web browser, using QtWebEngineWidgets.
It works fine on Mac, however, there are problems on Windows.
When I run the code on Windows and import the module:
from PyQt5 import QtWebEngineWidgets
I get the following error:
ImportError: cannot import name 'QtWebEngineWidgets'
Now, reading some forums it looks like PyQt5.QtWebEngineWidgets is not available for Windows, yet. Is it correct?
How can I have a web browser window, then?
I found online I could use QtWebKit, but according to here it seems QtWebKit was removed in Qt5.6.
So what? Do I have to downgrade PyQt version?
I can't go under 5.6 in Python 3.6 anyway. Do I have to change Python version as well?
you can try one of these solution ,
install old version :
pip install PyQt5==5.11.3
or install :
pip install PyQtWebEngine
u can download PyQt5.6 from here:
https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.6
QtWebKit got deprecated upstream in Qt 5.5 and removed in 5.6. Beacuse The QtWebEngineWidgets module is better than QtWebkit.
The example directory has many examples about QtWebEngineWidgets
Yes, its possible to use QtWebEngineWidgets on Windows.

PyGObject for Python 3.5.1?

I am using Debian Linux, and I have the package python3-gi installed from Synaptic, and this works fine if I use my Python 3.4 interpreter. But, when I run a Gtk+3 program using 3.5, it gets stuck at the from gi.repository import Gtk line, saying there's no module named Gtk. Additionally, I don't think that pip works for Python 3.5 on my computer, although I'm not sure. I just know that pip install PyGObject doesn't work. Finally, when I try to use Pycharm's specific package installer (Settings/Project Interpreter), Pycharm tells me that I don't have Python packaging tools installed (and it fails to install them when I click on the prompt it gives).
I have a 64 bit computer, Python 3.5 is installed to /usr/local/bin/ and Python 3.4 is installed to /usr/bin/.
You cannot use pip, you would have to download pygobject and build it from source yourself. https://download.gnome.org/sources/pygobject/
This is how I got Python 3.6 up and running with GStreamer bindings etc. on my Mac OS Sierra.
Follow from Step 1 if you have already installed Gstreamer and its plugins and you need to bind it to your python interpreter for development.
0a- Install gstreamer from their website ...normally and then
0b- brew install gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav
1- brew install gst-python --with-python3
Note however that the 'gtk' for some reason doesn't come pre-bundled so we go to step 2.
2- brew install gtk+3
And that's it, easy as ABC...
Attached is a test python code to make sure you got everything right [OPTIONAL]
import gi, time, sys
gi.require_version('Gst', '1.0')
gi.require_version('GstBase', '1.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GObject, Gst, GstBase, Gtk, GObject
class Main:
def __init__(self):
Gst.init(None)
self.pipeline = Gst.Pipeline()
self.audiotestsrc = Gst.ElementFactory.make('audiotestsrc', 'audio')
self.pipeline.add(self.audiotestsrc)
self.sink = Gst.ElementFactory.make('autoaudiosink', 'sink')
self.pipeline.add(self.sink)
self.audiotestsrc.link(self.sink)
self.pipeline.set_state(Gst.State.PLAYING)
time.sleep(3)
self.pipeline.set_state(Gst.State.PAUSED)
self.pipeline.set_state(Gst.State.READY)
self.pipeline.set_state(Gst.State.NULL)
sys.exit(0)
start = Main()
Gtk.main()
Hope er'thing works out, c ya!!

Resources