Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: run() missing 1 required positional argument: 'pymongo_client' #1

Open
lcassano opened this issue Nov 9, 2020 · 10 comments

Comments

@lcassano
Copy link

lcassano commented Nov 9, 2020

Hi when I run the example "" I get the following error with pymongo. Any idea on how to fix this?

Thanks in advance

:/pymarl# python3 src/main.py --config=qmix --env-config=sc2 with env_args.map_name=2s3z
pygame 2.0.0 (SDL 2.0.12, python 3.5.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
src/main.py:79: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config_dict = yaml.load(f)
src/main.py:49: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config_dict = yaml.load(f)
Traceback (most recent call last):
File "src/main.py", line 85, in
alg_config = _get_config(params, "--config", "algs")
File "src/main.py", line 47, in _get_config
with open(os.path.join(os.path.dirname(file), "config", subfolder, "{}.yaml".format(config_name)), "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'src/config/algs/qmix.yaml'
root@6c7269d7eab6:/pymarl# python3 src/main.py --config=ow_qmix --env-config=sc2 with env_args.map_name=3s5z w=0.5 epsilon_anneal_time=1000000
pygame 2.0.0 (SDL 2.0.12, python 3.5.2)
Hello from the pygame community. https://www.pygame.org/contribute.html
src/main.py:79: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config_dict = yaml.load(f)
src/main.py:49: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config_dict = yaml.load(f)
[INFO 18:08:50] root Saving to FileStorageObserver in results/sacred.
[DEBUG 18:08:50] pymarl Using capture mode "fd"
[INFO 18:08:50] pymarl Running command 'my_main'
[INFO 18:08:50] pymarl Started run with ID "1"
[DEBUG 18:08:50] my_main Started
[ERROR 18:08:50] pymarl Failed after 0:00:00!
Traceback (most recent calls WITHOUT Sacred internals):
File "src/main.py", line 35, in my_main
run(_run, config, _log)
TypeError: run() missing 1 required positional argument: 'pymongo_client'

@tabzraz
Copy link
Collaborator

tabzraz commented Nov 12, 2020

Apologies, I forgot to specify a default of None for the pymongo argument. I've just committed a change, it should fix this.

@lcassano
Copy link
Author

Thanks for the comment.
By the way you have another issue in qmix_central_no_hyper.py lines 46 and 47:
if self.args.central_skip:
y = y + agent_qs.sum(dim=-1, keepdim=True)

I got an error that self.args does not have attribute central_skip. I guess it is a similar issue. I just commented these two lines out and at least the algorithm seems to run properly.
Also what file is the one where intermediate results are saved (to plot curves)?

@tabzraz
Copy link
Collaborator

tabzraz commented Nov 12, 2020

Thanks! I've removed that too (it was an option from early on in testing to have a skip connection in qCentral that wasn't used).

logging.py (https://github.com/oxwhirl/wqmix/blob/master/src/utils/logging.py) gathers the various things which are logged and then sacred saves them (to disk by default, sacred has other options for storing results like a mongodb).

@lcassano
Copy link
Author

Sacred creates a .json file? In results several *.json files are saved, but none that have the evolution of "battle_won_mean" across iterations. I'm wondering if there's a bug or I should be looking somewhere else or there is a flag I must turn on.

One other question: If I run the code on the terminal everything seems to be ok. But if I try to run it on Pycharm "websocket.create_connection(url, timeout=timeout_seconds)" always times out. I know this is not a firewall issue, any thoughts on this?

@tabzraz
Copy link
Collaborator

tabzraz commented Nov 12, 2020

Under the results/sacred/ there should be a directory for each run where sacred is saving stuff (config.json, cout.txt, info.json, run.json, etc).
info.json should have 2 fields for each of the logged entries, one for the value and one for the timestep that value was logged ("battle_won_mean" and "battle_won_mean_T" for example).

I usually run the code from PyCharm (using a venv) and haven't had problems with SC2 timing out.

@lcassano
Copy link
Author

Thanks for the info. I'm using Pycharm (with a conda env) and it can never connect (same issue with Pymarl), it gives after around 110 attempts. I get:

...
[INFO 16:47:56] absl Connecting to: ws://127.0.0.1:24302/sc2api, attempt: 112, running: True
[INFO 16:47:57] absl Connecting to: ws://127.0.0.1:24302/sc2api, attempt: 113, running: True
[WARNING 16:48:00] absl SC2 isn't running, so bailing early on the websocket connection.
[INFO 16:48:00] absl Shutdown gracefully.
[INFO 16:48:00] absl Shutdown with return code: 1
Blizzard Error Report ID: ECEC106B-037C-4974-B7A6-EACFA2729E20

I guess I'll keep looking. Thanks for the quick replies and if you think of something related to this issue please do tell :)

@tabzraz
Copy link
Collaborator

tabzraz commented Nov 12, 2020

It's weird that it can start the SC2 instance but can't connect to it.

Are you able to start and connect to a jupyter notebook from within your pycharm (independent of PyMARL)?

@lcassano
Copy link
Author

It's weird that it can start the SC2 instance but can't connect to it. -> Agreed XD

Are you able to start and connect to a jupyter notebook from within your pycharm (independent of PyMARL)? -> No idea, I never tried connecting to a jupyter notebook from within pycharm. I'll give it a shot, see what happens.

@lcassano
Copy link
Author

Hey by running install_sc2.sh all necessary components are installed? Or is it also necessary to install the free version of SCII from https://starcraft2.com/en-us/? I installed the free version and I'm starting to think this is the problem.
When you train an agent you get real time rendering of the games being played?

@tabzraz
Copy link
Collaborator

tabzraz commented Dec 14, 2020

install_sc2.sh should install all the necessary SC2 files to run the experiments with. When I train an agent I don't get any graphical output on Linux.
I think you only need the free version of SC2 when you want to view a replay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants