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.83k stars 812 forks source link

Cannot install mujoco-py, problem with subprocess, don't want to downgrade to Python 2 since baselines is for Python 3 #204

Closed DanielTakeshi closed 6 years ago

DanielTakeshi commented 6 years ago

I ran the following command from the GitHub guide in my virtual environment and got this:

(py3-tensorflow) daniel@takeshi:~$ pip3 install -U 'mujoco-py<1.50.2,>=1.50.1'
Collecting mujoco-py<1.50.2,>=1.50.1
  Using cached mujoco-py-1.50.1.41.tar.gz
Requirement already up-to-date: glfw>=1.4.0 in ./seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py<1.50.2,>=1.50.1)
Requirement already up-to-date: numpy>=1.11 in ./seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py<1.50.2,>=1.50.1)
Requirement already up-to-date: Cython>=0.27.2 in ./seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py<1.50.2,>=1.50.1)
Requirement already up-to-date: imageio>=2.1.2 in ./seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py<1.50.2,>=1.50.1)
Requirement already up-to-date: cffi>=1.10 in ./seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py<1.50.2,>=1.50.1)
Requirement already up-to-date: pillow in ./seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from imageio>=2.1.2->mujoco-py<1.50.2,>=1.50.1)
Requirement already up-to-date: pycparser in ./seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from cffi>=1.10->mujoco-py<1.50.2,>=1.50.1)
Building wheels for collected packages: mujoco-py
  Running setup.py bdist_wheel for mujoco-py ... error
  Complete output from command /home/daniel/seita-venvs/py3-tensorflow/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wfc_1v3w/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 /tmp/tmpjrbnxj8xpip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  Compiling /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/cymj.pyx because it changed.
  [1/1] Cythonizing /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/cymj.pyx
  running build_ext
  building 'mujoco_py.cymj' extension
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-wfc_1v3w
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-wfc_1v3w/mujoco-py
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/gl
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Imujoco_py -I/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py -I/home/daniel/.mujoco/mjpro150/include -I/home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages/numpy/core/include -I/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/vendor/egl -I/usr/include/python3.5m -I/home/daniel/seita-venvs/py3-tensorflow/include/python3.5m -c /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/cymj.c -o /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/cymj.o -fopenmp -w
  x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Imujoco_py -I/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py -I/home/daniel/.mujoco/mjpro150/include -I/home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages/numpy/core/include -I/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/vendor/egl -I/usr/include/python3.5m -I/home/daniel/seita-venvs/py3-tensorflow/include/python3.5m -c /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/gl/eglshim.c -o /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/gl/eglshim.o -fopenmp -w
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5
  creating /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5/mujoco_py
  x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/cymj.o /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/gl/eglshim.o -L/home/daniel/.mujoco/mjpro150/bin -Wl,--enable-new-dtags,-R/home/daniel/.mujoco/mjpro150/bin -lmujoco150 -lglewegl -o /tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5/mujoco_py/cymj.cpython-35m-x86_64-linux-gnu.so -fopenmp
  stat: No such file or directory
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-wfc_1v3w/mujoco-py/setup.py", line 52, in <module>
      cmdclass={'build': Build},
    File "/home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 204, in run
      self.run_command('build')
    File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-wfc_1v3w/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 "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 22, in <module>
      from mujoco_py.utils import discover_mujoco
    File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/__init__.py", line 1, in <module>
      from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
    File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 502, in <module>
      cymj = load_cython_ext(mjpro_path)
    File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 81, in load_cython_ext
      cext_so_path = builder.build()
    File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 238, in build
      built_so_file_path = self._build_impl()
    File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 312, in _build_impl
      join(get_nvidia_lib_dir(), 'libOpenGL.so.0'))
    File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 173, in fix_shared_library
      so_file])
    File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['patchelf', '--add-needed', '/usr/lib/nvidia-390/libOpenGL.so.0', '/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5/mujoco_py/cymj.cpython-35m-x86_64-linux-gnu.so']' returned non-zero exit status 1

  ----------------------------------------
  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 /home/daniel/seita-venvs/py3-tensorflow/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wfc_1v3w/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 /tmp/pip-tcmxfy2h-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/daniel/seita-venvs/py3-tensorflow/include/site/python3.5/mujoco-py:
    running install
    running build
    running build_ext
    stat: No such file or directory
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-wfc_1v3w/mujoco-py/setup.py", line 52, in <module>
        cmdclass={'build': Build},
      File "/home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.5/distutils/command/install.py", line 583, in run
        self.run_command('build')
      File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-wfc_1v3w/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 "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 22, in <module>
        from mujoco_py.utils import discover_mujoco
      File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/__init__.py", line 1, in <module>
        from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
      File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 502, in <module>
        cymj = load_cython_ext(mjpro_path)
      File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 81, in load_cython_ext
        cext_so_path = builder.build()
      File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 238, in build
        built_so_file_path = self._build_impl()
      File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 312, in _build_impl
        join(get_nvidia_lib_dir(), 'libOpenGL.so.0'))
      File "/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/builder.py", line 173, in fix_shared_library
        so_file])
      File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['patchelf', '--add-needed', '/usr/lib/nvidia-390/libOpenGL.so.0', '/tmp/pip-build-wfc_1v3w/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5/mujoco_py/cymj.cpython-35m-x86_64-linux-gnu.so']' returned non-zero exit status 1

    ----------------------------------------
Command "/home/daniel/seita-venvs/py3-tensorflow/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-wfc_1v3w/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 /tmp/pip-tcmxfy2h-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/daniel/seita-venvs/py3-tensorflow/include/site/python3.5/mujoco-py" failed with error code 1 in /tmp/pip-build-wfc_1v3w/mujoco-py/

I'm using Ubuntu 16.04 and Python 3.5.2. Here's my virtual environment's stuff

(py3-tensorflow) daniel@takeshi:~$ pip freeze
absl-py==0.1.10
alabaster==0.7.10
astor==0.6.2
atari-py==0.1.1
attrs==17.4.0
Babel==2.5.3
bleach==1.5.0
certifi==2018.1.18
cffi==1.11.5
chardet==3.0.4
click==6.7
cloudpickle==0.5.2
cycler==0.10.0
Cython==0.27.3
decorator==4.2.1
dill==0.2.7.1
docutils==0.14
future==0.16.0
gast==0.2.0
glfw==1.5.1
grpcio==1.10.0
gym==0.10.3
html5lib==0.9999999
idna==2.6
ImageHash==4.0
imageio==2.2.0
imagesize==1.0.0
ipdb==0.11
ipython==6.2.1
ipython-genutils==0.2.0
jedi==0.11.1
Jinja2==2.10
joblib==0.11
Markdown==2.6.11
MarkupSafe==1.0
matplotlib==2.1.2
mpi4py==3.0.0
numpy==1.14.1
numpydoc==0.7.0
packaging==17.1
pandas==0.22.0
parso==0.1.1
pexpect==4.4.0
pickleshare==0.7.4
Pillow==5.0.0
pkg-resources==0.0.0
pluggy==0.6.0
progressbar2==3.35.2
prompt-toolkit==1.0.15
protobuf==3.5.1
ptyprocess==0.5.2
py==1.5.2
pycparser==2.18
pyglet==1.3.1
Pygments==2.2.0
PyOpenGL==3.1.0
pyparsing==2.2.0
pytest==3.4.1
pytest-instafail==0.3.0
python-dateutil==2.6.1
python-utils==2.3.0
pytz==2018.3
PyWavelets==0.5.2
pyzmq==17.0.0
requests==2.18.4
scikit-learn==0.19.1
scipy==1.0.0
seaborn==0.8.1
simplegeneric==0.8.1
six==1.11.0
sklearn==0.0
snowballstemmer==1.2.1
Sphinx==1.7.1
sphinx-rtd-theme==0.2.4
sphinxcontrib-websupport==1.0.1
tensorboard==1.6.0
tensorflow==1.6.0
tensorflow-gpu==1.6.0
tensorflow-tensorboard==1.5.1
termcolor==1.1.0
tqdm==4.19.6
traitlets==4.3.2
urllib3==1.22
wcwidth==0.1.7
Werkzeug==0.14.1
zmq==0.0.0

Note the gym version.

Also I do have MuJoCo, the free student license and it's on my LD_LIBRARY_PATH:

(py3-tensorflow) daniel@takeshi:~$ echo $LD_LIBRARY_PATH 
:/usr/local/cuda-9.0/lib64:/usr/local/cuda-9.0/lib64:/home/daniel/.mujoco/mjpro150/bin
(py3-tensorflow) daniel@takeshi:~$ ls -lh .mujoco/
total 8.0K
-rw-rw-r-- 1 daniel daniel  884 Mar  2 18:33 mjkey.txt
drwxrwxr-x 7 daniel daniel 4.0K Apr 23  2017 mjpro150

This error message is a bit confusing. it seems like a subprocess call but I have no idea what the actual issue is here.

I checked this (https://github.com/openai/mujoco-py/issues/198) but the best solution seems to be downgrading the version.

This (https://github.com/openai/mujoco-py/issues/182) actually has the same error message, but again the issue is to downgrade. I don't see why we need this if we need Python 3 for baselines.

Does anyone have some advice on how to fix this?

DanielTakeshi commented 6 years ago

I next tried to follow the instructions in https://github.com/openai/mujoco-py/issues/190

First, clone it:

(py3-tensorflow) daniel@takeshi:~$ git clone https://github.com/openai/mujoco-py
Cloning into 'mujoco-py'...
remote: Counting objects: 1502, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 1502 (delta 5), reused 9 (delta 4), pack-reused 1491
Receiving objects: 100% (1502/1502), 5.32 MiB | 0 bytes/s, done.
Resolving deltas: 100% (849/849), done.
Checking connectivity... done.
(py3-tensorflow) daniel@takeshi:~$ cd mujoco-py/

Then pip install:

(py3-tensorflow) daniel@takeshi:~/mujoco-py$ pip install -e . --no-cache
Obtaining file:///home/daniel/mujoco-py
Requirement already satisfied: glfw>=1.4.0 in /home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py==1.50.1.41)
Requirement already satisfied: numpy>=1.11 in /home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py==1.50.1.41)
Requirement already satisfied: Cython>=0.27.2 in /home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py==1.50.1.41)
Requirement already satisfied: imageio>=2.1.2 in /home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py==1.50.1.41)
Requirement already satisfied: cffi>=1.10 in /home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from mujoco-py==1.50.1.41)
Requirement already satisfied: pillow in /home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from imageio>=2.1.2->mujoco-py==1.50.1.41)
Requirement already satisfied: pycparser in /home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages (from cffi>=1.10->mujoco-py==1.50.1.41)
Installing collected packages: mujoco-py
  Running setup.py develop for mujoco-py
Successfully installed mujoco-py

Unfortunately if I run python:

(py3-tensorflow) daniel@takeshi:~/mujoco-py$ ipython
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import mujoco_py
Compiling /home/daniel/mujoco-py/mujoco_py/cymj.pyx because it changed.
[1/1] Cythonizing /home/daniel/mujoco-py/mujoco_py/cymj.pyx
running build_ext
building 'mujoco_py.cymj' extension
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home/daniel
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home/daniel/mujoco-py
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home/daniel/mujoco-py/mujoco_py
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home/daniel/mujoco-py/mujoco_py/gl
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Imujoco_py -I/home/daniel/mujoco-py/mujoco_py -I/home/daniel/.mujoco/mjpro150/include -I/home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages/numpy/core/include -I/home/daniel/mujoco-py/mujoco_py/vendor/egl -I/usr/include/python3.5m -I/home/daniel/seita-venvs/py3-tensorflow/include/python3.5m -c /home/daniel/mujoco-py/mujoco_py/cymj.c -o /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home/daniel/mujoco-py/mujoco_py/cymj.o -fopenmp -w
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -Imujoco_py -I/home/daniel/mujoco-py/mujoco_py -I/home/daniel/.mujoco/mjpro150/include -I/home/daniel/seita-venvs/py3-tensorflow/lib/python3.5/site-packages/numpy/core/include -I/home/daniel/mujoco-py/mujoco_py/vendor/egl -I/usr/include/python3.5m -I/home/daniel/seita-venvs/py3-tensorflow/include/python3.5m -c /home/daniel/mujoco-py/mujoco_py/gl/eglshim.c -o /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home/daniel/mujoco-py/mujoco_py/gl/eglshim.o -fopenmp -w
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5
creating /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5/mujoco_py
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home/daniel/mujoco-py/mujoco_py/cymj.o /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/temp.linux-x86_64-3.5/home/daniel/mujoco-py/mujoco_py/gl/eglshim.o -L/home/daniel/.mujoco/mjpro150/bin -Wl,--enable-new-dtags,-R/home/daniel/.mujoco/mjpro150/bin -lmujoco150 -lglewegl -o /home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5/mujoco_py/cymj.cpython-35m-x86_64-linux-gnu.so -fopenmp
stat: No such file or directory
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
<ipython-input-1-85c6ae7fd0aa> in <module>()
----> 1 import mujoco_py

~/mujoco-py/mujoco_py/__init__.py in <module>()
----> 1 from mujoco_py.builder import cymj, ignore_mujoco_warnings, functions, MujocoException
      2 from mujoco_py.generated import const
      3 from mujoco_py.mjrenderpool import MjRenderPool
      4 from mujoco_py.mjviewer import MjViewer, MjViewerBasic
      5 from mujoco_py.version import __version__, get_version

~/mujoco-py/mujoco_py/builder.py in <module>()
    500 
    501 mjpro_path, key_path = discover_mujoco()
--> 502 cymj = load_cython_ext(mjpro_path)
    503 
    504 

~/mujoco-py/mujoco_py/builder.py in load_cython_ext(mjpro_path)
     79     cext_so_path = builder.get_so_file_path()
     80     if not exists(cext_so_path):
---> 81         cext_so_path = builder.build()
     82     return load_dynamic_ext('cymj', cext_so_path)
     83 

~/mujoco-py/mujoco_py/builder.py in build(self)
    236 
    237     def build(self):
--> 238         built_so_file_path = self._build_impl()
    239         new_so_file_path = self.get_so_file_path()
    240         move(built_so_file_path, new_so_file_path)

~/mujoco-py/mujoco_py/builder.py in _build_impl(self)
    310         so_file_path = super()._build_impl()
    311         fix_shared_library(so_file_path, 'libOpenGL.so',
--> 312                            join(get_nvidia_lib_dir(), 'libOpenGL.so.0'))
    313         fix_shared_library(so_file_path, 'libEGL.so',
    314                            join(get_nvidia_lib_dir(), 'libEGL.so.1'))

~/mujoco-py/mujoco_py/builder.py in fix_shared_library(so_file, name, library_path)
    171         ['patchelf', '--add-needed',
    172          library_path,
--> 173          so_file])
    174 
    175 

/usr/lib/python3.5/subprocess.py in check_call(*popenargs, **kwargs)
    579         if cmd is None:
    580             cmd = popenargs[0]
--> 581         raise CalledProcessError(retcode, cmd)
    582     return 0
    583 

CalledProcessError: Command '['patchelf', '--add-needed', '/usr/lib/nvidia-390/libOpenGL.so.0', '/home/daniel/mujoco-py/mujoco_py/generated/_pyxbld_LinuxExtensionBuilder/lib.linux-x86_64-3.5/mujoco_py/cymj.cpython-35m-x86_64-linux-gnu.so']' returned non-zero exit status 1

Again, there is a subprocess error.

DanielTakeshi commented 6 years ago

Update:

Well, I think I fixed it by installing patchelf from the GitHub repo.

daniel@takeshi:~/patchelf$ ./bootstrap.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force --warnings=all 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: creating directory build-aux
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf --force --warnings=all
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --force-missing --warnings=all
configure.ac:6: installing 'build-aux/compile'
configure.ac:4: installing 'build-aux/install-sh'
configure.ac:4: installing 'build-aux/missing'
src/Makefile.am: installing 'build-aux/depcomp'
autoreconf: Leaving directory `.'
daniel@takeshi:~/patchelf$ ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... gcc3
Setting page size to 4096
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating tests/Makefile
config.status: creating patchelf.spec
config.status: executing depfiles commands
daniel@takeshi:~/patchelf$ make
Making all in src
make[1]: Entering directory '/home/daniel/patchelf/src'
g++ -DPACKAGE_NAME=\"patchelf\" -DPACKAGE_TARNAME=\"patchelf\" -DPACKAGE_VERSION=\"0.10\" -DPACKAGE_STRING=\"patchelf\ 0.10\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"patchelf\" -DVERSION=\"0.10\" -DPAGESIZE=4096 -I.    -Wall -std=c++11 -D_FILE_OFFSET_BITS=64 -g -O2 -MT patchelf.o -MD -MP -MF .deps/patchelf.Tpo -c -o patchelf.o patchelf.cc
mv -f .deps/patchelf.Tpo .deps/patchelf.Po
g++ -Wall -std=c++11 -D_FILE_OFFSET_BITS=64 -g -O2   -o patchelf patchelf.o  
make[1]: Leaving directory '/home/daniel/patchelf/src'
Making all in tests
make[1]: Entering directory '/home/daniel/patchelf/tests'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/daniel/patchelf/tests'
make[1]: Entering directory '/home/daniel/patchelf'
make[1]: Nothing to be done for 'all-am'.
make[1]: Leaving directory '/home/daniel/patchelf'
daniel@takeshi:~/patchelf$ sudo make install
Making install in src
make[1]: Entering directory '/home/daniel/patchelf/src'
make[2]: Entering directory '/home/daniel/patchelf/src'
 /bin/mkdir -p '/usr/local/bin'
  /usr/bin/install -c patchelf '/usr/local/bin'
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/daniel/patchelf/src'
make[1]: Leaving directory '/home/daniel/patchelf/src'
Making install in tests
make[1]: Entering directory '/home/daniel/patchelf/tests'
make[2]: Entering directory '/home/daniel/patchelf/tests'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/daniel/patchelf/tests'
make[1]: Leaving directory '/home/daniel/patchelf/tests'
make[1]: Entering directory '/home/daniel/patchelf'
make[2]: Entering directory '/home/daniel/patchelf'
make[2]: Nothing to be done for 'install-exec-am'.
 /bin/mkdir -p '/usr/local/share/doc/patchelf'
 /usr/bin/install -c -m 644 README '/usr/local/share/doc/patchelf'
 /bin/mkdir -p '/usr/local/share/man/man1'
 /usr/bin/install -c -m 644 patchelf.1 '/usr/local/share/man/man1'
make[2]: Leaving directory '/home/daniel/patchelf'
make[1]: Leaving directory '/home/daniel/patchelf'

My patchelf version is 0.10.

I then tried to do this:

https://github.com/openai/mujoco-py/issues/147

(py3-tensorflow) daniel@takeshi:~/mujoco-py$ ./examples/simpool.py 
0-th sim qpos=[0. 0.]
1-th sim qpos=[1.4962963 1.4962963]
2-th sim qpos=[2.99259259 2.99259259]
3-th sim qpos=[4.48888889 4.48888889]
4-th sim qpos=[5.98518519 5.98518519]
5-th sim qpos=[7.48148148 7.48148148]
6-th sim qpos=[8.97777778 8.97777778]
7-th sim qpos=[10.47407407 10.47407407]
8-th sim qpos=[11.97037037 11.97037037]
9-th sim qpos=[13.46666667 13.46666667]
10-th sim qpos=[14.96296296 14.96296296]
11-th sim qpos=[16.45925926 16.45925926]
12-th sim qpos=[17.95555556 17.95555556]
13-th sim qpos=[19.45185185 19.45185185]
14-th sim qpos=[20.94814815 20.94814815]
15-th sim qpos=[22.44444444 22.44444444]
16-th sim qpos=[23.94074074 23.94074074]
17-th sim qpos=[25.43703704 25.43703704]
18-th sim qpos=[26.93333333 26.93333333]
19-th sim qpos=[28.42962963 28.42962963]
(py3-tensorflow) daniel@takeshi:~/mujoco-py$ ipython
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import mujoco_py

In [2]: mujoco_py.__version__
Out[2]: '1.50.1.41'

In [3]: exit

And as you can see it is now OK, and I can run baselines on Python 3.5.2. Whew, much pain resolved...