Pivy and PyQt4 python modules must be installed

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
La

Pivy and PyQt4 python modules must be installed

Post by La »

Hello,

I was able to compile FREECAD using r2553 from trunk, VS2008, cmake. LIBPACK 7.1 on Vista. My build folder is C:\dev\qtprojects\freecad\build-VC9

I can start FreeCAD with no problem. Is seems to be working OK.

But when I try to switch 2D Drafting (from View/Workbench/2D Drafting), I'm getting

' Pivy and PyQt4 python modules must be installed on your system to use the 2D Drafting module.'

I downloaded 'PyQt-Py2.6-gpl-4.6-1' and installed it in my C:\dev\qtprojects\freecad\build-VC9\bin\ folder.

I'm still getting the same error.

Any idea of what I should do?

Thanks,

La
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Pivy and PyQt4 python modules must be installed

Post by jriegel »

Hi,
LibPack 7.x uses Qt 4.5.x. and Python 2.6
So you need a PyQt build with this two versions....

Jürgen
Stop whining - start coding!
La

Re: Pivy and PyQt4 python modules must be installed

Post by La »

Hi,


Thanks for the answer.

The only installers I could find on riverbankcomputing site (http://www.riverbankcomputing.co.uk/sof ... t/download) are:

PyQt-Py3.1-gpl-4.6-1.exe Windows installer
PyQt-Py2.6-gpl-4.6-1.exe Windows installer
PyQt-Py2.5-gpl-4.4.3-1.exe Windows installer

I'm not sure about their naming convention but QT4.6 is not out yet so does PyQt-Py2.6-gpl-4.6-1.exe really refer to QT4.6? Where is the version for QT4.5?

Or Should I try to build PyQt from the source code?

Thanks,

La
wmayer
Founder
Posts: 20305
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Pivy and PyQt4 python modules must be installed

Post by wmayer »

Hi,

to judge by the name it really seems to be Qt 4.6 but I'm not sure about that. An installer for Qt 4.5, i.e. PyQt-Py2.6-gpl-4.5-x.exe I couldn't find either. But usually the Qt versions with the same major version are binary compatible to each other. So, theoretically it should work also with Qt 4.5 in case the installer is for Qt 4.6.

All what you need to make sure is that the directory "PyQt4" is in the search path of Python. So, the best way to check this is by starting FreeCAD and entering into the Python console:

Code: Select all

import sys
sys.path
This gives you a complete list of paths where Python can load modules from. Just copy the PyQt4 stuff into one of these dirs.

To test if the PyQt4 stuff works enter something like this:

Code: Select all

from PyQt4 import QtGui
mw=QtGui.qApp.activeWindow()
mw.setWindowTitle("Great, PyQt4 works!")
This will change the window title of the main window.

Cheers,
Werner
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Pivy and PyQt4 python modules must be installed

Post by jriegel »

Qt soft anouncing the 4.6 already, its in beta or so. Maybe the PyQt packages you got is a preview/beta one..
http://qt.nokia.com/developer/qt-4.6-preview

But anyway, it my fault, in the previews LibPacks I delivered PyQt with it. But got no time so far to
do it for the 7.x LibPack releases.

The best way is to compile it with the actual libs you use....

Jürgen
Stop whining - start coding!
La

Re: Pivy and PyQt4 python modules must be installed

Post by La »

Hi,

Here is what I do step by step.

- My build folder is C:\dev\qtprojects\freecad\build-VC9
- I install 'PyQt-Py2.6-gpl-4.6-1' in C:\dev\qtprojects\freecad\build-VC9\bin\ (the installer asks for my Python folder during the install process)
- The installer creates a folder tree where PyQTt4 is located in C:\dev\qtprojects\freecad\build-VC9\bin\Lib\site-packages\PyQt4
- I copy PyQt4 from C:\dev\qtprojects\freecad\build-VC9\bin\Lib\site-packages\ to C:\dev\qtprojects\freecad\build-VC9\bin\

using

import sys
sys.path

I'm getting

['c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\lib',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Points',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Drawing',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Part',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\MeshPart',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Test',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Draft',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Mesh',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Raytracing',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\PartDesign',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Image',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\ReverseEngineering',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Complete',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Assembly',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\Mod\\Sketcher',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\bin',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\bin\\python26_d.zip',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\src\\Main\\DLLs',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\src\\Main\\lib',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\src\\Main\\lib\\plat-win',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\src\\Main\\lib\\lib-tk',
'c:\\dev\\qtprojects\\freecad\\build-VC9\\bin']

Now when I type :

from PyQt4 import QtGui

I'm getting:

Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: cannot import name QtGui

So it seems I'm a step further but I'm still having something wrong. Could this be due to the fact that I don't have c:\\dev\\qtprojects\\freecad\\build-VC9\\bin\\PyQt4 in my sys.path?

Thanks for your help

La
wmayer
Founder
Posts: 20305
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Pivy and PyQt4 python modules must be installed

Post by wmayer »

Hi,
So it seems I'm a step further but I'm still having something wrong. Could this be due to the fact that I don't have c:\\dev\\qtprojects\\freecad\\build-VC9\\bin\\PyQt4 in my sys.path?
No, because c:\\dev\\qtprojects\\freecad\\build-VC9\\bin is in your Python path and we ask Python to load from the folder PyQt4 (which is in the path) to load a module.

I guess with PyQt installation there got no debug modules (with the suffix '_d') installed. To use PyQt4 you have to build FreeCAD in the release mode, first.

In order to get the debug modules of PyQt4 you have to build them yourself.

Werner
La

Re: Pivy and PyQt4 python modules must be installed

Post by La »

OK,

I guess, I will wait for the 7.x LibPack release with PyQt that Jürgen mentioned. I will be happy to test it as soon as it is ready.

La
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Pivy and PyQt4 python modules must be installed

Post by yorik »

One thing you can always do, it's a bit of a hack but it works, at least for testing, is to add manually the pyqt4 path to your sys.path.
Locate where your pyQt4 binaries are (C:\dev\qtprojects\freecad\build-VC9\bin\Lib\site-packages\PyQt4 I suppose)
and add that path manually to sys.path:

Code: Select all

import sys
sys.path.append("C:\dev\qtprojects\freecad\build-VC9\bin\Lib\site-packages\PyQt4")
Of course it's only a hack and it is temporary (it's not saved, you must do it everytime you restart python or freecad), but it'll allow you at least to see if pyqt4 works. One other thing you can try, is to copy your PyQt4 folder to c:\dev\qtprojects\freecad\build-VC9\Mod\ , since Freecad automatically adds all folders found in Mod to its python path. But I'm not sure it will work, because there might be other folders needed around.

One strange thing, when looking at your sys.path output, is that it reports only the paths set by freecad, and none of the usual standard python system paths... I don't know if that is normal on windows? (Jürgen or Werner, do you know that?). On linux the standard python paths are there too, which allow to use system-wide installed modules in freecad too... (The "site-packages" folder you see in the pyQt4 path is a standard place inside a python installation, to install additional modules). Have a look if your system-installed python is the same version as the freecad one?
wmayer
Founder
Posts: 20305
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Pivy and PyQt4 python modules must be installed

Post by wmayer »

One strange thing, when looking at your sys.path output, is that it reports only the paths set by freecad, and none of the usual standard python system paths... I don't know if that is normal on windows?
I think this is because of the LibPack Python. AFAIK when using the usual Python installer it creates some values in the Windows registry. One of these values defines the additional search paths. When setting up the Python interpreter in an application is reads out the registry key to set up the search paths. So, for the LibPack Python these registry entries are missing and thus the Python mechanism fails.

Werner
Post Reply