New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on import numba: module '_godot' has no attribute 'print_override' #238
Comments
The stacktrace suggests numba is doing some magic with the builtins, I guess this is clashing with what godot-python is doing when capturing stdout/stderr. Capturing stdout/stderr used to involve the replacement of the builtins print and print_stacktrace: godot-python/pythonscript/_godot_io.pxi Lines 135 to 150 in 8c36c9b
However this has changed: now we only replace sys.stdout/stderr. I guess this should fix your current issue. Can you try with the latest master of Godot-Python ? |
Using the "latest master of Godot-Python" means that I have to compile Godot from source, right? (Sorry to ask). So I have to compile Godot from source, and then somehow include Godot-Python. |
correct
you don't need to compile Godot, Godot-Python is a module loaded from the gdnative interface (so basically Godot loads a shared library that initialize the godot-python module) tl,dr: you can do:
This should compile godot-python, install it in |
Thanks for replying even to my noob questions! =) After running
I cloned Godot-Python using git to disc. I then ran |
you miss the godot_headers submodule, to fetch it you should do:
|
Received an error again, so I tried to restart the terminal and do everything from scratch. I got an error again. Here is all the terminal outputs:
|
Looks like you stumble on something new ! The compilation part of your For instance here is the build log I got (ignore the final WARNINGS/ERRORS, they are expected when closing the game):
|
=) we'll see. Probably my fault at some level.
No, I'm not sure. I barely use git (as you may have noticed). How do I find out if it is a clean git repo? Should I delete everything in the Godot-Python folder and clone it again? Or is there some meta-considerations to take care of as well? I will try to google to see if I can figure it out. |
I removed the godot-python repo and cloned it from git again. Then I retraced all the steps. It seems to have worked (see below). I will go figure what the next step is from your comment above. Will return with questions and/or results =)
|
The "language" selector should provide a Python option You are most likely missing the On top of that, your
this is something you can add by hand, or use the Project -> Project Settings -> GDNative menu from within Godot to enable pythonscript.gdnlib Note you must then restart Godot before being able to use Python from within Godot |
I copied the Now it works to create python scripts in the Godot Editor, and after adding global paths to my conda installation in the I cannot however import other python modules such as My hypothesized solution is to recompile godot-python but with the added modules of
I will return with results or questions. If my thinking is wrong, please feel free to intervene =) |
Adding Note that in retracing the steps (where I updated the Question Summary of steps
|
Ok, so the problem of how to import modules was solved by going to the [project dir]/addons/pythonscript/ and running
This allowed me to import numba and other installed packages in godot-python. |
I'm on Ubuntu 18.04, Godot 3.2.2 through standard 64-bit download.
I seem to be able to import python libraries by adding a path to where the python libraries are on disk in the Project Settings> General> Filesystem> Python Script> Path using the Godot editor.
I'm using conda, and I've added
/home/[username]/anaconda3/lib/python3.8;
/home/[username]/anaconda3/lib/python3.8/lib-dynload;/home/[username]/anaconda3/lib/python3.8/site-packages
which seems to make packages such as math, numpy, etc importable in Godot. When I try to import a package called
numba
however, I get the following error:That the code refers to 'print_override' suggests to my mind that there might be many errors that is attempted to be printed, but it fails to do so because of the missing attribute of 'print_override'.
Does anyone have any ideas on what the problem could be? Since it works to import other libraries, such as
numpy
, there could be something specifically wrong with thenumba
library. Importingnumba
in a normal python script works however.The text was updated successfully, but these errors were encountered: