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

ModuleNotFoundError: No module named 'snake_gym.envs' #2

Open
thomasw-mitutoyo-ctl opened this issue Feb 26, 2020 · 3 comments
Open

Comments

@thomasw-mitutoyo-ctl
Copy link

thomasw-mitutoyo-ctl commented Feb 26, 2020

I am using the pip package snake-gym 1.8. My code is exactly as described on https://pypi.org/project/snake-gym/

import gym
import snake_gym
env = gym.make("snake-v0")

Full traceback:

Traceback (most recent call last):
  File ".../openai/test.py", line 4, in <module>
    env = gym.make("snake-v0")
  File "...\venv\lib\site-packages\gym\envs\registration.py", line 142, in make
    return registry.make(id, **kwargs)
  File "...\venv\lib\site-packages\gym\envs\registration.py", line 87, in make
    env = spec.make(**kwargs)
  File "...\venv\lib\site-packages\gym\envs\registration.py", line 58, in make
    cls = load(self.entry_point)
  File "...\venv\lib\site-packages\gym\envs\registration.py", line 17, in load
    mod = importlib.import_module(mod_name)
  File "C:\Users\...\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'snake_gym.envs'

Language: Python 3.7

IDE: Pycharm 2019.3.3

@vvvlc
Copy link

vvvlc commented Apr 4, 2020

Hi
I had same problem I used

pipenv install -e git+https://github.com/grantsrb/Gym-Snake.git#egg=snake_gym

and this to test code

import gym
import gym_snake
env = gym.make("snake-v0")
env.reset()
env.render()

for _ in range(500):
    env.render()
    env.step(1)

@AbdelrahmanAbdelgwad
Copy link

This command (pipenv install -e git+https://github.com/grantsrb/Gym-Snake.git#egg=snake_gym) is not working with me on anaconda

it outputs this
image

@DrKakku
Copy link

DrKakku commented Jan 10, 2022

I am using the pip package snake-gym 1.8. My code is exactly as described on https://pypi.org/project/snake-gym/

import gym
import snake_gym
env = gym.make("snake-v0")

Full traceback:

Traceback (most recent call last):
  File ".../openai/test.py", line 4, in <module>
    env = gym.make("snake-v0")
  File "...\venv\lib\site-packages\gym\envs\registration.py", line 142, in make
    return registry.make(id, **kwargs)
  File "...\venv\lib\site-packages\gym\envs\registration.py", line 87, in make
    env = spec.make(**kwargs)
  File "...\venv\lib\site-packages\gym\envs\registration.py", line 58, in make
    cls = load(self.entry_point)
  File "...\venv\lib\site-packages\gym\envs\registration.py", line 17, in load
    mod = importlib.import_module(mod_name)
  File "C:\Users\...\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'snake_gym.envs'

Language: Python 3.7

IDE: Pycharm 2019.3.3

I had the same Issue and to resolve it I had to perform the following steps

  • Install the package using the pip package manager pip install snake-gym
  • Download the repository from GitHub
  • copy the env folder from (snake-gym)[https://github.com/vivek3141/snake-gym/tree/master/snake_gym] in your clipboard
  • go to the location where the package was installed (You can usually find it using pip show snake_gym)
  • paste the env folder in the package folder

That should help fix it

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

4 participants