google-deepmind / lab

A customisable 3D platform for agent-based AI research
Other
7.11k stars 1.37k forks source link

Failed to find function dmlab_connect in library! #209

Open bebbo203 opened 3 years ago

bebbo203 commented 3 years ago

While the command bazel run :python_random_agent --define graphics=sdl -- \ --length=10000 --width=640 --height=480 works perfectly inside the lab folder, the command python python/random_agent.py returns this error:

Failed to find function dmlab_connect in library! Traceback (most recent call last): File "python/random_agent.py", line 206, in <module> args.record, args.demo, args.demofiles, args.video) File "python/random_agent.py", line 155, in run env = deepmind_lab.Lab(level, ['RGB_INTERLEAVED'], config=config) RuntimeError: Failed to connect RL API

How to solve? Thank you

tkoeppe commented 3 years ago

Right, the runfiles directory needs to be made known to the Python module. When you run the executable via Bazel, then the hardcoded default is correct (https://github.com/deepmind/lab/blob/master/python/dmlab_module.c#L941), but if you run it from elsewhere you need to manually set it. For example, see how https://github.com/deepmind/lab/blob/master/python/dmenv_module.py#L25-L27 does it.

bebbo203 commented 3 years ago

Thank you but can you be more specific? After following the guide for installation, what folder should I pass to the function?

tkoeppe commented 3 years ago

The runfiles path is passed to the DSO loader parameters: https://github.com/deepmind/lab/blob/master/python/dmlab_module.c#L187

Those parameters are used to locate the .so files: https://github.com/deepmind/lab/blob/master/public/dmlab_so_loader.cc#L205-L212

So the path needs to be wherever libdmlab_headless_sw.so etc. are. If you use Bazel to build everything, that will the the directory that we've hardcoded (basically <binary_name>.runfiles/org_deepmind_lab), but if you're running this in some other way, you need to point it at the right directory.

varshantdhar commented 3 years ago

I'm sorry @tkoeppe I don't understand your answer to the question.

tkoeppe commented 3 years ago

@varshantdhar: Can you help me understand where my answer falls short and what else you need to know?

o00000o commented 2 years ago

While the command bazel run :python_random_agent --define graphics=sdl -- \ --length=10000 --width=640 --height=480 works perfectly inside the lab folder, the command python python/random_agent.py returns this error:

Failed to find function dmlab_connect in library! Traceback (most recent call last): File "python/random_agent.py", line 206, in <module> args.record, args.demo, args.demofiles, args.video) File "python/random_agent.py", line 155, in run env = deepmind_lab.Lab(level, ['RGB_INTERLEAVED'], config=config) RuntimeError: Failed to connect RL API

How to solve? Thank you

hi,I have the same problem. Have you solved it?

o00000o commented 2 years ago

I'm sorry @tkoeppe I don't understand your answer to the question.

hi,I have the same problem. Have you solved it?

o00000o commented 2 years ago

@varshantdhar: Can you help me understand where my answer falls short and what else you need to know?

hi,I have the same problem.I don't know what you mean.For example, how do I solve this problem by running this code. bazel run :python_random_agent