Ari Herman
Ari Herman

Reputation: 965

Persistent issues with installation of OpenAI gym

I am running Ubuntu 16.04 and am having trouble doing a full installation of "gym". What I did:

  1. Installed Anaconda 4.2.0 (the version that comes with Python 3.5)
  2. Installed dependencies with sudo apt-get install -y python-numpy python-dev cmake zlib1g-dev libjpeg-dev xvfb libav-tools xorg-dev python-opengl libboost-all-dev libsdl2-dev swig
  3. Cloned gym repository with "git clone https://github.com/openai/gym.git"
  4. Installed gym with cd gym and then pip install -e '.[all]'

I get no errors throughout this process. Then I open the Spyder ide and run:

import gym

env = gym.make("CartPole-v0")

And it works fine. However, when I run

import gym

env = gym.make("LunarLander-v2")

I get the error:

/path/anaconda3/lib/python3.5/site-packages/Box2D/_Box2D.cpython-35m-x86_64-linux-gnu.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm

I also get errors when I try to access other box2d and atari environments.

It is also worth noting that I tried doing all of this on another virtual machine on which I installed the Python 2.7 version of Anaconda, and I got the same message...so this does not seem to have anything to do with the version of python I am using.

Upvotes: 2

Views: 2489

Answers (2)

WonH
WonH

Reputation: 21

If you installed conda environment, use conda in your channel.

$ conda install -c https://conda.anaconda.org/kne pybox2d

Box2d will be added under python3.5/site-packages, and try code again.

import gym

env = gym.make("LunarLander-v2")

Good luck.

Upvotes: 2

BlackHC
BlackHC

Reputation: 702

I had the same issue on Ubuntu 16.04.

Try to install gcc (GCC) 4.8.5 in your conda environment with conda install -c anaconda gcc=4.8.5. This fixed it for me. See also https://anaconda.org/anaconda/gcc .

I had the same issue with my default gcc $ gcc --version gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4)

Hope that helps!

Upvotes: 4

Related Questions