I have PyQt4 installed and running with Python2.7 on Ubuntu, this works fine. Now I want to use PyQt4 with Python3.
I have been trying for several hours to install PyQt4 with Python3.4.
I installed sip-4.16.4. This worked fine.
I then tried installing PyQt-x11-gpl-4.11.3.
I get a message:
The Qt Designer plugin was disabled because a dynamic Python library could not be found.
I then ran make and had an error that Python.h could not be found. I then created a sym link as per this answer
I then ran make again I got an error:
fatal error abstractaudiooutput.h No such file or directory and compilation was terminated.
I tried a virtual environment and installed pyhton3.4 from scratch. Things progressed much further than previously but then I again got the same error with abstractaudiooutput.h.
One way to get pyQt4 working in Ubuntu:
Install Ubuntu14.04
Install virtualenv and virtualenvwrapper eg virtualenv, virtualenvwrapper
Create a python3 virtualenv
mkvirtualenv testpy3 -p /usr/bin/python3.4
Now you should see (testpy3) at start of command line.
In this shell install sip (I got it working this way but may be better to download latest from riverbankcomputing as per pyQt below)
pip install sip
make
sudo make install
download pyQt from http://www.riverbankcomputing.com/software/pyqt/download
cd to the download folder, unpack the downloaded file. cd into the unpacked folder.
type
python configure-ng.py
make
sudo make install
Now test with
python
>>import PyQt4
This should work without errors.
Now in PyCharm
file->settings->Project:Project Interpreter select the gear icon on topRHS->add local navigate to your testpy3 virtualenv (eg in /home/user/.virtualenvs). Through PyQt4 doesn't appear in the package list, PyCharm detected it and PyQt4 gui's are working for me.
Related
gdal is correctly installed on my global system's python 3.5 packages.
But now I'm trying to pip install gdal on my python 3.6 virtual environment, but I receive multiple errors.
After activating the virtual environment, I've tried the following:
pip install pygdal or pip3 install pygdal
Error received: ERROR: Failed building wheel for pygdal
Tried following this guide, but the commands stated there are outdated
I've also tried this solution and this which failed
Installed older gdal versions but also didn't work.
Tried pip3 install GDAL==$(gdal-config --version) and I get the same error
I use
Ubuntu 16.04 and pip 21.0.1. Venv was created using virtualenv --python=/usr/bin/python3.6 my_venv
I've finally fixed the problem, and these are the steps I followed:
I uninstalled wheel from my venv
Then I pip installed gdal on the venv to check what error would appear
A wall of error text appeared, in which somewhere I noticed the 'x86_64-linux-gnu-gcc' failed with exit status 1
I typed sudo apt-get install python3.6-dev to install missing packages, as the solution suggests here
Then I ran pip install GDAL=<version that appears on ogrinfo --version> and it worked
EDIT: This answer pertains more to Windows than Ubuntu, but may have something useful.
Try downloading a wheel from here:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
Note the "cp##" in the middle - that should match your Python version. If you are running Python 3.6 then you should see "cp36" in the file name (a "cp37" in the name means the wheel will fail). Also pay attention to the amd64 and win32 to be sure you have the correct version to match your Python virtual environment.
I'm on Windows instead of Ubuntu, but this was my process:
Open command prompt with cmd
Copy the path to activate.bat in the virtual environment from Windows Explorer (hold shift down, right-click on file, choose
"copy as path")
Paste path into control panel and hit enter. You should see an indicator that you are in virtual environment.
Copy the path to the wheel you downloaded to the clipboard using the same shift key trick.
Type 'pip install ' then paste the wheel path from your clipboard (or type it all out manually)
As an aside, I ended up with gdal installed within the osgeo module. I tried several things before I got here, but I'm pretty sure that happened with my installation from the wheel. In Python, I now use
from osgeo import gdal
I hope something here helps you. I've run into this a few times and it never seems like I quite remember how I got it done the next time I run into it. If I remembered it right this time, I can refer back here.
FWIW - I am using PyCharm and installing gdal through the Project Interpreter doesn't work. Also, it may take some jostling in PyCharm for the skeletons to update after you install through command prompt.
I tried to install the pyqt5 package für python 3.9 on Mac.
Since it didn't work via pip3 I installed it via Homebrew
% brew install pyqt5
and it seemed to work since the terminal says, if I try
pip3 install pyqt5
the requirements are already satisfied.
Yet, if I start PyCharm to to write and test my program it can't find the libraries etc.
What do I have to do?
I just tried to brew install pyqt5 on my Mac. brew then installed a new Python 3.9 interpreter (this is viewed as a dependency of pyqt5).
I suspect the same has happened on your system: brew has installed a whole new Python interpreter, and now when you type pip3 at the command line, you're finding the version of pip installed by brew, which is telling you that pyqt5 has been installed.
However, each Python installation on your system as its own set of packages. Your new Python interpreter has pyqt5 installed, but your original Python interpreter still doesn't.
I suspect that PyCharm is configured to use your default (original) Python interpreter, which doesn't have pyqt5 installed.
Try executing the following at your command prompt (terminal): which pip3. If you're shown a path /usr/local/Cellar/... then this confirms that when you type pip3 at the command line you're actually referring to the version of pip corresponding to a Python interpreter installed by brew.
OK, so what to do going forward?
Two options:
Work with this new Python installation. Then, you'll need to install all of the packages in your previous version of Python again (e.g. just because you had Numpy installed on your original Python installation doesn't mean you'll have it installed by default for your new Python interpreter). Further, you'll have to configure Pycharm to use this Python installation. I don't know the exact steps for this, but go to the Preferences tab and look for something along the lines of 'Python Interpreter' underneath 'Project Settings'.
Remove the new Python installation, figure out what's up with pip, install your desired package.
I'd go with 2). It can get messy to have multiple different versions of Python on your system, unless they're managed by an environment manager such as conda.
To that end, what went wrong when you first tried to install pyqt5?
I work with Anaconda 5.3.0 and Python 3.7.
An application was made and I want to create an executable file with Pyinstaller, the case is that I miss the following error:
Exception: Cannot find existing PyQt5 plugin directories Paths
checked:
C:/Miniconda3/conda-bld/qt_1535195524645/_h_env/Library/plugins
According to this GitHub error report, there are two main solutions:
Run pip install PyQt5 to install the module
Include the flag --exclude-module PyQt5 to prevent pyinstaller from trying to include it
The latter seems to work for me.
In the anaconda command prompt try pip install PyQt5. It solved the issue for me.
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
I have a 32-bit Windows 7 OS. Today, I tried downloading the PySide setup program. However, after I try running the downloaded file, I get the following error: "PySide Setup program invalid or damaged."
Why am I getting this? I have recently started a course on building GUI applications with Python using the Qt framework, and need PySide for the same. I use Python 2.7 btw.
My solution to nearly the same exact problem was simply that it needed to be installed with admin privileges, so that might be your issue also.
Try it using Pip.
download that https://bootstrap.pypa.io/get-pip.py and run it with your python.
then open a cmd window at your pip instal directory in my case: C:\Python27\Scripts
then type in: pip install -U PySide