PyQt for Python3?
PyQt-4.9.6 is installed with the -14.1 upgrade. I assume that it's built against Python-2.8.12.1 since that's the version installed.
I have a tool I use in which the latest version was built against Python3. I installed python3-3.3.3 and would like to learn how to buid a PyQt3 against that python version. Your guidance and advice appreciated. Rich |
PyQt should build against whichever python version you have installed. Check the build script on the Slackware source repository for direction.
|
From memory I did the following steps. There might be traps I don't remember, but it works here :)
1. If you haven't done it yet, get the source folders for "sip" and "PyQt" from the Slackware DVD or a Slackware mirror. 2. Compile and install python3 from www.slackbuilds.org 3. Recompile sip, replace all occurances of "python" (as an executable command) to "python3". I think I had to compile and install it twice, else some files were missing from the (first) package. 4. Change PyQt SlackBuild and eventually the slack-desc to point it to python3. Since you want to keep it installed and not overwrite the original PyQt package, name it something like Py3Qt. There are more places in the SlackBuild where it has to be replaced if I remember correctly. Please notice that at the beginning of the SlackBuild there is a line with "python" and "print". Make sure to put "python3" there and put the argument of "print" in parentheses, because python3 requires that. 5. I uninstalled the python3-sip and reinstalled the original one. I managed to include both PyQt for python2 and for python3 in one package. I tried the same with sip which failed. Don't know why and I was not keen enough to try it again and again. That's the reason I later removed the sip that was configured by python3 and replaced with the original one. The program that I need it for is still working and I'm absolutely not sure what would happen else :) Good luck with it and have fun compiling :D |
@tux_dude: I have both python-2.7.5 and python3-3.3.3 installed. I'd like to have PyQt for both versions, too.
@titopoquito: I tried your approach without success. Will try again later. I changed the PRGNAME to Py3QT, and the .xz file to reflect that change, and the SlackBuild script responds that it cannot find the file with that name. While I went through the script I did not see any reference to PyQt of python that I had not changed to Py3Qt and python3. Thanks, both of you. I'll let you know how it goes from here. Rich |
tar xvf ... and maybe the next line (cd ...) are the culprits I think.
|
I cannot set up a virtual build box right now, but the following SlackBuilds should work. Like I said, AFAIR I had to run the sip SlackBuild twice, but I cannot test now if it was my fault or if it works with one run, too.
sip.SlackBuild Code:
#!/bin/sh Code:
#!/bin/sh |
Hi Rich,
since you posted about this on the slackbuilds.org mailing list, a follow up (if it worked or which problem you encountered) would be nice, so that others searching about this have an answer as well. You marked this thread as "SOLVED", so did it work out in the end with the two SlackBuilds? |
titopoquito:
No, it did not work. I marked it 'solved' because I was not going to pursue building py3qt. However, my priorities have changed (based on starting a new Python/wxPython application and hitting all sorts of changes in the current versions of both). I followed the INSTALL procedures for sip, specifying 'python3 configure.py'; make; make install. Running the SlackBuild script for PyQt (specifying python3 instead of python) fails with this error message: make[2]: Entering directory /tmp/PyQt-x11-gpl-4.9.6/qpy/QtCore' g++ -c -pipe -fno-strict-aliasing -O2 -march=i486 -mtune=i686 -fPIC -Wall -W -D_REENTRANT -DQT_DISABLE_DEPRECATED_BEFORE=0x040900 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib/qt/mkspecs/linux-g++ -I. -I/usr/lib/qt/include/QtCore -I/usr/lib/qt/include/QtGui -I/usr/lib/qt/include -I/usr/include/python3.3m -I../../QtCore -I. -I. -o qpycore_chimera.o qpycore_chimera.cpp qpycore_chimera.cpp: In member function ‘void Chimera::set_flag()’: qpycore_chimera.cpp:552:50: error: ‘pyqt4ClassTypeDef’ has no member named ‘qt4_flags’ _is_flag = ((pyqt4ClassTypeDef *)_type)->qt4_flags & 0x01; ^ make[2]: *** [qpycore_chimera.o] Error 1 make[2]: Leaving directory /tmp/PyQt-x11-gpl-4.9.6/qpy/QtCore' make[1]: *** [all] Error 2 make[1]: Leaving directory /tmp/PyQt-x11-gpl-4.9.6/qpy' make: *** [all] Error 2 That's where I'm currently stuck. Rich |
Quote:
|
Top hit on Google for "‘pyqt4ClassTypeDef’ has no member named ‘qt4_flags’" is here, which suggests that the version of sip you used is too new for the version of PyQt you used.
|
Quote:
python3 from slackbuilds.org, currently 3.4.0 from the 14.1 repository sip from Slackware 14.1 source folder but build with the above posted SlackBuild, version is 4.14.2 PyQt also from Slackware 14.1 source folder with the according above posted SlackBuild, version is 4.9.6 |
Quote:
Today I upgraded python3-3.3.3 to -3.4, re-built the -14.1 sip with your script, and rebuilt PyQt with your script. Naturally, it all worked. Thanks for your patient help. Rich |
Glad you got it worked out! :)
|
Slackare 14.2 update...
For Slackware 14.2 (Slackware 64 anyway, I didn't try the
32-bit version) you should add INSTALL_ROOT=$PKG after DESTDIR=$PKG in the make install line. Otherwise .../qt/plugins/designer/libpyqt4.so is not included in the package. DAMHIKT. |
All times are GMT -5. The time now is 11:51 AM. |