ImportError: No module named direct.directbase.DirectStart

I have a current OSX (10.10.3) with current xcode tools. I just installed the latest stable panda and tried the asteroids demo.

This problem has been posted before but the replies don’t seem to fix the problem. I recently installed MacPython which may be relevant because it installs a different python but I thought ppython was supposed to work around such conflicts. I get the same error if I use /usr/bin/python instead. I am an experienced unix/python developer though not on the Macintosh.It would help if I knew such things as where panda gets installed and how that location is passed to the python interpreter. Automated installers are simple to use but they hide all details needed for debug.

papa:Asteroids steve$ ppython Tut-Asteroids.py
Traceback (most recent call last):
File “Tut-Asteroids.py”, line 13, in
import direct.directbase.DirectStart
ImportError: No module named direct.directbase.DirectStart

papa:Asteroids steve$ pwd
/Developer/Examples/Panda3D/Asteroids

papa:Asteroids steve$ ppython -V
Python 2.6.9

papa:Asteroids steve$ /usr/bin/python -V
Python 2.7.6

papa:Asteroids steve$ /usr/bin/python Tut-Asteroids.py
Traceback (most recent call last):
File “Tut-Asteroids.py”, line 13, in
import direct.directbase.DirectStart
ImportError: No module named direct.directbase.DirectStart

Hi, welcome to the forums!

What I’m guessing is that you installed MacPython on top of the built-in Python installation, which is bad. In general, on Mac OS X, it is better not to mess with the Python installation. Is there a reason why you can’t use Apple’s provided Python version?

Also make sure that you installed Panda 1.9.0, not 1.8. 1.9.0 addresses some important issues relating to Mac 10.10.

To help diagnose the issue, you should run ppython and print out sys.path.

Thanks for your help rdb… I’m having the same issue. Running OSX 10.10. I get the exact same error:

import direct.directbase.DirectStart
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named direct.directbase.DirectStart

I printed out sys.path and got this:

i also used these to check my python version, but I get different results from python -V and ppython -V:

Hopefully this can help you point me in the right direction. Thanks in advance! :smiley:

Perhaps you accidentally installed the 10.6 build instead of the 10.7 build? You need this one:
panda3d.org/download/panda3 … SX10.7.dmg

rdb, you are awesome! A lot of your posts on other threads have helped me too :smiley:

However, I still have one more question
When I run asteroids/main.py in IDLE:

ImportError: No module named direct.showbase.ShowBase

It runs if I use “ppython main.py”, but is there a way to get IDLE to recognize the modules? (I’m gonna take a guess that it might have something to do with the version of python IDLE is running?) Thanks!

Yes, perhaps IDLE is using a different Python version. If it’s a compatible version, you might be able to get it to recognise the Panda3D modules by placing a .pth file in the right location, but I wouldn’t count on it.