No module named direct.showbase.ShowBase

I am new with Panda3D, so I downloaded the 1.7.2 SDK. I have tried lots of versions of python, like 2.5, 2.6, 2.7, 3.1, and 3.2. I used the Hello World tutorial for panda 3D, and I put in this code:

from direct.showbase.ShowBase import ShowBase
 
class MyApp(ShowBase):
 
    def __init__(self):
        ShowBase.__init__(self)
 
app = MyApp()
app.run()

Then I get this error:

Traceback (most recent call last):
File “<pyshell#0>”, line 1, in
from direct.showbase.ShowBase import ShowBase
ImportError: No module named direct.showbase.ShowBase

I don’t know if I installed it wrong or something, but if anybody could help me I would really appreciate it. Thanks in advance :slight_smile:

You need to use the specific version of Python that came with the 1.7.2 SDK. You’ll find it inside c:\Panda3D-1.7.2. You can also try running “ppython” which is a shortcut to this particular version of Python.

David

Do you know where it would be on mac?

“python2.5” should work, just make sure to run it in 32-bits mode. You can also try running “ppython”.

I still have not figured it out, but I decided to go on my windows computer instead, and now it works on windows. Thanks for helping!

For people who are experiencing this issue, check your PYTHONHOME and PYTHONPATH environment variables. You can do this by running ‘env’ from the command line (this should work for Windows, Linux and OSX). If the value of these do not match where you installed Panda3D, you need to use your system’s method of setting environment variables (‘set’ and ‘export’ are likely candidates, google 'how do i set environment variables in '). I suggest creating a script you run when you first open your command prompt to start working with Panda3D, as this ensures that you do not affect any other software that is running on your system.

Good Luck!

I’m not exactly sure if this is quite the same pitfall as werts15 is posting about…

One of the suggested ways to install Panda3D is to just use pip. I like pip and think it is a great system, so I did that.

However:

$ which pip
/Library/Frameworks/Python.framework/Versions/3.7/bin/pip

By default, the command:

$ python

(at least on my system) is:

$ which python
/usr/bin/python

Which is currently mapped to Python 2.7 on my system.
But the pip I used was for Python3.

$ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3

Previous posts imply you need Python 2.5 or better.
At this point, I only know that the roaming-ralph demo seems to run if I explicitly invoke python3 on main.py

Naturally, if you have used a pip associated with Python 3 installation to install Panda3D, then try to run programs using a python2 exec, it’s not going to see the installed libraries.

One can, of course, do a quick pre-check of their system:

$ python3
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:39:00)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.

import panda3d
import direct

If those two imports don’t return silently, you can be pretty sure you’re not going to be able to run any sample programs with that Python installation.

Here’s where the libraries have been installed on my Mac:

>>> panda3d.__file__
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/panda3d/__init__.py'

>>> direct.__file__
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/direct/__init__.py'

It seems that at this point, Panda3d does support Python 3:

Hope that helps at least a few people.
-ej

For the record, this is a very outdated thread. For one, Python 2.7 is EOL. Also, 32-bit macOS is no longer supported.

Hi, I am not able to install DIRECT package while trying to run the Panda3d library.
It shows this error:
python setup.py bdist_wheel did not run successfully.

Greetings, and welcome to the forum! I hope that you find your time here to be positive! :slight_smile:

As to your issue, is the error-message that you give the full message? If not, could you please paste in the full text of the error?

Thanks for the reply. I switched from my terminal to a virtual environment and everything worked. It looked like it was a version mismatch.
Appreciate the fast reply!

1 Like