pyqt installation question - python

Im planing to do some GUI development using pyqt4 pykde and python3.1 on Kubuntu 10.4. In the research I did I found out that most of the things are available as packages in repositories and some of the packages are preinstalled. Only thing is I'm not able to figure out what to install and what not to. Can someone please give me a list of packages that I need to install to do GUI development using python3.1 pyQt4 and pyKDE.

The qt-designer is inside the new qtcreator (former package was qt-creator).
install -doc packages as you like, also look for -examples, they are very helpful.
for your convenience:
aptitude install
python31
python-qt4
python-qt4-doc
pyqt4-dev-tools
python-kde4
qtcreator
For an IDE, look in question 1 or 2

I guess you need python-qt4 qt4-designer qt4-dev-tools.

Related

QGtkStyle could not resolve GTK

I have a series of apps installed in Ubuntu 18.04 using Anaconda. They run just fine, but the menus appear as blank.
Some of these apps are:
Spyder
Orange 3
qtconsole
For all of them I obtain the same error when I execute them:
QGtkStyle could not resolve GTK. Make sure you have installed the proper libraries.
I have been trying to sort it for hours without success.
Any idea of how to fix this?
As a quick fix, add
export QT_STYLE_OVERRIDE=gtk2
to your .bashrc. Then your menus should at least have some text again.
This is not strictly speaking a GTK theming problem. Instead, this is because your Qt version is old. You need install qt=5.9.
In my case, that problem was caused because I use conda-forge channel and qt is in 5.6 version there. When explicitly install qt=5.9 from default channel the problem was solved without change .bashrc file.
I soleved it by upgrading and installing pkg-config
sudo apt upgrade && sudo apt install pkg-config
AND Jupyter series just works well!

Installing PyQt5 (incl. Qt Designer) on macOS (Sierra)

Can anyone explain (or point me to instructions on) how to install PyQt5 for macOS (Python 3.6) that includes the QT Designer application?
I've been searching the internet for the past few days and I just cannot get it to install.
I've tried the manual installation but get stuck on the --qmake and I've tried pip install PyQt5 but this does not have the Qt Designer.
Edit:
This is not a duplicate of previous question, the previous question talks to a) windows operating system and b) provides the solution of using pip install pyqt5-tools which is not available for macOS
I used brew install Qt5 and then open -a Designer will start Qt Designer. After that I installed PyQt5 with pip install pyqt5.
The QT Designer is a separate tool that uses PyQt widgets. It is not included in the PyQt5 framework which is why you won't find a PyQt5 library that comes with it. In order to acquire it you must install Qt Designer separately from your PyQt installation.
Once you have installed PyQt5, install PyQt5Designer like so:
pip install PyQt5Designer
If pip doesn't work for you I would recommend trying another package manager such as:
Homebrew https://brew.sh/
Anaconda https://www.anaconda.com/download/#maco
Macports https://www.macports.org/
If neither of these package managers work try via the stand-alone installer from this link: https://build-system.fman.io/qt-designer-download
Hope this helps.

Python 3 can't find homebrew pyqt installation

I recently used homebrew to install pyqt (along with qt & sip), but get an import error whenever I try to import PyQt4 in Python 3 (which was also installed using homebrew). To confuse matters more, I am able to import PyQt4 on Python 2 via the terminal.
I'm totally new to working with Python packages and, with that, totally confused. Any thoughts on how I might be able to undo what I did and reinstall so that I can access PyQt via the usr/local/python3 installation?
Thanks in advance!
brew reinstall pyqt --with-python3 will get you sorted!
There will be seperatelibrary files for python2 and python3. From your question, it seems that you have installed pyqt for python2 which you can't import in python3.
For python3, you have to install specific package developed for python3.
Here is a similar question regarding python3 pyqt installation using homebrew. It says, there is currently some limitation with homebrew.
Install pyqt via homebrew with `--with-python3` but still goes to Python 2
EDIT:
Developer of homebrew has resolved the issue.

How to install Pyside for Python 2.7?

Hey I am pretty new to Pyside and am not sure how to download it or Qt? I have a 64-bit Windows computer and am wondering what I need to download once I have downloaded Qt because there is a checklist for like Qt 5.3, Qt 5.2.1, etc. and I am not sure which to download because under those there are multiple options under them like MSCV2012 64-bit and mscv64-bit OpenGL. Basically I am just very lost on what I need and can't seem to find the answer. Could someone enlighten me?
Thanks!
Install pip:
Download pip installer from here and save it in a directory other than C.
If you haven't set your python path: follow this.
Open Command Prompt and cd to that directory where you saved the pip installer.
run: python get-pip.py
Install pyside:
Close and Reopen Command Prompt.
run: cd C:\Python27\Scripts
run: pip install -U PySide
PySide does not yet support the Qt 5.x branch.
Simply running pip install pyside will install bindings that support the Qt 4.8 branch. Thus, you need that version of Qt.
All the steps are mentioned in here, but for your convenience, here goes it inline:
Installing prerequisites
Install latest pip distribution: download get-pip.py [bootstrap.pypa.io] and run it using the python interpreter.
Installing PySide on a Windows System
To install PySide on Windows you can choose from the following options:
Use pip [pypi.python.org] to install the wheel binary packages by issuing the command:
pip install -U PySide
Use setuptools [pypi.python.org] to install the egg binary packages by issuing the command (deprecated):
easy_install -U PySide
Download and install the packages from the PyPI page [pypi.python.org]
Provided binaries are without any other external dependencies. All required Qt libraries, development tools and examples are included.
Then, you can grab the Qt 4.8.6 version from here:
http://qt-project.org/downloads
Please note that there is no installer for VS2012 off-hand, so you should use an older version or mingw. Alternatively, you could also build Qt 4 yourself.

How to install PyQt4 on Windows using pip?

I'm using Python 3.4 on Windows. When I run a script, it complains
ImportError: No Module named 'PyQt4'
So I tried to install it, but pip install PyQt4 gives
Could not find any downloads that satisfy the requirement PyQt4
although it does show up when I run pip search PyQt4. I tried to pip install python-qt, which installed successfully but that didn't solve the problem.
What am I doing wrong?
Here are Windows wheel packages built by Chris Golke - Python Windows Binary packages - PyQt
In the filenames cp27 means C-python version 2.7, cp35 means python 3.5, etc.
Since Qt is a more complicated system with a compiled C++ codebase underlying the python interface it provides you, it can be more complex to build than just a pure python code package, which means it can be hard to install it from source.
Make sure you grab the correct Windows wheel file (python version, 32/64 bit), and then use pip to install it - e.g:
C:\path\where\wheel\is\> pip install PyQt4-4.11.4-cp35-none-win_amd64.whl
Should properly install if you are running an x64 build of Python 3.5.
QT no longer supports PyQt4, but you can install PyQt5 with pip:
pip install PyQt5
You can't use pip. You have to download from the Riverbank website and run the installer for your version of python. If there is no install for your version, you will have to install Python for one of the available installers, or build from source (which is rather involved). Other answers and comments have the links.
If you install PyQt4 on Windows, files wind up here by default:
C:\Python27\Lib\site-packages\PyQt4*.*
but it also leaves a file here:
C:\Python27\Lib\site-packages\sip.pyd
If you copy the both the sip.pyd and PyQt4 folder into your virtualenv things will work fine.
For example:
mkdir c:\code
cd c:\code
virtualenv BACKUP
cd c:\code\BACKUP\scripts
activate
Then with windows explorer copy from C:\Python27\Lib\site-packages the file (sip.pyd) and folder (PyQt4) mentioned above to C:\code\BACKUP\Lib\site-packages\
Then back at CLI:
cd ..
(c:\code\BACKUP)
python backup.py
The problem with trying to launch a script which calls PyQt4 from within virtualenv is that the virtualenv does not have PyQt4 installed and it doesn't know how to reference the default installation described above. But follow these steps to copy PyQt4 into your virtualenv and things should work great.
Earlier PyQt .exe installers were available directly from the website download page. Now with the release of PyQt4.12 , installers have been deprecated. You can make the libraries work somehow by compiling them but that would mean going to great lengths of trouble.
Otherwise you can use the previous distributions to solve your purpose. The .exe windows installers can be downloaded from :
https://sourceforge.net/projects/pyqt/files/PyQt4/PyQt-4.11.4/
It looks like you may have to do a bit of manual installation for PyQt4.
http://pyqt.sourceforge.net/Docs/PyQt4/installation.html
This might help a bit more, it's a bit more in a tutorial/set-by-step format:
http://movingthelamppost.com/blog/html/2013/07/12/installing_pyqt____because_it_s_too_good_for_pip_or_easy_install_.html
With current latest python 3.6.5
pip3 install PyQt5
works fine
For Windows:
download the appropriate version of the PyQt4 from here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyqt4
and install it using pip (example for Python3.6 - 64bit)
pip install PyQt4‑4.11.4‑cp36‑cp36m‑win_amd64.whl
Try this for PyQt5:
pip install PyQt5
Use the operating system on this link for PyQt4.
Or download the supported wheel for your platform on this link.
Else use this link for the windows executable installer.
Hopefully this helps you to install either PyQt4 or PyQt5.
install PyQt5 for Windows 10 and python 3.5+.
pip install PyQt5
If you have error while installing PyQt4.
Error: PyQt4-4.11.4-cp27-cp27m-win_amd64.whl is not a supported wheel on this
platform.
My system type is 64 bit, But to solve this error I have installed PyQt4 of 32 bit windows system, i.e PyQt4-4.11.4-cp27-cp27m-win32.whl - click here to see more versions.
Kindly select appropriate version of PyQt4 according to your installed python version.
You can also use this command to install PyQt5.
pip3 install PyQt5
I am using PyCharm, and was able to install PyQt5.
PyQt4, as well as PyQt4Enhanced and windows_whl both failed to install, I'm guessing that's because Qt4 is no longer supported.
Try using python 3.6,
then install sip
pip install sip
then follow the steps mentioned by #Jay https://stackoverflow.com/a/48078369/8352081

Categories