eaplatanios / jelly-bean-world

A framework for experimenting with never-ending learning
Apache License 2.0
73 stars 17 forks source link

Error when using jbw #6

Closed thunanguyen closed 4 years ago

thunanguyen commented 4 years ago

I follow the instruction to install jbw like in the readme but when I import jbw in python, it keeps saying ImportError: cannot import name 'simulator_c'. What is the problem?

asaparov commented 4 years ago

Oh that's odd. What OS are you using? Python version? I assume you ran python setup.py install and it finished with no errors?

thunanguyen commented 4 years ago

I test it with Anaconda on Window with python 3.6 python 3.7, use msvc and mingw to build. All ends up build successfully without any errors but when import jbw, that 'simulator_c' error occurs. But when I use python outside of Anaconda, it is normal.

asaparov commented 4 years ago

Oh did you try this in the api\python directory? I'm not entirely sure why, but import jbw produces that error when I try it from that directory. Maybe something to do with the Python import system? Try importing it in a different directory.

thunanguyen commented 4 years ago

Oddly enough, it spills out another strange error

Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Workspace\envs\mujoco\lib\site-packages\jbw\__init__.py", line 19, in <module> from . import environments File "C:\Workspace\envs\mujoco\lib\site-packages\jbw\environments.py", line 75, in <module> sim_config = make_config() File "C:\Workspace\envs\mujoco\lib\site-packages\jbw\environments.py", line 68, in make_config allowed_movement_directions=[jbw.ActionPolicy.ALLOWED, jbw.ActionPolicy.DISALLOWED, jbw.ActionPolicy.DISALLOWED, jbw.ActionPolicy.DISALLOWED], NameError: name 'jbw' is not defined

eaplatanios commented 4 years ago

Yes if you have a directory with the same name the python interpreter will try to import from there and so you need to be outside that directory in order for it to pick up the one from site-packages.

thunanguyen commented 4 years ago

Hm, I import it from outside of that folder and it gives the above 'jbw' is not defined error

eaplatanios commented 4 years ago

I think that’s a bug and we should remove the “jbw.” from that line.

eaplatanios commented 4 years ago

I’m not on my computer right now but you could try removing the “jbw.” from that line and reinstalling the package. I’ll also check once I get to my computer.

thunanguyen commented 4 years ago

Yes that is a bug, removing jbw does help but also in line 29 I think should be from .visualizer import MapVisualizer, pi or else it will give the 'pi' is not defined error in line 70