invalid-action-masking: [Bug?] An error when installing gym_microrts

Hi,

Thanks for the great work. I am interested in this paper and attempt to reproduce the experiments to understand more.

One error is that Multiple top-level packages discovered in a flat-layout: ['maps', 'docker', 'experiments', 'gym_microrts']. when installing gym_microrts. I guess this is caused by automatic discovery of the setuptools as not explicitly specified in setup.py.

This workaround works for me: adding py_modules=['gym_microrts'] in the setup.py.

Specifically, I modified .../envs/act_mask/src/gym-microrts/setup.py to:

from setuptools import setup

setup(name='gym_microrts',
      version='0.1.0',
      install_requires=['gym', 'dacite', 'jPype1', 'hilbertcurve'],
      py_modules=['gym_microrts']
)

Previously, it is:

from setuptools import setup

setup(name='gym_microrts',
      version='0.1.0',
      install_requires=['gym', 'dacite', 'jPype1', 'hilbertcurve']
)

The environment specifications:

  • anaconda: v4.11.0
  • Python: 3.8

Error details:

$ poetry install
Installing dependencies from lock file

Package operations: 0 installs, 32 updates, 1 removal

  • Removing py (1.10.0)
  • Updating certifi (2021.10.8 -> 2021.5.30)
  • Updating charset-normalizer (2.0.7 -> 2.0.1)
  • Updating idna (3.3 -> 3.2)
  • Updating pytz (2021.3 -> 2021.1)
  • Updating urllib3 (1.26.7 -> 1.26.6)
  • Updating cachetools (4.2.4 -> 4.2.2)
  • Updating click (8.0.3 -> 8.0.1)
  • Updating jinja2 (3.0.2 -> 3.0.1)
  • Updating numpy (1.21.4 -> 1.21.0)
  • Updating packaging (21.2 -> 21.0)
  • Updating smmap (5.0.0 -> 4.0.0)
  • Updating typing-extensions (3.10.0.2 -> 3.10.0.0)
  • Updating cloudpickle (2.0.0 -> 1.6.0)
  • Updating cycler (0.11.0 -> 0.10.0)
  • Updating gitdb (4.0.9 -> 4.0.7)
  • Updating google-auth (2.3.3 -> 1.32.1)
  • Updating kiwisolver (1.3.2 -> 1.3.1)
  • Updating pillow (8.4.0 -> 8.3.1)
  • Updating absl-py (0.15.0 -> 0.13.0)
  • Updating configparser (5.1.0 -> 5.0.2)
  • Updating google-auth-oauthlib (0.4.6 -> 0.4.4)
  • Updating grpcio (1.41.1 -> 1.38.1)
  • Updating gym (0.21.0 -> 0.17.3)
  • Updating matplotlib (3.4.3 -> 3.4.2)
  • Updating pandas (1.3.4 -> 1.3.0)
  • Updating protobuf (3.19.1 -> 3.17.3)
  • Updating sentry-sdk (1.4.3 -> 1.4.2)
  • Updating werkzeug (2.0.2 -> 2.0.1)
  • Updating tensorboard (2.7.0 -> 2.5.0)
  • Updating wandb (0.12.6 -> 0.12.2)
  • Updating cleanrl (0.0.1 35694d2 -> 0.0.1 35694d2)
  • Updating gym-microrts (0.0.0 /home/***/gym-microrts -> 0.1.0 b0cabba): Failed

  EnvCommandError

  Command ['/home/***/anaconda3/envs/act_mask/bin/pip', 'install', '--no-deps', '-U', '-e', '/home/***/anaconda3/envs/act_mask/src/gym-microrts'] errored with the following return code 1, and output: 
  Obtaining file:///home/***/anaconda3/envs/act_mask/src/gym-microrts
    Preparing metadata (setup.py): started
    Preparing metadata (setup.py): finished with status 'error'
    error: subprocess-exited-with-error
    
    × python setup.py egg_info did not run successfully.
    │ exit code: 1
    ╰─> [14 lines of output]
        error: Multiple top-level packages discovered in a flat-layout: ['maps', 'docker', 'experiments', 'gym_microrts'].
        
        To avoid accidental inclusion of unwanted files or directories,
        setuptools will not proceed with this build.
        
        If you are trying to create a single distribution with multiple packages
        on purpose, you should not rely on automatic discovery.
        Instead, consider the following options:
        
        1. set up custom discovery (`find` directive with `include` or `exclude`)
        2. use a `src-layout`
        3. explicitly set `py_modules` or `packages` with a list of names
        
        To find more information, look for "package discovery" on setuptools docs.
        [end of output]
    
    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: metadata-generation-failed
  
  × Encountered error while generating package metadata.
  ╰─> See above for output.
  
  note: This is an issue with the package mentioned above, not pip.
  hint: See above for details.
  

  at ~/.poetry/lib/poetry/utils/env.py:1195 in _run
      1191│                 output = subprocess.check_output(
      1192│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1193│                 )
      1194│         except CalledProcessError as e:
    → 1195│             raise EnvCommandError(e, input=input_)
      1196│ 
      1197│         return decode(output)
      1198│ 
      1199│     def execute(self, bin, *args, **kwargs):

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

Could you also give this a try? https://github.com/vwxyzjn/ppo-implementation-details#gym-microrts-multidiscrete

Should I only run the multidiscrete part?

poetry run python ppo_multidiscrete_mask.py is essentially the same as ppo.py in this repo.