Mac OS X: ImportError: No module named pandac.PandaModules

Hey there!

I’m working with Mac OS X.
Python is running and Panda seems to work, too. At least the first step of the tutorial does work properly.
BUT: I do not have “ppython” - is this mac-related?

Working with Eclipse and PyDev (this is a different project):

Starting the second tutorial-step using the shell (“python”), i get the following:

I tried this with Python 2.3 and 2.5 - same procedure.

um… you’re running it with python instead of ppython…

for panda3d python files you must use ppython or your computer will think it’s a normal python file… so you will not be able to use the panda3d libraries.

Sounds understandable to me.
But I don’t have “ppython” … how to fix this?

Do you have Panda3d installed? How did you do it?

Yeah, Panda3D is installed - I used this tutorial

I don’t know anything about Mac (is it UNIX-based, by the way?)
do you have ppc or intel?
but, how did you run your python files?
with the PythonLauncher?
(Have you tried to enter in your console: “ppython filename”??)

Yes, Mac OS X is UNIX-based - Python is preinstalled.
I tried to run “ppython filename”, but there is no ppython.

probably not correct installed OR ppython has another name on Mac OR you have to run it in a different way…
isn’t there ANY tutorial for panda3d on macosx that would explain it?

Don’t worry about “ppython.” At some point in the past, I created a little script called “ppython” which would put the panda libraries into the python path, and then call python. That little script is obsolete, it’s no longer necessary in any distribution. Panda programs just use regular python now.

But, the problem you’re having is that clearly, the panda libraries aren’t in the python path. To fix it, you have to add the panda libraries to the python path. I don’t know enough about the details of the mac version to know where the panda libraries are, or how to edit environment variables on a mac, or that sort of thing, to be able to walk you through it. You should ask whomever wrote that tutorial.

Thank you guys!
Somehow it seems to work now - with Python 2.4 (2.3 and 2.5 still throw a version-mismatch).
There was a problem in my Panda3D-Installation, too. After a successful installation, there was no models-directory. I took a copy from my Windows-installation and fixed it … this works.

I know this is an old topic but i’m trying to set up Panda in Eclipse with PyDev in osx 10.4 and running into this same problem. I have all my paths set correctly, I added /usr/local/panda/lib, /usr/local/panda/lib/direct, /usr/local/panda/lib/pandac and every other permutation of those that I could think of to the path in pydev, but it throws an error when I try to import pandac.PandaModules.

Also, “from direct.task.Task import *” works fine, so it can locate in the path, but when I try “from direct.task.Task import Task” it can’t resolve it. Anyone know what I have to do to fix these errors?

Does it work properly outside of Eclipse? Do you have any other Panda trees that might be conflicting?


Yeah, I can run it just fine outside of eclipse. And it looks like now it can find PandaModules after I put all of the paths into PYTHONPATH again, but I still have the problem where it can’t find the classes inside the files to import

Still not sure what’s going on here but I did notice that I’m only having this problem with files in my src/ subdirectory. I have a in the root below that, and Eclipse/PyDev has no problem importing things there.

Also, I get this error when I try to run it, even though it runs fine outside of Eclipse:

Traceback (most recent call last):
  File "/Users/matt/Documents/workspace/Game/", line 2, in <module>
    from pandac.PandaModules import WindowProperties, Vec3
  File "/usr/local/panda/lib/pandac/", line 1, in <module>
    from libpandaexpressModules import *
  File "/usr/local/panda/lib/pandac/", line 1, in <module>
    from extension_native_helpers import *
  File "/usr/local/panda/lib/pandac/", line 38, in <module>
    from libpandaexpress import *
ImportError: dlopen(/usr/local/panda/lib/, 2): Library not loaded: libpandaexpress.dylib
  Referenced from: /usr/local/panda/lib/
  Reason: image not found

This error is because your DYLD_LIBRARY_PATH environment variable is not correctly set. Still scratching my head over the other one.


Not sure why it wouldn’t be set correctly, it runs fine when I run it outside of eclipse. And I’m using the same copy of python to run it in both places.

Well, how is it set when you run within eclipse? You can check this:

import os

Who knows, maybe eclipse itself is changing this.
Another interesting thing to compare inside and outside of eclipse is sys.path.


Any idea how to check and/or change these in eclipse or pydev?

I just showed you the Python commands to check them. Is there some reason you can’t run these commands within eclipse?


Sorry, long day, I didn’t even see the python commands there. :blush: