google-deepmind / lab

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

Installation failure on Ubuntu 16.04 / Python2.7 #45

Closed etienne87 closed 6 years ago

etienne87 commented 7 years ago

When installing lab on Ubuntu 16.04, I have an error with Python2.7. When running `bazel run :python_module_test --define headless=glx'

ImportError: > /home/.../deepmind_lab.so: > undefined symbol: PyCObject_Type ERROR: Non-zero return code '1' from command: Process exited with status 1.

my python --version :

Python 2.7.12

my bazel version:

Build label: 0.4.4 Build target: bazel-out/local-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Wed Feb 1 18:54:21 2017 (1485975261) Build timestamp: 1485975261 Build timestamp as int: 1485975261

Am i missing something here to build the lab?

frankcarey commented 7 years ago

The Dockerfile builds on 14.04 in #24, but you might want to eyeball that first to see the versions used, dependencies, etc. (maybe even try updating dockerfile to use 16.04 and see if that works in a vanilla environment) If you do, please report back?

tkoeppe commented 6 years ago

I'm not sure we have anything meaningful to add at this point. Please feel free to reopen if this is still an issue.

douglasrizzo commented 6 years ago

I am having a similar issue. I am on Manjaro Linux, which is based on Arch. I had to change python.BUILD to:

cc_library(
    name = "python",
    hdrs = glob(["include/python2.7/*.h",
         "lib/python2.7/site-packages/numpy/core/include/numpy/*.h"]),
    includes = ["include/python2.7",
         "lib/python2.7/site-packages/numpy/core/include"],
    visibility = ["//visibility:public"],
)

I successfully tested lab with bazel run :game -- --level_script=tests/empty_room_test, but when running bazel run :python_random_agent, I get the same error as @etienne87 when trying to run the example agent. Any ideas?

Also, am I supposed to install the deepmind_lab Python package located on python/pip-package in my system? I can't seem to import deepmind_lab in my own scripts.

tkoeppe commented 6 years ago

@douglasrizzo: I'm not sure. This looks like a linker error. Maybe you need to add -lpython2.7 to your binary's linker options (linkopts=[...] in Bazel). Or maybe you need to add the path containing libpython2.7.so to your LD_LIBRARY_PATH when running the binary? (Try running it directly rather than via bazel run.)

Re pip: did you look at pip_package/README.md?

douglasrizzo commented 6 years ago

I was able to install the pip package by following the instructions on pip_package/README.md, thanks.

By running python2 python/rangom_agent.py on my system, I got an output on the terminal:

Starting random spring agent. Action spec: [{'max': 512, 'name': 'LOOK_LEFT_RIGHT_PIXELS_PER_FRAME', 'min': -512}, {'max': 512, 'name': 'LOOK_DOWN_UP_PIXELS_PER_FRAME', 'min': -512}, {'max': 1, 'name': 'STRAFE_LEFT_RIGHT', 'min': -1}, {'max': 1, 'name': 'MOVE_BACK_FORWARD', 'min': -1}, {'max': 1, 'name': 'FIRE', 'min': 0}, {'max': 1, 'name': 'JUMP', 'min': 0}, {'max': 1, 'name': 'CROUCH', 'min': 0}]
Finished after 1000 steps. Total reward received is 0.000000

I don't know if that's the expected behavior, but it looks like it worked. I would like to try and fix my linker, but I don't know in which of the linkopts=[...] I should add -lpython2.7, as there are many BUILD files and targets. Could you point me to the right one?

tkoeppe commented 6 years ago

@douglasrizzo: I was thinking of adding it to the python rule in python.BUILD in the top-level directory:

linkopts = ["-lpython2.7"],