1

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.

Community
  • 1
  • 1
Don Smythe
  • 9,234
  • 14
  • 62
  • 105
  • These kind of problems are very time consuming. I would prefer to use Ubuntu 14 where Python3 is default. – Netro Nov 16 '14 at 14:07
  • @Netro Was putting it off but just upgraded. Thanks – Don Smythe Nov 18 '14 at 12:39
  • OK, I installed Ubuntu 14.04, then set-up a virtuanenv and installed sip and pyqt4 into a virtualenv project. http://stackoverflow.com/questions/4010842/python-2-7-cannot-import-pyqt4 and http://problemssol.blogspot.com.au/2010/12/compile-and-install-pyqt4-for-python27.html were helpful for this. Now I can see /virten/lib/python3.4/site-packages/PyQt4 and running the virtenv in terminal I can import PyQt4. However in pyCharm->Project Interpreter->virtenv the PyQt4 package is not there - all other packages in the site-packages directory are there :-( – Don Smythe Nov 22 '14 at 01:00
  • I found that although PyQt4 doesn't appear in the package list it is still recognised by the interpreter and all works now. – Don Smythe Nov 22 '14 at 01:48
  • gr8. may be you can write your own awnser and accept it. :D – Netro Nov 22 '14 at 17:24

1 Answers1

2

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.

Don Smythe
  • 9,234
  • 14
  • 62
  • 105