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

Pymunk error when trying to run the basic example #3

Closed
sai-prasanna opened this issue Feb 10, 2022 · 6 comments
Closed

Pymunk error when trying to run the basic example #3

sai-prasanna opened this issue Feb 10, 2022 · 6 comments

Comments

@sai-prasanna
Copy link

I created a new conda env with python 3.8 and tried to run the basic example,

import gym
import xmagical

# This must be called before making any Gym envs.
xmagical.register_envs()

# List all available environments.
print(xmagical.ALL_REGISTERED_ENVS)

# Create a demo variant for the SweepToTop task with a gripper agent.
env = gym.make('SweepToTop-Gripper-Pixels-Allo-Demo-v0')
obs = env.reset()

I get the following error trace,

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/gym/wrappers/order_enforcing.py", line 16, in reset
    return self.env.reset(**kwargs)
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/xmagical/benchmarks/sweep_to_top.py", line 192, in reset
    obs = super().reset()
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/xmagical/base_env.py", line 201, in reset
    self.add_entities([self._arena])
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/xmagical/base_env.py", line 140, in add_entities
    entity.setup(self.renderer, self._space, self._phys_vars)
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/xmagical/entities/arena.py", line 38, in setup
    self.add_to_space(*arena_segments)
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/xmagical/entities/base.py", line 100, in add_to_space
    _add(obj)
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/xmagical/entities/base.py", line 80, in _add
    self.space.add(obj)
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/pymunk/space.py", line 401, in add
    self._add_shape(o)
  File "/home/ramans/miniconda3/envs/xmagical/lib/python3.8/site-packages/pymunk/space.py", line 441, in _add_shape
    assert (
AssertionError: The shape's body must be added to the space before (or at the same time) as the shape.

Would this be due to some version pinning issue?

@jonzamora
Copy link

Similar issue here, any help will be greatly appreciated!

@sai-prasanna
Copy link
Author

@jonzamora I managed to fix it by installing pymunk 5.7.0

pip install pymunk==5.7.0

@jonzamora
Copy link

That worked, thanks! @sai-prasanna

@kevinzakka
Copy link
Owner

Hi, apologies for the late reply. I just tried a fresh conda install with python 3.8 and ran the steps outlined in install from source and it works fine with pymunk==5.6.0. Did you pip install or install from source?

@sai-prasanna
Copy link
Author

@kevinzakka I installed from pypi pip install x-magical

@kevinzakka
Copy link
Owner

kevinzakka commented Jun 3, 2022

@sai-prasanna Thanks! Looks like i had specific versions in the requirements file but not in setup.py. Should now hopefully work in version 0.0.4!

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

3 participants