openai / gym

A toolkit for developing and comparing reinforcement learning algorithms.
https://www.gymlibrary.dev
Other
34.47k stars 8.59k forks source link

Failed pip install gym[all] on Anaconda, Ubuntu 16.04 #218

Closed zuoxingdong closed 8 years ago

zuoxingdong commented 8 years ago

I am using Ubuntu 16.04, on latest version of Anaconda with all packages updated (e.g. Numpy 1.11 and cmake 3.3.1)

It has following errors when running pip install gym[all]

  -- The C compiler identification is GNU 5.3.1
  -- The CXX compiler identification is GNU 5.3.1
  -- Check for working C compiler: /usr/bin/cc
  -- Check for working C compiler: /usr/bin/cc -- works
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Check for working CXX compiler: /usr/bin/c++
  -- Check for working CXX compiler: /usr/bin/c++ -- works
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Boost version: 1.58.0
  -- Found the following Boost libraries:
  --   filesystem
  --   thread
  --   system
  --   date_time
  --   chrono
  --   regex
  --   iostreams
  -- Looking for include file pthread.h
  -- Looking for include file pthread.h - found
  -- Looking for pthread_create
  -- Looking for pthread_create - not found
  -- Looking for pthread_create in pthreads
  -- Looking for pthread_create in pthreads - not found
  -- Looking for pthread_create in pthread
  -- Looking for pthread_create in pthread - found
  -- Found Threads: TRUE
  -- Found BZip2: /usr/lib/x86_64-linux-gnu/libbz2.so (found version "1.0.6")
  -- Looking for BZ2_bzCompressInit in /usr/lib/x86_64-linux-gnu/libbz2.so
  -- Looking for BZ2_bzCompressInit in /usr/lib/x86_64-linux-gnu/libbz2.so - found
  -- Found JPEG: /home/zuoxingdong/anaconda2/lib/libjpeg.so
  -- Found ZLIB: /home/zuoxingdong/anaconda2/lib/libz.so (found version "1.2.8")
  -- Could NOT find GME (missing:  GME_LIBRARIES GME_INCLUDE_DIR)
  -- Using system zlib
  -- Using system jpeg library
  -- Using system bzip2 library
  -- Using internal gme library
  -- Performing Test HAVE_NO_ARRAY_BOUNDS
  -- Performing Test HAVE_NO_ARRAY_BOUNDS - Success
  -- Performing Test __LIBGME_TEST_VISIBILITY
  -- Performing Test __LIBGME_TEST_VISIBILITY - Success
  -- Looking for strdup
  -- Looking for strdup - found
  -- Looking for strndup
  -- Looking for strndup - found
  -- Looking for sys/types.h
  -- Looking for sys/types.h - found
  -- Looking for stdint.h
  -- Looking for stdint.h - found
  -- Looking for stddef.h
  -- Looking for stddef.h - found
  -- Check size of char
  -- Check size of char - done
  -- Check size of short
  -- Check size of short - done
  -- Check size of int
  -- Check size of int - done
  -- Check size of long
  -- Check size of long - done
  -- /home/zuoxingdong/anaconda2/include
  -- /usr/include
  -- /tmp/pip-build-X43Tu2/doom-py/doom_py/src/vizdoom/lzma/C
  -- Looking for itoa
  -- Looking for itoa - not found
  -- Performing Test DUMB_CAN_USE_SSE
  -- Performing Test DUMB_CAN_USE_SSE - Success
  -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
  -- checking for module 'gtk+-2.0'
  --   found gtk+-2.0, version 2.24.30
  CMake Error at /home/zuoxingdong/anaconda2/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
    Could NOT find SDL2 (missing: SDL2_LIBRARY SDL2_INCLUDE_DIR)
  Call Stack (most recent call first):
    /home/zuoxingdong/anaconda2/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
    cmake_modules/FindSDL2.cmake:179 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
    src/vizdoom/src/CMakeLists.txt:206 (find_package)

  -- Configuring incomplete, errors occurred!
  See also "/tmp/pip-build-X43Tu2/doom-py/doom_py/CMakeFiles/CMakeOutput.log".
  See also "/tmp/pip-build-X43Tu2/doom-py/doom_py/CMakeFiles/CMakeError.log".

  Could not build doom-py: Command '['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_PYTHON=ON', '-DBUILD_JAVA=OFF', '-DPYTHON_EXECUTABLE:FILEPATH=/home/zuoxingdong/anaconda2/bin/python', '-DPYTHON_LIBRARY=/home/zuoxingdong/anaconda2/lib/libpython2.7.so', '-DPYTHON_INCLUDE_DIR=/home/zuoxingdong/anaconda2/include/python2.7']' returned non-zero exit status 1. (HINT: are you sure cmake is installed? You might also be missing a library. Try running 'apt-get install -y python-numpy cmake zlib1g-dev libjpeg-dev libboost-all-dev gcc libsdl2-dev wget unzip'

  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-X43Tu2/doom-py/setup.py", line 88, in <module>
      include_package_data=True,
    File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/home/zuoxingdong/anaconda2/lib/python2.7/site-packages/wheel/bdist_wheel.py", line 179, in run
      self.run_command('build')
    File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-X43Tu2/doom-py/setup.py", line 63, in run
      build_func()
    File "/tmp/pip-build-X43Tu2/doom-py/setup.py", line 41, in build_linux
      build_common('so')
    File "/tmp/pip-build-X43Tu2/doom-py/setup.py", line 28, in build_common
      subprocess.check_call(['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_PYTHON=ON', '-DBUILD_JAVA=OFF', '-DPYTHON_EXECUTABLE:FILEPATH={}'.format(sys.executable)] + cmake_arg_list, cwd='doom_py')
    File "/home/zuoxingdong/anaconda2/lib/python2.7/subprocess.py", line 540, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_PYTHON=ON', '-DBUILD_JAVA=OFF', '-DPYTHON_EXECUTABLE:FILEPATH=/home/zuoxingdong/anaconda2/bin/python', '-DPYTHON_LIBRARY=/home/zuoxingdong/anaconda2/lib/libpython2.7.so', '-DPYTHON_INCLUDE_DIR=/home/zuoxingdong/anaconda2/include/python2.7']' returned non-zero exit status 1

  ----------------------------------------
  Failed building wheel for doom-py
  Running setup.py clean for doom-py
  Running setup.py bdist_wheel for box2d-py ... error
  Complete output from command /home/zuoxingdong/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-X43Tu2/box2d-py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmpo2jp1ppip-wheel- --python-tag cp27:
  Using setuptools (version 23.0.0).
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-2.7
  creating build/lib.linux-x86_64-2.7/Box2D
  copying library/Box2D/Box2D.py -> build/lib.linux-x86_64-2.7/Box2D
  copying library/Box2D/__init__.py -> build/lib.linux-x86_64-2.7/Box2D
  creating build/lib.linux-x86_64-2.7/Box2D/b2
  copying library/Box2D/b2/__init__.py -> build/lib.linux-x86_64-2.7/Box2D/b2
  running build_ext
  building 'Box2D._Box2D' extension
  swigging Box2D/Box2D.i to Box2D/Box2D_wrap.cpp
  swig -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library/Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D/Box2D_wrap.cpp Box2D/Box2D.i
  unable to execute 'swig': No such file or directory
  error: command 'swig' failed with exit status 1

  ----------------------------------------
  Failed building wheel for box2d-py
  Running setup.py clean for box2d-py
Failed to build doom-py box2d-py
Installing collected packages: doom-py, imageio, theano, mujoco-py, box2d-py, keras, gym
  Running setup.py install for doom-py ... error
    Complete output from command /home/zuoxingdong/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-X43Tu2/doom-py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-jODX63-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    -- Boost version: 1.58.0
    -- Found the following Boost libraries:
    --   filesystem
    --   thread
    --   system
    --   date_time
    --   chrono
    --   regex
    --   iostreams
    -- Could NOT find GME (missing:  GME_LIBRARIES GME_INCLUDE_DIR)
    -- Using system zlib
    -- Using system jpeg library
    -- Using system bzip2 library
    -- Using internal gme library
    -- /home/zuoxingdong/anaconda2/include
    -- /usr/include
    -- /tmp/pip-build-X43Tu2/doom-py/doom_py/src/vizdoom/lzma/C
    CMake Error at /home/zuoxingdong/anaconda2/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
      Could NOT find SDL2 (missing: SDL2_LIBRARY SDL2_INCLUDE_DIR)
    Call Stack (most recent call first):
      /home/zuoxingdong/anaconda2/share/cmake-3.3/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
      cmake_modules/FindSDL2.cmake:179 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
      src/vizdoom/src/CMakeLists.txt:206 (find_package)

    -- Configuring incomplete, errors occurred!
    See also "/tmp/pip-build-X43Tu2/doom-py/doom_py/CMakeFiles/CMakeOutput.log".
    See also "/tmp/pip-build-X43Tu2/doom-py/doom_py/CMakeFiles/CMakeError.log".

    Could not build doom-py: Command '['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_PYTHON=ON', '-DBUILD_JAVA=OFF', '-DPYTHON_EXECUTABLE:FILEPATH=/home/zuoxingdong/anaconda2/bin/python', '-DPYTHON_LIBRARY=/home/zuoxingdong/anaconda2/lib/libpython2.7.so', '-DPYTHON_INCLUDE_DIR=/home/zuoxingdong/anaconda2/include/python2.7']' returned non-zero exit status 1. (HINT: are you sure cmake is installed? You might also be missing a library. Try running 'apt-get install -y python-numpy cmake zlib1g-dev libjpeg-dev libboost-all-dev gcc libsdl2-dev wget unzip'

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-X43Tu2/doom-py/setup.py", line 88, in <module>
        include_package_data=True,
      File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/home/zuoxingdong/anaconda2/lib/python2.7/site-packages/setuptools-23.0.0-py2.7.egg/setuptools/command/install.py", line 61, in run
      File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/command/install.py", line 563, in run
        self.run_command('build')
      File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/home/zuoxingdong/anaconda2/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-X43Tu2/doom-py/setup.py", line 63, in run
        build_func()
      File "/tmp/pip-build-X43Tu2/doom-py/setup.py", line 41, in build_linux
        build_common('so')
      File "/tmp/pip-build-X43Tu2/doom-py/setup.py", line 28, in build_common
        subprocess.check_call(['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_PYTHON=ON', '-DBUILD_JAVA=OFF', '-DPYTHON_EXECUTABLE:FILEPATH={}'.format(sys.executable)] + cmake_arg_list, cwd='doom_py')
      File "/home/zuoxingdong/anaconda2/lib/python2.7/subprocess.py", line 540, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '-DCMAKE_BUILD_TYPE=Release', '-DBUILD_PYTHON=ON', '-DBUILD_JAVA=OFF', '-DPYTHON_EXECUTABLE:FILEPATH=/home/zuoxingdong/anaconda2/bin/python', '-DPYTHON_LIBRARY=/home/zuoxingdong/anaconda2/lib/libpython2.7.so', '-DPYTHON_INCLUDE_DIR=/home/zuoxingdong/anaconda2/include/python2.7']' returned non-zero exit status 1

    ----------------------------------------
Command "/home/zuoxingdong/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-X43Tu2/doom-py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-jODX63-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-X43Tu2/doom-py/
zuoxingdong commented 8 years ago

Problem solved. With Ubuntu 16.04 and latest Anaconda, the following dependencies still needed to install. xvfb libav-tools xorg-dev libsdl2-dev swig cmake

Just to comment, is it possible/reasonable to write a setup script that help the user to automatically check if all needed dependencies already installed and try to install all remaining ones automatically ?

jietang commented 8 years ago

Glad you figured it out. There's actually already a section in the gym README that lists dependencies to install. I just edited it to make it more prominent - lmk what you think.

zuoxingdong commented 8 years ago

@jietang Thanks a lot for the reply and the update of documentation. I guess this issue should be closed now.

ghost commented 8 years ago

@zuoxingdong Some problems under Anaconda Environment. As your suggestion, we should install libav-tools. But after I install libav-tools using sudo apt-get install libav-tools, it still does not work. Is there any other dependencies I need to install, such as cmake or something else. Thanks!

ghost commented 8 years ago

https://recordnotfound.com/gym-openai-119096 well done!

kerawits commented 7 years ago

@Lebo-Wang If your machine is a fresh install, you might also have you install build-essential.

sudo apt-get install build-essential

arisliang commented 6 years ago

README only lists dependencies for ubuntu 14.04, not 16.04

the-kezian-diary commented 6 years ago

Most of the time when i want to use gym on a new system. I get the same error. The Wrapper(SWIG) that comes with the system is most probably working hence we get the following error..

unable to execute 'swig': No such file or directory error: command 'swig' failed with exit status 1

Hence i recommend updating swig sudo apt-get install swig

Rajathbharadwaj commented 2 years ago

Most of the time when i want to use gym on a new system. I get the same error. The Wrapper(SWIG) that comes with the system is most probably working hence we get the following error..

unable to execute 'swig': No such file or directory error: command 'swig' failed with exit status 1

Hence i recommend updating swig sudo apt-get install swig

This worked for me! Btw I was trying to install Lightning bolts extra