Panda and Python 2.5

I have Python 2.5 installed on my machine (Windows) and would like to use it instead of the python that is distributed with Panda. Does anyone know of any issues with using 2.5 versus 2.4 with Panda? Will I have to compile both Panda and Python or should it work out of the box with some tinkering on paths, etc? If it requires only path mods what are they?

Thanks a heap in advance :smiley:


In principle, you can compile Panda to work with any version of Python. However, there is a particular fundamental incompatibility with Python 2.5 on Windows.

The problem is that the Python team changed the rule for importing extension modules in Python 2.5. Previously, you could import a .dll or a .pyd file as a Python module (the files are the same except for the extension). Beginning in Python 2.5, for some reason they decided to specifically disallow importing a .dll file; all Python modules must now be named .pyd. The problem is that Panda is compiled to a number of .dll files that serve both as standard Windows dll’s and as Python modules. We cannot name them .pyd, because then Windows will not be able to import them as dll’s. We cannot name them .dll, because then Python will not be able to import them. So we have a problem.

Eventually, we will have to solve this by creating two files: a standard Windows .dll file, as we have now, and a stub .pyd file that can be imported into Python and simply loads in the .dll. Until then, you may have trouble building Panda for Python 2.5.

This problem is specific to Windows. There are no changes to the import rules for non-Windows platforms.


any solution ?

We haven’t made this particular problem a priority, so we’ve been working on other problems instead, especially as we’ve been working on getting our games out the door here at the VR Studio. It will become more important to us in the near future, though.


could you just duplicated each dll as pyd too for now?

No, that doesn’t work. It loads two copies of the DLL, so you get two copies of each global variable. Not good.

There actually is a way to import a DLL file from python 2.5 - it’s just that “import libpanda” doesn’t work. You have to use the python import function instead. So that would be the workaround.

can we aim on this work around for the next release?

Go ahead. :slight_smile:

There should be a BIG Note on this problem on the download page. I just install panda 1.4.2 for window and wondered why not even the demo programs would run. I am not uninstalling it. and going to try to reinstall and tell it NOT to use the registry key.

Well that did not work. Upon reinstall it does not even prompt you to use the python registry key or not. GRRR can someone PLEASE help me

When you install panda for windows, it also installs a copy of python 2.4 — ie, the right version. If you have a copy of python 2.5 installed too, it doesn’t complain, because you’re allowed to have two versions of python installed.

To run panda code, you have to use python 2.4, though — most people use the one included with panda. If you try to use your own python 2.5 instead, it won’t work.

To run the right copy of python, if you have multiple copies installed on your machine, you might have to use an absolute path, ie:


I should also mention that any python-loadable DLL is compatible with only one version of python. That’s just the way python works. This website distributes DLLs compiled for python 2.4.

Josh. So just confirm for me i would need to start every panda program with C:\panda3d-1.4.2\python.exe\thepanda3dprogram including the path to it…py From the command line?

You’d type something like this:


I guess my previous question was related to what woudl happpen if the py file is not in C"\Panda3d-1.4.2\python\ But I see it now. Never mind.
I HAVE to switch back to 2.5 Several of my blender plugins will not work with 2.4.4 and I need those
I hope this situation will be corrected soon

I hate to keep bugging you about this Josh but could you give me and example of the above.

I don’t know how to do it. I’ve just heard that it’s possible. If I knew how to do it, we’d have python 2.5 support.

Maybe this can help you.

The equivalent for import X is:
re = import(‘X’)

More info can be found here.
The same effect can be achieved using the imp module. Examples on that are found here.

Josh I had to go back to python v. 2.5.1 There is a certain script for blender that I have to have that will not run without it.

So I tried your solution of running panda scripts with the version of python 2.4 that comes with Panda directly from the command line. I tried it on one of the samples that come with panda3d 1.4.1 this is the error I got in the cmd box.

‘import site’ failed; use -v for traceback
DirectStart: Starting the game.
Traceback (most recent call last):
File “”, line 8, in ?
import direct.directbase.DirectStart
File “C:\Panda3D-1.4.2\direct\src\directbase\”, line 3, in ?
from direct.showbase import ShowBase
File “C:\Panda3D-1.4.2\direct\src\showbase\”, line 10, in ?
from pandac.PandaModules import *
File “pandac\”, line 5, in ?
File “pandac\”, line 12, in ?
File “direct\src\directnotify\”, line 3, in ?
File “direct\src\directnotify\”, line 5, in ?
File “direct\src\directnotify\”, line 6, in ?
File “direct\src\showbase\”, line 40, in ?
File “C:\PYTHON25\LIB\”, line 41, in ?
from warnings import warn as _warn
File “C:\PYTHON25\LIB\”, line 264, in ?
simplefilter(“ignore”, category=ImportWarning, append=1)
NameError: name ‘ImportWarning’ is not defined


It seems by the last to lines the even so somehow python 2.5 is being looked at.

Can you make a dummy class in that file called ImportWarning that inherits from exception?

I think maybe you have to use python.exe and not “ppython.exe”.