[Bug Report] 'pip install -e .', is missing something, causing 'from pettingzoo import AECEnv' not to be available
zbenmo opened this issue · 6 comments
Describe the bug
While trying to solve this item "Reset definition retains return_info #824". I have forked-cloned and 'pip install -e .'.
I get the following, which I do not get if I install just 'pip install pettingzoo'. The PettingZoo versions seems to be the same.
Code example
from pettingzoo import AECEnv
E ImportError: cannot import name 'AECEnv' from 'pettingzoo' (unknown location)
System info
pip install -e .
(venv) oren@DESKTOP-11JEIEO:~/projects/qwertyenv$ pip show pettingzoo
Name: pettingzoo
Version: 1.22.3
Summary: Gymnasium for multi-agent reinforcement learning.
Home-page:
Author:
Author-email: Farama Foundation contact@farama.org
License: MIT License
Location: /home/oren/projects/qwertyenv/venv/lib/python3.8/site-packages
Editable project location: /home/oren/projects/qwertyenv/PettingZoo
Requires: gymnasium, numpy
Required-by: qwertyenv
WSL2 Ubuntu (on Windows 11 but please don't hang to this as it is a perfect Ubuntu).
Linux DESKTOP-11JEIEO 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Python 3.8.10
Additional context
While trying to solve this item "Reset definition retains return_info #824"
I thought I'm smart, I'll add the parameter to the ActionWrapper, verify, git add, git commit, git push, pull request, and continue with what I'm trying to achieve, yet have issues as above.
Checklist
- I have checked that there is no similar issue in the repo
Just a thought. Maybe 'setup.cfg' was not added by mistake? 'setup.py' can be probably removed.
Can't reproduce the error on my local machine, could you give a full example of the file you're trying to run? Usually a failed install would say module not found pettingzoo, the fact that yours says (unknown location)
makes me think it's something specific to how you have things set up. Does your file happen to be named pettingzoo.py
? Or AECEnv.py? From some searching it looks like the unknown location issue can happen because of conflicting names between a module you are trying to load and a file you've created.
Edit: and FYI the repo is built using pyproject.toml as a configuration file, not config.cfg. Setup.py is only used for checking that the correct version is installed.
from pettingzoo import AECEnv
First and only line in a jupyter lab notebook.
Python 3.8.10
pip show pettingzoo
Name: pettingzoo
Version: 1.22.3
Summary: Gymnasium for multi-agent reinforcement learning.
Home-page:
Author:
Author-email: Farama Foundation contact@farama.org
License: MIT License
Location: /home/oren/projects/qwertyenv/venv/lib/python3.8/site-packages
Editable project location: /home/oren/projects/qwertyenv/PettingZoo
Requires: gymnasium, numpy
Required-by: qwertyenv
As a side note for the setup.cfg. I have my own projects (a couple), I use there both pyproject.toml and setup.cfg. In the past I have used (only) setup.py (but now I need the two files pyproject.toml and setup.cfg that replace the one file setup.py from the past).
from pettingzoo import AECEnv
First and only line in a jupyter lab notebook.
Python 3.8.10
pip show pettingzoo
Name: pettingzoo
Version: 1.22.3
Summary: Gymnasium for multi-agent reinforcement learning.
Home-page:
Author:
Author-email: Farama Foundation contact@farama.org
License: MIT License
Location: /home/oren/projects/qwertyenv/venv/lib/python3.8/site-packages
Editable project location: /home/oren/projects/qwertyenv/PettingZoo
Requires: gymnasium, numpy
Required-by: qwertyenvAs a side note for the setup.cfg. I have my own projects (a couple), I use there both pyproject.toml and setup.cfg. In the past I have used (only) setup.py (but now I need the two files pyproject.toml and setup.cfg that replace the one file setup.py from the past).
Not relevant to your problem but pyproject.toml is all you need generally speaking. Setup.cfg is an alternative but isn’t the standard. For personal projects I’ve found poetry to be pretty convenient for managing packages more easily as well as streamlining releasing and giving a starter template and installing faster than conda. (my two repos gobblet-rl and cathedral-rl use it if you want to see the difference) https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
https://packaging.python.org/en/latest/tutorials/packaging-projects/
https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/
Other side note: jupyter doesn’t allow pygame rendering afaik so I’d recommend against using it if you want to debug things visually.
I don’t see the problem though, your original post said it works fine when you do pip install pettingzoo? The release version is stable and works fine, no need to install locally unless you’re contributing to the project (in which case you definitely want to work locally and not in jupyter). You’ve pasted pip show a few times but not the actual error you get or the full script you’re trying to run or commands you’ve run previously to install it. I just did a colab notebook last night to test something and was able to install everything fine.
I’d say if you really want to use julyter, start a new virtual env without installing things, then in your first cell call !git clone [link to pettingzoo] and next cell !pip install -e . and then paste the output of that.
Thank you Elliot. Followed your guidelines. The issue does not repeat. You can close it. Can't understand the difference from what I've done and above, yet apparently there is. Best Regards, Oren --
…
In general making clean slate virtual envs solves a lot of problems so I’d guess that’s probably it. If you have any other questions or issues I’d recommend reaching out on the farama discord, as it’s generally easier to get fast responses and feedback there.