lab icon indicating copy to clipboard operation
lab copied to clipboard

Failed to find function dmlab_connect in library!

Open bebbo203 opened this issue 3 years ago • 8 comments

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

bebbo203 avatar Feb 16 '21 16:02 bebbo203

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.

tkoeppe avatar Feb 16 '21 17:02 tkoeppe

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

bebbo203 avatar Feb 19 '21 13:02 bebbo203

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.

tkoeppe avatar Feb 19 '21 13:02 tkoeppe

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

varshantdhar avatar Apr 12 '21 02:04 varshantdhar

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

tkoeppe avatar Apr 12 '21 10:04 tkoeppe

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 avatar Oct 21 '21 07:10 o00000o

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

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

o00000o avatar Oct 21 '21 07:10 o00000o

@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

o00000o avatar Oct 21 '21 07:10 o00000o