tobspr / LUI

Lightweight User Interface for Panda3D
MIT License
83 stars 26 forks source link

ImportError: No module named 'panda3d.lui' #21

Closed SilverLuke closed 7 years ago

SilverLuke commented 8 years ago

My system: debian testing python3 01_MinimalExample.py My error:

Traceback (most recent call last):
  File "01_MinimalExample.py", line 15, in <module>
    from LUIButton import LUIButton
  File "../Builtin/LUIButton.py", line 2, in <module>
    from LUIObject import LUIObject
  File "../Builtin/LUIObject.py", line 7, in <module>
    from panda3d.lui import LUIObject as _LUIObject
ImportError: No module named 'panda3d.lui'
tobspr commented 8 years ago

Did you compile LUI as described in the README.md?

SilverLuke commented 8 years ago

yes, i did it, but in my system there isn't /usr/lib/panda3d/lui.so, so i try to copy lui.so in many system folder.

rdb commented 8 years ago

You need to place it specifically in the panda3d directory, the one that also contains core.so and direct.so. Use a find tool if you don't know where it is. Copying it to random places will accomplish nothing.

It will probably be in a path like /usr/lib/python3/dist-packages/panda3d assuming that you compiled Panda3D for Python 3.

SilverLuke commented 8 years ago

I copied lui.so in /usr/lib/python3/dist-packages/panda3d now:

Traceback (most recent call last):
  File "01_MinimalExample.py", line 15, in <module>
    from LUIButton import LUIButton
  File "../Builtin/LUIButton.py", line 2, in <module>
    from LUIObject import LUIObject
  File "../Builtin/LUIObject.py", line 7, in <module>
    from panda3d.lui import LUIObject as _LUIObject
ImportError: core.cpython-35m-x86_64-linux-gnu.so: cannot open shared object file: No such file or directory
rdb commented 8 years ago

Could you tell me which version of Panda3D you have?

It may be necessary to add a line containing /usr/lib/python3/dist-packages/panda3d to /etc/ld.so.conf .

SilverLuke commented 8 years ago

My version of panda3d is master. In /etc/ld.so.conf there is include /etc/ld.so.conf.d/*.conf.

In /etc/ld.so.conf.d/panda3d.conf there is /usr/lib/x86_64-linux-gnu/panda3d.

rdb commented 8 years ago

Please try adding /usr/lib/python3/dist-packages/panda3d on a new line to /usr/lib/x86_64-linux-gnu/panda3d and then run sudo ldconfig in a terminal to update the library cache.

@tobspr This issue is probably caused by the module builder linking to core.so which isn't necessary in 1.10, only in 1.9.

SilverLuke commented 8 years ago

It didn't work :(

tobspr commented 8 years ago

@SilverLuke can you try commenting line 344 in CMakeLists.txt, and then rebuild everything? (And don't run update_module_builder.py, otherwise your changes will be overridden).

SilverLuke commented 8 years ago

Now:

Traceback (most recent call last):
  File "01_MinimalExample.py", line 55, in <module>
    Application().run()
  File "01_MinimalExample.py", line 53, in __init__
    button = LUIButton(parent=region.root, text="Hello world!", top=30, left=30)
  File "../Builtin/LUIButton.py", line 27, in __init__
    self._label = LUILabel(parent=self, text=text)
  File "../Builtin/LUILabel.py", line 20, in __init__
    self._text = LUIText(self, unicode(text), font, font_size)
NameError: name 'unicode' is not defined
tobspr commented 8 years ago

You have to use a Python 2 build of Panda3D, right now LUI does not support Python 3