Arena-Baselines icon indicating copy to clipboard operation
Arena-Baselines copied to clipboard

PyInquirer ImportError in Arena but not in python3.7

Open JustinS6626 opened this issue 4 years ago • 7 comments

I am trying to use Arena on Linux Mint 19.3 through python 3.7, and when I tried to run

python train.py -f ./arena-experiments/Arena-Benchmark.yaml

I got the following output:

Traceback (most recent call last): File "train.py", line 24, in from arena import * File "/home/justin/Arena/Arena-Baselines/arena/init.py", line 1, in from .arena import * File "/home/justin/Arena/Arena-Baselines/arena/arena.py", line 13, in from .utils import * File "/home/justin/Arena/Arena-Baselines/arena/utils.py", line 12, in from PyInquirer import style_from_dict, Token, prompt, Separator File "/usr/local/lib/python3.7/dist-packages/PyInquirer/init.py", line 6, in from prompt_toolkit.token import Token ImportError: cannot import name 'Token' from 'prompt_toolkit.token' (/usr/lib/python3.7/site-packages/prompt_toolkit/token.py)

However, when I enter the command from PyInquirer import style_from_dict, Token, prompt, Separator in Python3.7 idle, it executes successfully. Please advise as to how I can fix the problem when trying to run Arena.

JustinS6626 avatar Feb 27 '20 23:02 JustinS6626

just fixed in a recent commit, looks like import Token is not necessary. https://github.com/YuhangSong/Arena-Baselines/commit/b14ad61527ae1c422eeb9c61204dba1947d52d36

YuhangSong avatar Feb 28 '20 13:02 YuhangSong

however, I cannot reproduce the error message from you, which seems to be a PyInquirer problem depends on the system you are running on? let me know if the recent commit does not fix your issue.

YuhangSong avatar Feb 28 '20 13:02 YuhangSong

I tried with the new commit, but the same problem still appears. There are a lot of other compatibility issues as well, all of them due to Arena and mlagents not working with the newest version of their required packages. For instance, Arena does not accept versions of Tensorflow past 1.14.

JustinS6626 avatar Mar 01 '20 02:03 JustinS6626

Hi, thanks for pointing out.

To clarify things,

We use TF-1.14 specifically since rllib breaks after this version. PPO cannot solve Pong at least as I tested.

mlagents requires another version of TF, however, we are not using any code related to TF in mlagents, we only use the part of the code in mlagents that is related to building an interface to the games. Thus, you are seeing pip install tensorflow-gpu==1.14 after we installed mlagents.

Secondly, mlagents made a few updates after we have built the project. Considering the improvements of the updates is not really important for our project, we stay in the older version, which is why you are seeing git checkout 9b1a39982fd03de8f40f85d61f903e6d972fd2cc.

Finally, I remove my env and re-install the env following the steps given in the readme file. I successfully reproduce the environment. Thus, please do confirm that you follow the steps in the readme file here: https://github.com/YuhangSong/Arena-Baselines#dependencies.

YuhangSong avatar Mar 02 '20 14:03 YuhangSong

Also, you may encounter errors while installing dependencies:

ERROR: jupyter-console 6.1.0 has requirement prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.14 which is incompatible.
ERROR: ipython 7.13.0 has requirement prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.14 which is incompatible.

However, we found it is safe to just ignore them.

YuhangSong avatar Mar 02 '20 14:03 YuhangSong

Also, the other users of this project confirmed that he can reproduce the environment easily just copy and paste the command lines in https://github.com/YuhangSong/Arena-Baselines#dependencies

Since all the command lines are all working at installing things in a conda python virtual environment (not requiring any system-level changes), I would be surprised this environment is not producible on some systems.

So, could you please confirm that you strictly follow the lines we put there?

In any case, please keep me updated, we target at making this compatible as possible.

YuhangSong avatar Mar 02 '20 14:03 YuhangSong

We have further frozen the package's version in requirements.txt, as well as update commands in readme.md, now you only have to run pip install -r requirements.txt. We have tested it on several new machines and we did not find any problem with running the code and benchmark the games.

Let me know if you meet further issues, otherwise, I will code this issue in days.

YuhangSong avatar Apr 11 '20 03:04 YuhangSong