openai / coinrun

Code for the paper "Quantifying Transfer in Reinforcement Learning"
https://blog.openai.com/quantifying-generalization-in-reinforcement-learning/
MIT License
388 stars 87 forks source link

Error running on MacOS #14

Closed ankeshanand closed 5 years ago

ankeshanand commented 5 years ago

Hi,

I get this issue when trying to run on MacOS (High Sierra). Here's the stacktrace:

Traceback (most recent call last):
  File "/Users/ankesh/miniconda3/envs/coinrun/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Users/ankesh/miniconda3/envs/coinrun/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/Users/ankesh/workspace/coinrun/coinrun/__init__.py", line 1, in <module>
    from .coinrunenv import init_args_and_threads
  File "/Users/ankesh/workspace/coinrun/coinrun/coinrunenv.py", line 58, in <module>
    lib = npct.load_library(lib_path, os.path.dirname(__file__))
  File "/Users/ankesh/miniconda3/envs/coinrun/lib/python3.6/site-packages/numpy/ctypeslib.py", line 150, in load_library
    return ctypes.cdll[libpath]
  File "/Users/ankesh/miniconda3/envs/coinrun/lib/python3.6/ctypes/__init__.py", line 423, in __getitem__
    return getattr(self, name)
  File "/Users/ankesh/miniconda3/envs/coinrun/lib/python3.6/ctypes/__init__.py", line 418, in __getattr__
    dll = self._dlltype(name)
  File "/Users/ankesh/miniconda3/envs/coinrun/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/ankesh/workspace/coinrun/coinrun/.build-debug/coinrun_cpp_d.dylib, 6): Symbol not found: __ZNSt12bad_weak_ptrD1Ev
  Referenced from: /Users/ankesh/workspace/coinrun/coinrun/.build-debug/coinrun_cpp_d.dylib (which was built for Mac OS X 10.13)
  Expected in: /usr/lib/libstdc++.6.0.9.dylib
 in /Users/ankesh/workspace/coinrun/coinrun/.build-debug/coinrun_cpp_d.dylib

I am guessing the issue is with C++ libraries on MacOS, but I have been unable to debug.

christopherhesse commented 5 years ago

What compiler is being used to build this and what version of the compiler? Also could you create a fresh checkout of the repo and re-run the build, then paste the entire log here, along with the traceback when you run pytest coinrun from the repo directory?

christopherhesse commented 5 years ago

Going to assume this is a one-time issue and close it until the original poster responds.

ankeshanand commented 5 years ago

Yeah, sorry you can close this for now. I haven't had a chance to build it on MacOS again.

ankeshanand commented 5 years ago

I tried this again and unfortunately the issue remains. Env details: Conda distributed Python 3.6.8, Mac OSX Mojave. I am pasting the relevant logs here:

➜ python -m coinrun.interactive

Logging to /var/folders/_h/k0yjvw6s0yz9xcgzql601lzm0000gn/T/openai-2019-02-07-19-47-57-496737
Mac, assumed python3, homebrew branch
mkdir -p .generated
mkdir -p .build-release
mkdir -p .build-debug
/usr/local/opt/qt5/bin/moc -o .generated/coinrun.moc coinrun.cpp
gcc -std=c++11 -Wall -Wno-unused-variable -Wno-unused-function -Wno-deprecated-register -fPIC -g -O3 -march=native `pkg-config --cflags Qt5Widgets` -c coinrun.cpp  -o.build-release/coinrun.o -MMD -MF .build-release/coinrun.o.dep

A bunch of complier warnings follow and the error is:

gcc -shared -o .build-debug/coinrun_cpp_d.dylib .build-debug/coinrun.o -lstdc++ `pkg-config --libs Qt5Widgets`
Traceback (most recent call last):
  File "/Users/ankesh/miniconda3/envs/dimrl/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Users/ankesh/miniconda3/envs/dimrl/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/Users/ankesh/warehouse/coinrun/coinrun/__init__.py", line 1, in <module>
    from .coinrunenv import init_args_and_threads
  File "/Users/ankesh/warehouse/coinrun/coinrun/coinrunenv.py", line 58, in <module>
    lib = npct.load_library(lib_path, os.path.dirname(__file__))
  File "/Users/ankesh/miniconda3/envs/dimrl/lib/python3.6/site-packages/numpy/ctypeslib.py", line 150, in load_library
    return ctypes.cdll[libpath]
  File "/Users/ankesh/miniconda3/envs/dimrl/lib/python3.6/ctypes/__init__.py", line 423, in __getitem__
    return getattr(self, name)
  File "/Users/ankesh/miniconda3/envs/dimrl/lib/python3.6/ctypes/__init__.py", line 418, in __getattr__
    dll = self._dlltype(name)
  File "/Users/ankesh/miniconda3/envs/dimrl/lib/python3.6/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/ankesh/warehouse/coinrun/coinrun/.build-release/coinrun_cpp.dylib, 6): Symbol not found: __ZNSt12bad_weak_ptrD1Ev
  Referenced from: /Users/ankesh/warehouse/coinrun/coinrun/.build-release/coinrun_cpp.dylib
  Expected in: /usr/lib/libstdc++.6.dylib
 in /Users/ankesh/warehouse/coinrun/coinrun/.build-release/coinrun_cpp.dylib

And looks like the compiler is: GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin

christopherhesse commented 5 years ago

What's the output of gcc --version?

ankeshanand commented 5 years ago

gcc (GCC) 4.8.5

christopherhesse commented 5 years ago

What happens if you compile with clang instead of gcc?

ankeshanand commented 5 years ago

Compiling with clang made it work, thanks! :)