[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):
I also encountered the same problem. May I ask if you have solved it? I also created a virtual environment with Anaconda, and used "pip install git+" to install it. However, the problem you mentioned also appeared. I don't know how to solve it. Should I modify it from setup.py? I did not find the setup.py file and I am very confused.
I guess they released a new version: Farama-Foundation/MicroRTS-Py.
Quote their description:
A simple and highly efficient RTS-game-inspired environment for reinforcement learning (formerly Gym-MicroRTS).
Hey sorry to hear about the issue. I was able to reproduce your issue and pushed a fix. The bug was related to setuptools
The gym-microrts used in this repo was a very early version. If you just want to see how invalid action works, https://github.com/vwxyzjn/ppo-implementation-details/blob/main/ppo_multidiscrete_mask.py could be a better resource, and it also comes with a explained blog post https://iclr-blog-track.github.io/2022/03/25/ppo-implementation-details/.
Sorry for opening this again but I have the same error and this person and tried changing the setup tools like you did with no success...I cant seem to get it to work.
Sorry for opening this again but I have the same error and this person and tried changing the setup tools like you did with no success...I cant seem to get it to work.
What is your python version? Could you try python 3.8?
Sorry for opening this again but I have the same error and this person and tried changing the setup tools like you did with no success...I cant seem to get it to work.
What is your python version? Could you try python 3.8?
I am currently using python 3.8.10, changing setuptools to version 59.5.0 didnt improve anything and even changing the gym version to 0.26.0 then gave me problems with cleanRL.
Also, I really appreciate your quick response.
Sorry to hear about the issue you are running into... Interesting. I also ran on 3.8.10 and the installation was ok. What's your operating system? I was running on Ubuntu.
Could you also give this a try? https://github.com/vwxyzjn/ppo-implementation-details#gym-microrts-multidiscrete
Currently running Windows 10. I will try to get a clean install of Python 3.8.10, Pycharm, and Poetry and try the setuptool fix from scratch.... any more tips would be appreciated.
Maybe try running in WSL?
Could you also give this a try? https://github.com/vwxyzjn/ppo-implementation-details#gym-microrts-multidiscrete
Should I only run the multidiscrete part?
Maybe try running in WSL?
I will try this, thanks :)
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.
So I tried WSL and...nothing
EDIT: Just tried the MultiDiscrete and still nothing :(
Hmmm, this is so bizarre... I also included a requirement.txt https://github.com/vwxyzjn/invalid-action-masking/blob/master/requirements.txt. Could you give that a try?
Sorry for this, there seems to have been a Mixup I have just now noticed. The problem I have is with Farama-Foundation/MicroRTS-Py and not this version....extremely sorry but would also appreciate any tips to fix the problem with the repository.
Sorry for this, there seems to have been a Mixup I have just now noticed. The problem I have is with Farama-Foundation/MicroRTS-Py and not this version....extremely sorry but would also appreciate any tips to fix the problem with the repository.
Ah ok... Could you give the latest master of microrts-py a try? Note that this repo does not work with microrts-py master.