openai / gym

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

pip install gym failed, can not install pachi-py #204

Closed du-phan closed 5 years ago

du-phan commented 8 years ago

Hi all, when installing gym, I encountered this problem: Failed building wheel for pachi-py, the final error message is: `Command "/Users/admin/anaconda/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/jx/x83g474d0pbcqkq46l2x4vvm0000gn/T/pip-build-EIn18D/pachi-py/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/jx/x83g474d0pbcqkq46l2x4vvm0000gn/T/pip-v9kCGg-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/jx/x83g474d0pbcqkq46l2x4vvm0000gn/T/pip-build-EIn18D/pachi-py/``

There are some other people having the same issue as mine (#164) , it seems like it's trying to build binaries for OSX 10.5, and the problem comes from Anaconda. They tried to uninstall Anaconda and succeeded. However I don't want to remove Anaconda as I rely heavily on it, do you have any ideas ? Thank you!

timothy2008 commented 8 years ago

I have the exact same issue as you The error message is: Command "/Users/timothy/anaconda/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/37/gr5h7vhj2gnb7cbxzjp5bt6w0000gn/T/pip-build-JXGjpF/pachi-py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/37/gr5h7vhj2gnb7cbxzjp5bt6w0000gn/T/pip-RSu5_K-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/37/gr5h7vhj2gnb7cbxzjp5bt6w0000gn/T/pip-build-JXGjpF/pachi-py/ I doubt this error cause by:

ld: targeted OS version does not support use of thread local variables in _fast_srandom for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    error: command 'g++' failed with exit status 1

at previous stages of compiling.

jietang commented 8 years ago

The specific error message indicates that setup.py install failed at some point. Can you post the complete build log?

If the error is actually the same as #164, you might try setting

export MACOSX_DEPLOYMENT_TARGET=10.11
export SDKROOT=/path/to/Mac10.11SDK

before you build.

Can you also report the result of running

mdfind Developer | grep "\(CommandLineTools\)\|\(Xcode\)"
xcode-select -p
timothy2008 commented 8 years ago

Notice that i have install boost etc...

Timothys-MacBook-Pro:gym timothy$ brew install boost boost-python sdl2
Warning: boost-1.60.0_2 already installed
Warning: boost-python-1.60.0 already installed
Warning: sdl2-2.0.4 already installed

After running

export MACOSX_DEPLOYMENT_TARGET=10.11
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/

This is the build log

Timothys-MacBook-Pro:gym timothy$ sudo pip install -e '.[all]'
The directory '/Users/timothy/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/timothy/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Obtaining file:///Users/timothy/Documents/gym/gym
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.10.4 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Requirement already satisfied (use --upgrade to upgrade): requests>=2.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Requirement already satisfied (use --upgrade to upgrade): six in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Requirement already satisfied (use --upgrade to upgrade): pyglet>=1.2.0 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Requirement already satisfied (use --upgrade to upgrade): atari_py>=0.0.17 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Requirement already satisfied (use --upgrade to upgrade): Pillow in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Requirement already satisfied (use --upgrade to upgrade): PyOpenGL in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Requirement already satisfied (use --upgrade to upgrade): pachi-py>=0.0.19 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Requirement already satisfied (use --upgrade to upgrade): box2d-py in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from gym==0.1.3)
Collecting doom_py>=0.0.11 (from gym==0.1.3)
  Downloading doom-py-0.0.15.tar.gz (4.4MB)
    100% |████████████████████████████████| 4.4MB 289kB/s 
Collecting mujoco_py>=0.4.3 (from gym==0.1.3)
Collecting imageio (from gym==0.1.3)
  Downloading imageio-1.5-cp26.cp27.cp33.cp34.cp35-none-macosx_10_5_x86_64.macosx_10_6_intel.whl (4.8MB)
    100% |████████████████████████████████| 4.8MB 263kB/s 
Collecting keras (from gym==0.1.3)
Collecting theano (from gym==0.1.3)
Collecting pyyaml (from keras->gym==0.1.3)
  Downloading PyYAML-3.11.zip (371kB)
    100% |████████████████████████████████| 378kB 2.9MB/s 
Collecting scipy>=0.11 (from theano->gym==0.1.3)
  Downloading scipy-0.17.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (21.1MB)
    100% |████████████████████████████████| 21.1MB 59kB/s 
Installing collected packages: doom-py, mujoco-py, imageio, scipy, theano, pyyaml, keras, gym
  Running setup.py install for doom-py ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-eljRJ6/doom-py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-yUzmPx-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    -- The C compiler identification is AppleClang 7.3.0.7030031
    -- The CXX compiler identification is AppleClang 7.3.0.7030031
    -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
    -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/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: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
    -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Looking for pthread.h
    -- Looking for pthread.h - found
    -- Looking for pthread_create
    -- Looking for pthread_create - found
    -- Found Threads: TRUE
    -- Boost version: 1.60.0
    -- Found the following Boost libraries:
    --   filesystem
    --   thread
    --   system
    --   date_time
    --   chrono
    --   regex
    --   iostreams
    --   atomic
    -- Found BZip2: /usr/lib/libbz2.dylib (found version "1.0.6")
    -- Looking for BZ2_bzCompressInit
    -- Looking for BZ2_bzCompressInit - found
    -- Found JPEG: /Users/timothy/anaconda/lib/libjpeg.dylib
    -- Found ZLIB: /Users/timothy/anaconda/lib/libz.dylib (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
    -- 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
    -- /Users/timothy/anaconda/include
    -- /usr/include
    -- /tmp/pip-build-eljRJ6/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
    -- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE)
    -- Found SDL2: /usr/local/lib/libSDL2main.a;/usr/local/lib/libSDL2.dylib;-framework Cocoa
    -- Found OpenAL: /System/Library/Frameworks/OpenAL.framework
    -- Could not find FMOD include files
    -- Could NOT find SndFile (missing:  SNDFILE_LIBRARY SNDFILE_INCLUDE_DIR)
    -- Could NOT find MPG123 (missing:  MPG123_LIBRARIES MPG123_INCLUDE_DIR)
    -- Could NOT find FluidSynth (missing:  FLUIDSYNTH_LIBRARIES FLUIDSYNTH_INCLUDE_DIR)
    -- Looking for filelength
    -- Looking for filelength - not found
    -- Looking for strupr
    -- Looking for strupr - not found
    -- Looking for stricmp
    -- Looking for stricmp - not found
    -- Looking for strnicmp
    -- Looking for strnicmp - not found
    -- Looking for clock_gettime in rt
    -- Looking for clock_gettime in rt - not found
    -- Looking for clock_gettime
    -- Looking for clock_gettime - not found
    -- Could not find clock_gettime. Timing statistics will not be available.
    -- Performing Test HAS_VA_COPY
    -- Performing Test HAS_VA_COPY - Success
    -- Boost version: 1.60.0
    -- Found the following Boost libraries:
    --   thread
    --   system
    --   date_time
    --   chrono
    --   atomic
    -- Fluid synth libs: FLUIDSYNTH_LIBRARIES-NOTFOUND
    -- Found PythonInterp: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python (found suitable version "2.7.11", minimum required is "2.7")
    -- Found PythonLibs: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib (found suitable version "2.7.11", minimum required is "2.7")
    -- Using python library: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib
    -- Using python include: /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
    -- Could NOT find Boost
    -- Could NOT find Boost
    -- Boost library python-py27:
    -- Could NOT find Boost
    -- Boost library python27:
    -- Could NOT find Boost
    -- Boost library python-py2:
    -- Could NOT find Boost
    -- Boost library python2:
    -- Boost version: 1.60.0
    -- Found the following Boost libraries:
    --   python
    -- Found NUMPY: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include
    -- Found components for NumPy
    -- NUMPY_ROOT_DIR    = /usr/local
    -- NUMPY_INCLUDES    = /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include
    -- NUMPY_LIBRARIES   = /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/lib/libnpymath.a
    -- NUMPY_API_VERSION = 1.11.0
    -- Configuring done
    CMake Warning (dev):
      Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
      --help-policy CMP0042" for policy details.  Use the cmake_policy command to
      set the policy and suppress this warning.

      MACOSX_RPATH is not specified for the following targets:

       libvizdoom_shared

    This warning is for project developers.  Use -Wno-dev to suppress it.

    -- Generating done
    -- Build files have been written to: /tmp/pip-build-eljRJ6/doom-py/doom_py
    Scanning dependencies of target freedoom2
    ./download_freedoom.sh: line 10: wget: command not found
    unzip:  cannot find or open ./bin/freedoom-0.10.1.zip, ./bin/freedoom-0.10.1.zip.zip or ./bin/freedoom-0.10.1.zip.ZIP.
    make[2]: *** [CMakeFiles/freedoom2] Error 9
    make[1]: *** [CMakeFiles/freedoom2.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    Scanning dependencies of target libvizdoom_static
    Scanning dependencies of target libvizdoom_shared
    [  1%] Building CXX object CMakeFiles/libvizdoom_static.dir/src/lib/ViZDoomController.cpp.o
    [  1%] Building CXX object CMakeFiles/libvizdoom_static.dir/src/lib/ViZDoomExceptions.cpp.o
    [  1%] Building CXX object CMakeFiles/libvizdoom_shared.dir/src/lib/ViZDoomController.cpp.o
    [  2%] Building CXX object CMakeFiles/libvizdoom_shared.dir/src/lib/ViZDoomExceptions.cpp.o
    [  2%] Building CXX object CMakeFiles/libvizdoom_shared.dir/src/lib/ViZDoomGame.cpp.o
    /tmp/pip-build-eljRJ6/doom-py/doom_py/src/lib/ViZDoomController.cpp:656:17: warning: 50 enumeration values not handled in switch: 'AMMO0', 'AMMO1', 'AMMO2'... [-Wswitch]
            switch (var) {
                    ^
    /tmp/pip-build-eljRJ6/doom-py/doom_py/src/lib/ViZDoomController.cpp:656:17: warning: 50 enumeration values not handled in switch: 'AMMO0', 'AMMO1', 'AMMO2'... [-Wswitch]
            switch (var) {
                    ^
    1 warning generated.
    1 warning generated.
    [  2%] Building CXX object CMakeFiles/libvizdoom_static.dir/src/lib/ViZDoomUtilities.cpp.o
    [  2%] Building CXX object CMakeFiles/libvizdoom_static.dir/src/lib/ViZDoomGame.cpp.o
    [  2%] Building CXX object CMakeFiles/libvizdoom_shared.dir/src/lib/ViZDoomUtilities.cpp.o
    [  2%] Linking CXX shared library bin/libvizdoom.dylib
    [  2%] Built target libvizdoom_shared
    [  2%] Linking CXX static library bin/libvizdoom.a
    [  2%] Built target libvizdoom_static
    make: *** [all] Error 2

    Could not build doom-py: Command '['make', '-j', '3']' returned non-zero exit status 2. (HINT: are you sure cmake is installed? You might also be missing a library. doom_py requires boost, boost-python, sdl2 on OSX (installable via 'brew install boost boost-python sdl2')

    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-eljRJ6/doom-py/setup.py", line 88, in <module>
        include_package_data=True,
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/command/install.py", line 563, in run
        self.run_command('build')
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "/private/tmp/pip-build-eljRJ6/doom-py/setup.py", line 63, in run
        build_func()
      File "/private/tmp/pip-build-eljRJ6/doom-py/setup.py", line 34, in build_osx
        build_common('dylib', cmake_arg_list=['-DOSX_COCOA_BACKEND=OFF'])
      File "/private/tmp/pip-build-eljRJ6/doom-py/setup.py", line 29, in build_common
        subprocess.check_call(['make', '-j', str(cores_to_use)], cwd='doom_py')
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['make', '-j', '3']' returned non-zero exit status 2

    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-eljRJ6/doom-py/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-yUzmPx-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-eljRJ6/doom-py/

This is another result after mdfind..... Timothys-MacBook-Pro:gym timothy$ mdfind Developer | grep "\(CommandLineTools\)\|\(Xcode\)" /Applications/Xcode.app /Library/Developer/CommandLineTools/Library/Developer Timothys-MacBook-Pro:gym timothy$ xcode-select -p /Applications/Xcode.app/Contents/Developer

jietang commented 8 years ago

It looks like it's now failing because it can't find wget to download the freedoom dependency

    ./download_freedoom.sh: line 10: wget: command not found
    unzip:  cannot find or open ./bin/freedoom-0.10.1.zip, ./bin/freedoom-0.10.1.zip.zip or ./bin/freedoom-0.10.1.zip.ZIP.

Can you try brew install wget and then rerunning?

I've added it to our dependency list.

timothy2008 commented 8 years ago

I have installed openssl and wget on mac, but it seems when using wget, openssl cannot verify github.com 's certificate.

 -- Generating done
    -- Build files have been written to: /private/var/folders/37/gr5h7vhj2gnb7cbxzjp5bt6w0000gn/T/pip-build-77zlW2/doom-py/doom_py
    Scanning dependencies of target freedoom2
    --2016-06-25 21:25:01--  https://github.com/freedoom/freedoom/releases/download/v0.10.1/freedoom-0.10.1.zip
    Resolving github.com... 192.30.252.122
    Connecting to github.com|192.30.252.122|:443... connected.
    ERROR: cannot verify github.com's certificate, issued by 'CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US':
      Unable to locally verify the issuer's authority.
    To connect to github.com insecurely, use `--no-check-certificate'.
    unzip:  cannot find or open ./bin/freedoom-0.10.1.zip, ./bin/freedoom-0.10.1.zip.zip or ./bin/freedoom-0.10.1.zip.ZIP.
    make[2]: *** [CMakeFiles/freedoom2] Error 9
    make[1]: *** [CMakeFiles/freedoom2.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    Scanning dependencies of target libvizdoom_static
    Scanning dependencies of target libvizdoom_shared
    [  1%] Building CXX object CMakeFiles/libvizdoom_static.dir/src/lib/ViZDoomExceptions.cpp.o
    [  1%] Building CXX object CMakeFiles/libvizdoom_static.dir/src/lib/ViZDoomController.cpp.o
    [  1%] Building CXX object CMakeFiles/libvizdoom_shared.dir/src/lib/ViZDoomController.cpp.o
    [  1%] Building CXX object CMakeFiles/libvizdoom_static.dir/src/lib/ViZDoomGame.cpp.o

I believe it is because in /System/Library/OpenSSL/certs/ ,there is no .pem and .cer for github.com. Therefore I downloaded the .pem file by

echo -n | openssl s_client -connect github.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /System/Library/OpenSSL/certs/github.pem

Unfortunately, it doesn't work at all. wget still not able to verify the CA of github.com.

Timothys-MacBook-Pro:tmp timothy$ wget https://github.com
--2016-06-25 21:56:40--  https://github.com/
Resolving github.com... 192.30.252.128
Connecting to github.com|192.30.252.128|:443... connected.
ERROR: cannot verify github.com's certificate, issued by 'CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US':
  Unable to locally verify the issuer's authority.
To connect to github.com insecurely, use `--no-check-certificate'.

Do you have any alternative methods suggest to me? Thank you very much :)

jietang commented 8 years ago

Weird.

As a workaround, I suggest cloning the github.com/openai/doom_py repo directly, then running the steps in the doom_py/doom_py/download_freedom.sh script by hand (i.e. downloading and unzipping the freedoom .wad files)

Then you can run

python setup.py bdist_wheel
python setup.py install

to install doom_py.

Lastly you'll need to rerun sudo pip install -e '.[all]'on gym

fferreres commented 8 years ago

I had the same problem, exactly, regarding pachi_py. The environment variable comment resolved the issue. I installed all of Xcode, and pointed it to a 10.12 SDK. Unfortunately, I am not a developer and I am not sure if I needed all of Xcode -huge thing- vs the command line tools which I used for brew.

Thanks for the solution

scientist1642 commented 8 years ago

Also you should make sure that cmake is installed, tested on 10.12 as well.

fferreres commented 8 years ago

I was able to solve the problem by fully installing Xcode (not just the CLT) and exporting the ENV variables to the latest sdk source. Thanks.

On Sat, Oct 8, 2016 at 4:16 PM, Zura Isakadze notifications@github.com wrote:

Also you should make sure that cmake is installed, tested on 10.12 as well.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/openai/gym/issues/204#issuecomment-252446033, or mute the thread https://github.com/notifications/unsubscribe-auth/AT7urvFajaGb3mRvB11VNYUVJchk1W-Nks5qx_oggaJpZM4I4fPA .

JulianNorton commented 7 years ago

several issues I had that finally got it working.

  1. Uninstall anaconda or conda rm -rf ~/anaconda
  2. Reinstall pip and pip3 pip install --force-reinstall --upgrade pip & pip3 install --force-reinstall --upgrade pip3
  3. brew install cmake
  4. brew install swig
  5. pip3 install gym[all]
Instassa commented 7 years ago

I've been trying to follow the above instructions. However when I am trying pip install --force-reinstall --upgrade pip & pip3 install --force-reinstall --upgrade pip3, I get the following:

[1] 44921
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting pip
Downloading/unpacking pip3
  Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 7.1.0
    Uninstalling pip-7.1.0:
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 308, in run
    strip_file_prefix=options.strip_file_prefix,
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 640, in install
    requirement.uninstall(auto_confirm=True)
  File "/usr/lib/python2.7/site-packages/pip/req/req_install.py", line 726, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/usr/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 125, in remove
    renames(path, new_path)
  File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 314, in renames
    shutil.move(old, new)
  File "/usr/lib64/python2.7/shutil.py", line 302, in move
    os.unlink(src)
OSError: [Errno 13] Permission denied: '/usr/bin/pip'

  Real name of requirement pip3 is pip2
  Could not find any downloads that satisfy the requirement pip3
Cleaning up...
No distributions at all found for pip3
Storing debug log for failure in /afs/inf.ed.ac.uk/user/s16/s1686829/.pip/pip.log
[1]+  Exit 2                  pip install --force-reinstall --upgrade pip

After this bullet points 3. and 4. of instructions run normally, but then pip3 install gym[all] doesn't.

Any ideas what is going wrong?

tlbtlbtlb commented 7 years ago

Permission denied Add sudo at the beginning of the command.

Instassa commented 7 years ago

Add sudo at the beginning of the command.

When I enter sudo pip install --force-reinstall --upgrade pip & pip3 install --force-reinstall --upgrade pip3 I get the following error:

[3] 14276
Downloading/unpacking pip3
  Real name of requirement pip3 is pip2
  Could not find any downloads that satisfy the requirement pip3
Cleaning up...
No distributions at all found for pip3
Storing debug log for failure in /afs/inf.ed.ac.uk/user/s16/s1686829/.pip/pip.log
JulianNorton commented 7 years ago

Hey @Instassa ,

Let me know if any of these resource help:

sudo apt-get install python3-pip checkout this thread for more info: http://stackoverflow.com/a/39946882/1943206 might be a good series of steps to try.

https://gist.github.com/JulianNorton/ce4b267d1bc7c675b20427885e23dabc is my personal list that's helped me in the past.

Instassa commented 7 years ago

Thank you Julian, now everything is installing all right, however when I run my code I get the following error: AttributeError: module '_Box2D' has no attribute 'RAND_LIMIT_swigconstant'

It seems to do something with swig, however swig installation went without errors.

Full error I get is this:

Using TensorFlow backend.
/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/keras/legacy/interfaces.py:86: UserWarning: Update your `Dense` call to the Keras 2 API: `Dense(6, input_shape=(6,), kernel_initializer="lecun_uniform")`
  '` call to the Keras 2 API: ' + signature)
/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/keras/legacy/interfaces.py:86: UserWarning: Update your `Dense` call to the Keras 2 API: `Dense(100, kernel_initializer="lecun_uniform")`
  '` call to the Keras 2 API: ' + signature)
/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/keras/legacy/interfaces.py:86: UserWarning: Update your `Dense` call to the Keras 2 API: `Dense(50, kernel_initializer="lecun_uniform")`
  '` call to the Keras 2 API: ' + signature)
/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/keras/legacy/interfaces.py:86: UserWarning: Update your `Dense` call to the Keras 2 API: `Dense(27, kernel_initializer="lecun_uniform")`
  '` call to the Keras 2 API: ' + signature)
[2017-03-16 11:54:57,445] Making new env: CarRacing-v0
Traceback (most recent call last):
  File "CarRacing_newQlearning.py", line 356, in <module>
    Rewards, Times, CummulativeRewards, Weights = Q_learning(model, epochs = 1, stages = 100, gamma = 0.975, epsilon = 0.99, batchSize = 100, buffer = 3000, randSeed = 42, replay = None)
  File "CarRacing_newQlearning.py", line 192, in Q_learning
    env = gym.make('CarRacing-v0')
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/gym/envs/registration.py", line 161, in make
    return registry.make(id)
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/gym/envs/registration.py", line 119, in make
    env = spec.make()
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/gym/envs/registration.py", line 85, in make
    cls = load(self._entry_point)
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/gym/envs/registration.py", line 17, in load
    result = entry_point.load(False)
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2258, in load
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2264, in resolve
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/gym/envs/box2d/__init__.py", line 1, in <module>
    from gym.envs.box2d.lunar_lander import LunarLander
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/gym/envs/box2d/lunar_lander.py", line 4, in <module>
    import Box2D
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/Box2D/__init__.py", line 20, in <module>
    from .Box2D import *
  File "/disk/scratch/s1686829/anaconda/lib/python3.6/site-packages/Box2D/Box2D.py", line 435, in <module>
    _Box2D.RAND_LIMIT_swigconstant(_Box2D)
AttributeError: module '_Box2D' has no attribute 'RAND_LIMIT_swigconstant'
JulianNorton commented 7 years ago

@Instassa I think this is the right thread and solution:

christopherhesse commented 5 years ago

The box2d swig error should be fixed in master, we also don't use doom_py or pachi_py in gym so any errors with those should be filed on their respective repos.