Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box2D make environment error: RAND_LIMIT_swigconstant #83

Closed
JKCooper2 opened this issue May 10, 2016 · 1 comment
Closed

Box2D make environment error: RAND_LIMIT_swigconstant #83

JKCooper2 opened this issue May 10, 2016 · 1 comment

Comments

@JKCooper2
Copy link
Contributor

Installed most recent gym and when running env = gym.make('LunarLander-v0') for the Box2D environments it's displaying the error:

[2016-05-10 19:13:27,417] Making new env: LunarLander-v0
Traceback (most recent call last):
  File "/home/jesse/AI/OpenAI/openai/Environments/CartPole-v0/CartPole-v0.py", line 58, in <module>
    main()
  File "/home/jesse/AI/OpenAI/openai/Environments/CartPole-v0/CartPole-v0.py", line 13, in main
    env = gym.make('LunarLander-v0')
  File "/home/jesse/AI/OpenAI/gym/gym/envs/registration.py", line 79, in make
    return spec.make()
  File "/home/jesse/AI/OpenAI/gym/gym/envs/registration.py", line 54, in make
    cls = load(self._entry_point)
  File "/home/jesse/AI/OpenAI/gym/gym/envs/registration.py", line 13, in load
    result = entry_point.load(False)
  File "/home/jesse/anaconda3/envs/openai/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2229, in load
    return self.resolve()
  File "/home/jesse/anaconda3/envs/openai/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2235, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/jesse/AI/OpenAI/gym/gym/envs/box2d/__init__.py", line 1, in <module>
    from gym.envs.box2d.lunar_lander import LunarLander
  File "/home/jesse/AI/OpenAI/gym/gym/envs/box2d/lunar_lander.py", line 4, in <module>
    import Box2D
  File "/home/jesse/anaconda3/envs/openai/lib/python2.7/site-packages/Box2D/__init__.py", line 20, in <module>
    from .Box2D import *
  File "/home/jesse/anaconda3/envs/openai/lib/python2.7/site-packages/Box2D/Box2D.py", line 435, in <module>
    _Box2D.RAND_LIMIT_swigconstant(_Box2D)
AttributeError: 'module' object has no attribute 'RAND_LIMIT_swigconstant'

_Box2D is being loaded correctly as I can modify the Box2D.py file to display _Box2D.RAND_LIMIT before the _Box2D.RAND_LIMIT_swigconstant(_Box2D) call. Seems to be affecting all _swig_constant calls (commenting out the offending line then throws and error on _Box2D.b2_pi_swigconstant(_Box2D). Does another library need to be installed to get this to work?

@gdb
Copy link
Collaborator

gdb commented May 11, 2016

Here are some instructions from @jonasschneider (I think he's adding or already added to our box2d package):

HINT: To install box2d-py, you need Swig >= 3.0.0.
On OS X, `brew upgrade && brew install swig` should get you the latest
version.
Current Ubuntu stable versions include a recent package, so `apt-get
install swig` should be enough there.
However, on the older Ubuntu 14.04 LTS, you need to install a backported version
(be careful, these commands remove any installed older versions of Swig):

    echo deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse | sudo tee /etc/apt/sources.list.d/box2d-py-swig.list
    apt-get install -t trusty-backports swig3.0
    apt-get remove swig swig2.0
    ln -s /usr/bin/swig3.0 /usr/bin/swig

We'll make this better over time, but it'll be a non-trivial change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants