You are not logged in.

#1 2014-03-21 19:52:09

chinchi
Member
Registered: 2013-07-11
Posts: 9

Can't import python modules anymore: Problems with PyQt4.Qt

Hallo,

at the beginning: Sorry for my horrible english!
I made a big mistake and a possible stupid thing:
I yesterday try to install SIP and Ppyqt4 under a virutal enviroment because I want to use SIP for creating
generator codes between pyhton and C++.
I got SIP from the AUR's:
archlinux.org/packages/extra/x86_64/python-sip/
and installed it this way:
lucacerone.net/2013/08/installing-pyqt4 … yx-dGd_phF   

I did it this way because on the official SIP-documentation site I didn't understand, WHERE to install this:
pyqt.sourceforge.net/Docs/sip4/installa … onfiguring

I know now, that was a very stupid idea because when I try to run a pyhton script with:

python programm_file.py

, I got the follwing errors importing a module in a python script:

[vain@chinchi2 python_programme]$ python test.py             
Traceback (most recent call last):
  File "test.py", line 25, in <module>
    import matplotlib.pyplot as plt
  File "/usr/lib/python3.3/site-packages/matplotlib/pyplot.py", line 98, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/usr/lib/python3.3/site-packages/matplotlib/backends/__init__.py", line 28, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/usr/lib/python3.3/site-packages/matplotlib/backends/backend_qt4agg.py", line 13, in <module>
    from .backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
  File "/usr/lib/python3.3/site-packages/matplotlib/backends/backend_qt4.py", line 21, in <module>
    import matplotlib.backends.qt4_editor.figureoptions as figureoptions
  File "/usr/lib/python3.3/site-packages/matplotlib/backends/qt4_editor/figureoptions.py", line 13, in <module>
    import matplotlib.backends.qt4_editor.formlayout as formlayout
  File "/usr/lib/python3.3/site-packages/matplotlib/backends/qt4_editor/formlayout.py", line 51, in <module>
    from matplotlib.backends.qt4_compat import QtGui,QtCore
  File "/usr/lib/python3.3/site-packages/matplotlib/backends/qt4_compat.py", line 56, in <module>
    from PyQt4 import QtCore, QtGui
RuntimeError: the sip module implements API v11.0 but the PyQt4.QtCore module requires API v10.1
[vain@chinchi2 python_programme]$ 

I then upgraded PyQt4 to PyQt 5 with pacman and

pyqt5-common 5.2-1 [installed]
python-qscintilla-common 2.8-1 [installed]
qscintilla 2.8-1 [installed]

But there is still the same RuntimeErroe with PyQt4. Maybe there exists false dependencies for the shared libraries? How can I get
rid of these errors, I need pyhton for programming a project. What can I do to solve it?

Every answer which could help is welcome!

Last edited by chinchi (2014-03-21 20:59:25)

Offline

#2 2014-03-22 12:53:01

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,567

Re: Can't import python modules anymore: Problems with PyQt4.Qt

Note : i know very little about the packages involved here.

Both of those guides you mention deal with MANUALLY installing sip & pyqt, and that is almost always a BAD idea on archlinux.

Since you also seem to have installed both with pacman, you likely now have a mix of 2 different sip & pyqt installs in one system.

to make things work again, you'll have to clean up your system.
basically that would mean removing the sip & pyqt with pacman, then figuring out what those manual installs added and remove that also.

it will be tricky and time consuming, reinstaling seems like a much easier and faster method.

Once you have succesfully re-installed or cleaned up, just install sip & pyqt through pacman and you should be good to go.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2014-03-22 16:17:01

chinchi
Member
Registered: 2013-07-11
Posts: 9

Re: Can't import python modules anymore: Problems with PyQt4.Qt

Lone_Wolf wrote:

Note : i know very little about the packages involved here.

Both of those guides you mention deal with MANUALLY installing sip & pyqt, and that is almost always a BAD idea on archlinux.

Since you also seem to have installed both with pacman, you likely now have a mix of 2 different sip & pyqt installs in one system.

to make things work again, you'll have to clean up your system.
basically that would mean removing the sip & pyqt with pacman, then figuring out what those manual installs added and remove that also.

it will be tricky and time consuming, reinstaling seems like a much easier and faster method.

Once you have succesfully re-installed or cleaned up, just install sip & pyqt through pacman and you should be good to go.


Hi,
I uninstall sip with:

sudo pacman -Rsc sip 

also Pyqt and reinstalled them again with Pyqt5 and the new version of sip 4.15.4, so have not more errors like:

 from PyQt4 import QtCore, QtGui
RuntimeError: the sip module implements API v11.0 but the PyQt4.QtCore module requires API v10.1

It improved. But I can't still load several Python modules like matplotlib:


File "erstenprog.py", line 26, in <module>
import matplotlib.pyplot as plt
ImportError: No module named 'matplotlib'

Any idea?
chinchi

Offline

#4 2014-03-22 16:24:58

chinchi
Member
Registered: 2013-07-11
Posts: 9

Re: Can't import python modules anymore: Problems with PyQt4.Qt

Heureka!

It worked, I installed sip and Pyqt5 instead of Pyqt4, downloaed the matplotlib for pyhton 3 and it worked fine!
But I'm confused with the SIP Installation of the official SIP-documentation website here:


http://www.ics.uci.edu/~dock/manuals/si … troduction

, do I have to configure the configure.py file, how I'm supposed to it in which directory?

any idea?

Last edited by chinchi (2014-03-22 18:46:40)

Offline

Board footer

Powered by FluxBB