openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.89k stars 813 forks source link

Install failed on OS X, Anaconda 3.5.2 #74

Open yoshavit opened 7 years ago

yoshavit commented 7 years ago

Hi there, Below are logs and error messages I get when attempting the pip installation of mujoco-py. I'm running OS X 10.10.5, in a conda env with python 3.5.2

`$ pip install mujoco-py
Collecting mujoco-py
  Using cached mujoco-py-1.50.1.9.tar.gz
Requirement already satisfied: glfw>=1.4.0 in /Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages (from mujoco-py)
Requirement already satisfied: numpy>=1.11 in /Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages (from mujoco-py)
Requirement already satisfied: Cython>=0.25.2 in /Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages (from mujoco-py)
Requirement already satisfied: imageio>=2.1.2 in /Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages (from mujoco-py)
Requirement already satisfied: pillow in /Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages (from imageio>=2.1.2->mujoco-py)
Requirement already satisfied: olefile in /Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages (from pillow->imageio>=2.1.2->mujoco-py)
Building wheels for collected packages: mujoco-py
  Running setup.py bdist_wheel for mujoco-py ... error
  Complete output from command /Users/yonadav/anaconda/envs/tensorflow3.5/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/tmptoa_mos3pip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  Compiling /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/cymj.pyx because it changed.
  [1/1] Cythonizing /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/cymj.pyx
  running build_ext
  building 'mujoco_py.cymj' extension
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/gl
  /usr/local/bin/gcc-6 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/yonadav/anaconda/envs/tensorflow3.5/include -arch x86_64 -DONMAC -I/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py -I/Users/yonadav/.mujoco/mjpro150/include -I/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages/numpy/core/include -I/Users/yonadav/anaconda/envs/tensorflow3.5/include/python3.5m -c /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/cymj.c -o /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/cymj.o -fopenmp -w
  /usr/local/bin/gcc-6 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Users/yonadav/anaconda/envs/tensorflow3.5/include -arch x86_64 -DONMAC -I/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py -I/Users/yonadav/.mujoco/mjpro150/include -I/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages/numpy/core/include -I/Users/yonadav/anaconda/envs/tensorflow3.5/include/python3.5m -c /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/gl/dummyshim.c -o /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/gl/dummyshim.o -fopenmp -w
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/lib.macosx-10.6-x86_64-3.5
  creating /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/lib.macosx-10.6-x86_64-3.5/mujoco_py
  /usr/local/bin/gcc-6 -bundle -undefined dynamic_lookup -L/Users/yonadav/anaconda/envs/tensorflow3.5/lib -arch x86_64 /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/cymj.o /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/temp.macosx-10.6-x86_64-3.5/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/gl/dummyshim.o -L/Users/yonadav/.mujoco/mjpro150/bin -L/Users/yonadav/anaconda/envs/tensorflow3.5/lib -L/Users/yonadav/.mujoco/mjpro150/bin -lmujoco150 -lglfw.3 -o /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/_pyxbld_MacExtensionBuilder/lib.macosx-10.6-x86_64-3.5/mujoco_py/cymj.cpython-35m-darwin.so -fopenmp
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/setup.py", line 52, in <module>
      cmdclass={'build': Build},
    File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 179, in run
      self.run_command('build')
    File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/setup.py", line 19, in run
      spec.loader.exec_module(builder)
    File "<frozen importlib._bootstrap_external>", line 665, in exec_module
    File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
    File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/builder.py", line 17, in <module>
      from mujoco_py.utils import discover_mujoco
    File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/__init__.py", line 1, in <module>
      from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
    File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/builder.py", line 296, in <module>
      cymj = load_cython_ext(mjpro_path)
    File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/builder.py", line 57, in load_cython_ext
      mod = imp.load_dynamic("cymj", cext_so_path)
    File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/imp.py", line 342, in load_dynamic
      return _load(spec)
  ImportError: dlopen(/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so, 2): Symbol not found: _GOMP_parallel
    Referenced from: /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so
    Expected in: flat namespace
   in /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so

  ----------------------------------------
  Failed building wheel for mujoco-py
  Running setup.py clean for mujoco-py
Failed to build mujoco-py
Installing collected packages: mujoco-py
  Running setup.py install for mujoco-py ... error
    Complete output from command /Users/yonadav/anaconda/envs/tensorflow3.5/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-0n1terxb-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/setup.py", line 52, in <module>
        cmdclass={'build': Build},
      File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/command/install.py", line 539, in run
        self.run_command('build')
      File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/setup.py", line 19, in run
        spec.loader.exec_module(builder)
      File "<frozen importlib._bootstrap_external>", line 665, in exec_module
      File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
      File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/builder.py", line 17, in <module>
        from mujoco_py.utils import discover_mujoco
      File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/__init__.py", line 1, in <module>
        from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
      File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/builder.py", line 296, in <module>
        cymj = load_cython_ext(mjpro_path)
      File "/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/builder.py", line 57, in load_cython_ext
        mod = imp.load_dynamic("cymj", cext_so_path)
      File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/imp.py", line 342, in load_dynamic
        return _load(spec)
    ImportError: dlopen(/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so, 2): Symbol not found: _GOMP_parallel
      Referenced from: /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so
      Expected in: flat namespace
     in /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so

    ----------------------------------------
Command "/Users/yonadav/anaconda/envs/tensorflow3.5/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-0n1terxb-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/0c/fvvc6btj6058m1ns1f0ls6gm0000gn/T/pip-build-gs22rky5/mujoco-py/`

I also separately tried to install by cloning the repo and running python setup.py install. That command runs without errors, but afterwards when I import mujoco_py in python I get the following, similar error:

yonadav$ python -c "import mujoco_py"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/yonadav/.mujoco/mujoco-py/mujoco_py/__init__.py", line 1, in <module>
    from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
  File "/Users/yonadav/.mujoco/mujoco-py/mujoco_py/builder.py", line 296, in <module>
    cymj = load_cython_ext(mjpro_path)
  File "/Users/yonadav/.mujoco/mujoco-py/mujoco_py/builder.py", line 57, in load_cython_ext
    mod = imp.load_dynamic("cymj", cext_so_path)
  File "/Users/yonadav/anaconda/envs/tensorflow3.5/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: dlopen(/Users/yonadav/.mujoco/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so, 2): Symbol not found: _GOMP_parallel
  Referenced from: /Users/yonadav/.mujoco/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so
  Expected in: flat namespace
 in /Users/yonadav/.mujoco/mujoco-py/mujoco_py/generated/cymj_macextensionbuilder.so

Could someone help me work through this bug? Thanks for the help!

EDIT: GOMP seems to be a gcc thing, so here's my gcc version if anyone was wondering:

yonadav$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
machinaut commented 7 years ago

This is my gcc version (I'm using OSX sierra), though I'm not sure it's what's wrong in this case:

$ gcc --version
gcc (Homebrew GCC 6.4.0 --without-multilib) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you want to try it (and use homebrew) you can get this version with brew install gcc@6 --without-multilib

jmeyers44 commented 7 years ago

I was able to successfully install on OSX 10.12.3 Python 3.5.2 using @machinaut 's gcc version after previously failing installation using Apple LLVM version 8.0.0 (clang-800.0.42.1)

mepster commented 7 years ago

Hmm...

$ brew install gcc@6 --without-multilib

doesn't seem to install a gcc without multilib.

$ brew install gcc@6 --without-multilib
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
swift-protobuf
==> Updated Formulae
youtube-dl

Warning: gcc@6: this formula has no --without-multilib option so it will be ignored!
==> Downloading https://homebrew.bintray.com/bottles/gcc@6-6.4.0.sierra.bottle.tar.gz
[...]
$ /usr/local/bin/gcc-6 --version
gcc-6 (Homebrew GCC 6.4.0) 6.4.0

Has anyone else got this to work? There are some posts on the interwebs about this not working in homebrew... but looks like @machinaut got it to work?

Thanks all.

P.S. I am also on OSX Sierra, 10.12.6

mepster commented 7 years ago

I did finally get it to work using gcc@5, specifically:

$ brew install cmake boost boost-python sdl2 swig wget
$ pip install 'gym[all]'
$ brew install gcc@5

(Thanks to @JoeNyland in this thread https://github.com/dmlc/xgboost/issues/1501 )

Then put this in your .bash_profile (easy to undo later):

alias gcc='gcc-5'
alias cc='gcc-5'
alias g++='g++-5'
alias c++='c++-5'

Then (after you source .bash_profile) this works:

pip install 'mujoco-py<1.50.2,>=1.50.1'

(Don't forget to undo .bash_profile changes.)

Now unfortunately I have hit the "No module named 'mujoco_py.mjlib'" issue! https://github.com/openai/mujoco-py/issues/80 :-(

All of the above was with Python 3.5.4 and mujoco150. I can't use mujoco131 because I have a new Mac and it fails with "ERROR: Could not open disk" as here: https://github.com/openai/mujoco-py/issues/36 https://github.com/openai/gym/issues/638

mixuala commented 7 years ago

It took me awhile, but the above comment helped me get it working for OSX. This is what I did:

openAI/gym install on OSX 10.12.6, with mujoco

# create conda env with python v3.5.2
# https://github.com/openai/mujoco-py/issues/47#issuecomment-312551946
conda create --name gym python=3.5.2
source activate gym
mkdir -p ~/openai && cd ~/openai

# install gym
# https://github.com/openai/mujoco-py/issues/74#issuecomment-338410266
brew install cmake boost boost-python sdl2 swig wget

# see: https://github.com/openai/gym/issues/164#issuecomment-263785233
export MACOSX_DEPLOYMENT_TARGET=10.12
# pip install 'gym[all]'
git clone https://github.com/openai/gym.git
cd ./gym
pip install -e '.[all]'
brew install gcc@5

## use gcc5
# add to ~/.bash_profile
alias gcc='gcc-5'
alias cc='gcc-5'
alias g++='g++-5'
alias c++='c++-5'
# source ~/.bash_profile

## install mujoco v1.50 binaries
cd ~/openai
mkdir ~/.mujoco
# NOTE: remember to copy mujoco license key to ~/.mujoco/mjkey.txt

# download OSX binaries
wget https://www.roboti.us/download/mjpro150_osx.zip
unzip mjpro150_osx.zip && mv mjpro150  ~/.mujoco  

# wget https://www.roboti.us/download/mjpro131_osx.zip
# unzip mjpro131_osx.zip && mv mjpro131  ~/.mujoco 
git clone https://github.com/openai/mujoco-py.git

# pwd: cd ~/openai
rm -rf mujoco-py
git clone https://github.com/openai/mujoco-py.git
git checkout master             # mujoco v1.50

cd mujoco-py && python setup.py install

And you can run this script in python to verify

import gym
env = gym.make('Hopper-v1')
print(env.observation_space)
print(env.action_space)
env.reset()
for _ in range(100):
    env.render()
    env.step(env.action_space.sample()) # take a random action        
tshrjn commented 7 years ago

@mixuala I'm on OSX 10.11.3 and I'm having the same error even after following your steps.

Update: I did get it to work by but then got hit by issue #80 specifically this after trying to solve it :

mixuala commented 7 years ago

did you install mujoco-py from the cloned git repo? I did not install using pip

tshrjn commented 7 years ago

Yes, I did but that did not help. Finally resolved all problems by installing 0.5.7 via pip.

pip install mujoco-py==0.5.7
richardrl commented 6 years ago

Although I can install .5.7, functions are missing. For example, 'load_model_from_path' which is only present in latest mujoco_py 1.5. Anyone get that working?

erwincoumans commented 6 years ago

What are the up-to-date instructions to install mujoco_py on Mac OSX (my OSX version is 10.13.4, but errors are the same, and tried various gcc versions /cymj_macextensionbuilder.so, 2): Symbol not found: _GOMP_parallel)

mixuala commented 6 years ago

I just installed again on a new Mac-mini with the latest 10.13. It worked fine according to the script I posted above. But I had to use the 1.3.1 version—1.5.0 did not work.

nemanja-rakicevic commented 6 years ago

check if this helps https://github.com/openai/mujoco-py/issues/80#issuecomment-366438347

f1recracker commented 6 years ago

If it helps, I resolved the Symbol not found: _GOMP_parallel) problem by using Python 3.5.3 (I was actually using Python 3.6 all this while which is currently not supported). I was also able to install mujoco_py directly from pip (MacOS 10.13.3, conda).

azmosavi commented 6 years ago

@mixuala Thanks it was really helpful.

billtubbs commented 6 years ago

@mixuala's install script worked for me on OS X 10.13.4 with python 3.6.5, gym 0.10.5, and mujoco 1.50.1.56. Although the coursework I am doing says I have to install 1.3.1.

Note that we use version 1.31 and not the latest version 1.50. The python interface to mujoco bundled with OpenAI gym is also compatible with this version of mujoco.

See course material here. Does anyone know if this is still an issue or whether it will now work with 1.5.1? I will try it...

zjzijielu commented 6 years ago

Hi @billtubbs, I'm also struggling with the same issue. Did you get it to work with mujoco 1.5?