Farama-Foundation / Minigrid

Simple and easily configurable grid world environments for reinforcement learning
https://minigrid.farama.org/
Other
2.09k stars 604 forks source link

[Bug Report] Cannot import `minigrid` with version `2.1.0` #318

Closed giangbang closed 1 year ago

giangbang commented 1 year ago

Describe the bug Cannot import minigrid after installing with version 2.1.0

Code example I install with pip using

pip install minigrid==2.1.0

then in my source code

import minigrid
[/usr/local/lib/python3.8/dist-packages/minigrid/__init__.py](https://localhost:8080/#) in <module>
      1 from __future__ import annotations
      2 
----> 3 from gymnasium.envs.registration import register
      4 
      5 from minigrid import minigrid_env, wrappers

[/usr/local/lib/python3.8/dist-packages/gymnasium/__init__.py](https://localhost:8080/#) in <module>
     10 )
     11 from gymnasium.spaces.space import Space
---> 12 from gymnasium.envs.registration import make, spec, register, registry, pprint_registry
     13 from gymnasium import envs, spaces, utils, vector, wrappers, error, logger, experimental
     14 

[/usr/local/lib/python3.8/dist-packages/gymnasium/envs/__init__.py](https://localhost:8080/#) in <module>
    362 
    363 # Hook to load plugins from entry points
--> 364 load_env_plugins()

[/usr/local/lib/python3.8/dist-packages/gymnasium/envs/registration.py](https://localhost:8080/#) in load_env_plugins(entry_point)
    308 
    309         with context:
--> 310             fn = plugin.load()
    311             try:
    312                 fn()

[/usr/local/lib/python3.8/dist-packages/importlib_metadata/__init__.py](https://localhost:8080/#) in load(self)
    206         """
    207         match = self.pattern.match(self.value)
--> 208         module = import_module(match.group('module'))
    209         attrs = filter(None, (match.group('attr') or '').split('.'))
    210         return functools.reduce(getattr, attrs, module)

[/usr/lib/python3.8/importlib/__init__.py](https://localhost:8080/#) in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

[/usr/local/lib/python3.8/dist-packages/minigrid/__init__.py](https://localhost:8080/#) in <module>
      3 from gymnasium.envs.registration import register
      4 
----> 5 from minigrid import minigrid_env, wrappers
      6 from minigrid.core import roomgrid
      7 from minigrid.core.world_object import Wall

[/usr/local/lib/python3.8/dist-packages/minigrid/minigrid_env.py](https://localhost:8080/#) in <module>
     11 from gymnasium import spaces
     12 
---> 13 from minigrid.core.constants import COLOR_NAMES, DIR_TO_VEC, TILE_PIXELS
     14 from minigrid.core.grid import Grid
     15 from minigrid.core.mission import MissionSpace

ModuleNotFoundError: No module named 'minigrid.core'

I have checked what is inside /usr/local/lib/python3.8/dist-packages/minigrid but it seems to missing some other folders like core, envs and utils. image

I downgraded minigrid to version 2.0.0 and it works fine again.

System Info Describe the characteristic of your environment:

Additional context Add any other context about the problem here: None

Checklist

BolunDai0216 commented 1 year ago

I'll need to investigate a bit to see what the issue is, but I think in the meantime v2.1.1 would suit your needs.

krfricke commented 1 year ago
Screen Shot 2023-03-02 at 3 04 55 PM

I think the problem is that there was a faulty wheel uploaded to pypi, presumably when uploading the latest release (see screenshot).

https://pypi.org/project/minigrid/2.1.0/#files

The 21 kB file does not include all files.

Can you just delete that artifact from pypi?

pseudo-rnd-thoughts commented 1 year ago

Good spot, yes the artifact has been deleted.