Import error

I am running Ubuntu Linux 7.10. I d/l the feisty.deb of panda3d. Then I installed it. When I go to run a test I get the following error message:

File “Tut-Boxing-Robots.py”, line 7, in
import direct.directbase.DirectStart
ImportError: No module named direct.directbase.DirectStart

I am following the test instructions in the online manual.
Any help wold be appreciated.

Thanks in advance.

Following links may help :slight_smile:

https://discourse.panda3d.org/viewtopic.php?p=15421&sid=acba6c9b7560f5684cff9910f47a4bc3

https://discourse.panda3d.org/viewtopic.php?t=2635

The problem is that gutsy and feisty don’t use the same version of python. Panda was compiled for feisty’s python, but gutsy’s python can’t load those DLLs.

I think the latest daily build has a gutsy DEB.

Is this this the most recent build: panda3d-2007.12.11.tar.gz?

Yes.

Per the install-mk instructions in the docs folder. I am missing teh following folders: Makefile and SceneEditor. Any way to just get these 2 folders. They were not in the source code d/l.

Wait a second. Both gutsy and feisty use Python2.5, and the feisty deb works fine on gutsy (at least here). So the problem must be something else.

Ok, then I will start from scratch again. I will remove the current version of panda3d on my system. Then re-install using the .deb file.

ok, here is where I am at this point in time: I have reinstalled panda3d via the .deb file. I didn’t have a panda.pth in the /usr/lib/python2.5/lib-dynload,
so I put one in with /usr/share/panda3d as the path.

Next when I tried to run a test I still get errors.

So I typed in python at the cmd line. Then manually typed in the command. Here I what I received:

Python 2.5.1 (r251:54863, Feb 6 2008, 17:01:20)
[GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

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

I get the same version info for python when I type in python2.5.

So From what I gather from the info above it can’t find the directstart.py.

But I have Found it. It in the following location: /usr/share/panda3d/direct/src/directbase folders.

How can this be corrected so it will work.
I have used the following download to creat this location:
panda3d_1.4.2-ubuntufiesty_i386.deb

Thanks in advance.

Open python’s interactive shell, and type this:

import sys;sys.path

Does it list ‘/usr/share/panda3d’? It should. At least it does here.

Here is what I get:

import sys;sys.path
[’’, ‘/usr/local/lib/python25.zip’, ‘/usr/local/lib/python2.5’, ‘/usr/local/lib/python2.5/plat-linux2’, ‘/usr/local/lib/python2.5/lib-tk’, ‘/usr/local/lib/python2.5/lib-dynload’, ‘/usr/local/lib/python2.5/site-packages’]

Hmm. It should be listing “/usr/share/panda3d” and “/usr/lib/panda3d”.
A hacky way to solve it would be by adding the following into your /usr/lib/python2.5/site.py:

import sys
sys.path.append("/usr/share/panda3d")
sys.path.append("/usr/lib/panda3d")

I have added it to the file. But it will list. But goes away when i exit the session. any idea?

I don’t really know – the .deb should take care of it. I think it installs a .pth file or so somewhere. Did you install the deb file as root? At my pc it does automatically take care of the paths etc.
By the way, what version of Panda was it?

Version of panda3d 1.4.2 is the version. No I haven’t installed as root. I just d/l the fiesty deb file and let the package manager install it. But, I am going a different route. I will install with the source code and the other 2 parts of the program (linux tools and samples). I have already run the makepanda/makepanda.py I have checked this out and it has created the /usr/share/panda3d/direct folder correctly. But direct is the olny folder in the panda3d folder. But I will continue on with the rest of the makepanda install instructions later today when I get home.

Thanks for all of your help so far.

You don’t need makepanda. That goes for building panda yourself, not installing a deb.

You need to install the debian file as root, so it can modify system stuff. Try going to a terminal, and type:

sudo dpkg -i /your/dir/panda3d-feisty-xxx.deb