mila-iqia / milatools

Tools to connect to and interact with the Mila cluster
MIT License
63 stars 12 forks source link

[v0.0.17] Issue running the command `mila init` #43

Closed amansouri3476 closed 1 year ago

amansouri3476 commented 1 year ago

I tried to update milatools to be able to do ssh mila-cpu. I followed the instructions that were put in the slack channel. First I did: pip install -U milatools and got the following output:

Requirement already satisfied: milatools in ./miniconda3/lib/python3.9/site-packages (0.0.17)
Requirement already satisfied: blessed<2.0.0,>=1.18.1 in ./miniconda3/lib/python3.9/site-packages (from milatools) (1.19.1)
Requirement already satisfied: questionary<2.0.0,>=1.10.0 in ./miniconda3/lib/python3.9/site-packages (from milatools) (1.10.0)
Requirement already satisfied: sshconf<0.3.0,>=0.2.2 in ./miniconda3/lib/python3.9/site-packages (from milatools) (0.2.3)
Requirement already satisfied: Fabric<3.0.0,>=2.7.0 in ./miniconda3/lib/python3.9/site-packages (from milatools) (2.7.1)
Requirement already satisfied: coleo<0.4.0,>=0.3.0 in ./miniconda3/lib/python3.9/site-packages (from milatools) (0.3.2)
Requirement already satisfied: wcwidth>=0.1.4 in ./miniconda3/lib/python3.9/site-packages (from blessed<2.0.0,>=1.18.1->milatools) (0.2.5)
Requirement already satisfied: six>=1.9.0 in ./miniconda3/lib/python3.9/site-packages (from blessed<2.0.0,>=1.18.1->milatools) (1.16.0)
Requirement already satisfied: ptera<2.0.0,>=1.4.1 in ./miniconda3/lib/python3.9/site-packages (from coleo<0.4.0,>=0.3.0->milatools) (1.4.1)
Requirement already satisfied: paramiko>=2.4 in ./miniconda3/lib/python3.9/site-packages (from Fabric<3.0.0,>=2.7.0->milatools) (2.11.0)
Requirement already satisfied: invoke<2.0,>=1.3 in ./miniconda3/lib/python3.9/site-packages (from Fabric<3.0.0,>=2.7.0->milatools) (1.7.1)
Requirement already satisfied: pathlib2 in ./miniconda3/lib/python3.9/site-packages (from Fabric<3.0.0,>=2.7.0->milatools) (2.3.7.post1)
Requirement already satisfied: bcrypt>=3.1.3 in ./miniconda3/lib/python3.9/site-packages (from paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (3.2.2)
Requirement already satisfied: pynacl>=1.0.1 in ./miniconda3/lib/python3.9/site-packages (from paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (1.5.0)
Requirement already satisfied: cryptography>=2.5 in ./miniconda3/lib/python3.9/site-packages (from paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (3.4.7)
Requirement already satisfied: cffi>=1.1 in ./miniconda3/lib/python3.9/site-packages (from bcrypt>=3.1.3->paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (1.14.6)
Requirement already satisfied: pycparser in ./miniconda3/lib/python3.9/site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (2.20)
Requirement already satisfied: giving<0.5.0,>=0.4.1 in ./miniconda3/lib/python3.9/site-packages (from ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (0.4.2)
Requirement already satisfied: codefind<0.2.0,>=0.1.2 in ./miniconda3/lib/python3.9/site-packages (from ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (0.1.3)
Requirement already satisfied: varname<0.11.0,>=0.10.0 in ./miniconda3/lib/python3.9/site-packages (from giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (0.10.0)
Requirement already satisfied: asttokens<3.0.0,>=2.2.1 in ./miniconda3/lib/python3.9/site-packages (from giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (2.2.1)
Requirement already satisfied: reactivex<5.0.0,>=4.0.0 in ./miniconda3/lib/python3.9/site-packages (from giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (4.0.4)
Requirement already satisfied: prompt_toolkit<4.0,>=2.0 in ./miniconda3/lib/python3.9/site-packages (from questionary<2.0.0,>=1.10.0->milatools) (3.0.30)
Requirement already satisfied: typing-extensions<5.0.0,>=4.1.1 in ./miniconda3/lib/python3.9/site-packages (from reactivex<5.0.0,>=4.0.0->giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (4.3.0)
Requirement already satisfied: executing<2.0,>=1.1 in ./miniconda3/lib/python3.9/site-packages (from varname<0.11.0,>=0.10.0->giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (1.2.0)

Then I tried running mila init and got the following error:

Checking ssh config
? The '*.server.mila.quebec' entry in ~/.ssh/config is too general and should exclude login.server.mila.quebec. Fix this? Yes
Traceback (most recent call last):
  File "/Users/amin/miniconda3/lib/python3.9/site-packages/milatools/cli/commands.py", line 43, in main
    auto_cli(milatools)
  File "/Users/amin/miniconda3/lib/python3.9/site-packages/coleo/cli.py", line 656, in auto_cli
    result = run_cli(entry, args, **kwargs)
  File "/Users/amin/miniconda3/lib/python3.9/site-packages/coleo/cli.py", line 628, in run_cli
    return call(opts=opts, args=args)
  File "/Users/amin/miniconda3/lib/python3.9/site-packages/coleo/cli.py", line 587, in thunk
    result = fn(*args)
  File "/Users/amin/miniconda3/lib/python3.9/site-packages/milatools/cli/commands.py", line 129, in init
    setup_ssh_config()
  File "/Users/amin/miniconda3/lib/python3.9/site-packages/milatools/cli/init_command.py", line 76, in setup_ssh_config
    ssh_config.rename("*.server.mila.quebec", cnode_pattern)
  File "/Users/amin/miniconda3/lib/python3.9/site-packages/sshconf.py", line 459, in rename
    raise ValueError("Host %s: already exists." % new_host)
ValueError: Host *.server.mila.quebec !*login.server.mila.quebec: already exists.

An error occured during the execution of the command `init`. Please try updating milatools by running
  pip install milatools --upgrade
in the terminal. If the issue persists, consider filling a bug report at
  https://github.com/mila-iqia/milatools/issues/new?labels=init%2C0.0.17&template=bug_report.md&title=%5Bv0.0.17%5D+Issue+running+the+command+%60mila+init%60
Please provide the error traceback with the report (the red text above).

I tried pip install milatools --upgrade but got the following:

Requirement already satisfied: milatools in ./miniconda3/lib/python3.9/site-packages (0.0.17)
Requirement already satisfied: coleo<0.4.0,>=0.3.0 in ./miniconda3/lib/python3.9/site-packages (from milatools) (0.3.2)
Requirement already satisfied: blessed<2.0.0,>=1.18.1 in ./miniconda3/lib/python3.9/site-packages (from milatools) (1.19.1)
Requirement already satisfied: Fabric<3.0.0,>=2.7.0 in ./miniconda3/lib/python3.9/site-packages (from milatools) (2.7.1)
Requirement already satisfied: sshconf<0.3.0,>=0.2.2 in ./miniconda3/lib/python3.9/site-packages (from milatools) (0.2.3)
Requirement already satisfied: questionary<2.0.0,>=1.10.0 in ./miniconda3/lib/python3.9/site-packages (from milatools) (1.10.0)
Requirement already satisfied: six>=1.9.0 in ./miniconda3/lib/python3.9/site-packages (from blessed<2.0.0,>=1.18.1->milatools) (1.16.0)
Requirement already satisfied: wcwidth>=0.1.4 in ./miniconda3/lib/python3.9/site-packages (from blessed<2.0.0,>=1.18.1->milatools) (0.2.5)
Requirement already satisfied: ptera<2.0.0,>=1.4.1 in ./miniconda3/lib/python3.9/site-packages (from coleo<0.4.0,>=0.3.0->milatools) (1.4.1)
Requirement already satisfied: pathlib2 in ./miniconda3/lib/python3.9/site-packages (from Fabric<3.0.0,>=2.7.0->milatools) (2.3.7.post1)
Requirement already satisfied: paramiko>=2.4 in ./miniconda3/lib/python3.9/site-packages (from Fabric<3.0.0,>=2.7.0->milatools) (2.11.0)
Requirement already satisfied: invoke<2.0,>=1.3 in ./miniconda3/lib/python3.9/site-packages (from Fabric<3.0.0,>=2.7.0->milatools) (1.7.1)
Requirement already satisfied: bcrypt>=3.1.3 in ./miniconda3/lib/python3.9/site-packages (from paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (3.2.2)
Requirement already satisfied: pynacl>=1.0.1 in ./miniconda3/lib/python3.9/site-packages (from paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (1.5.0)
Requirement already satisfied: cryptography>=2.5 in ./miniconda3/lib/python3.9/site-packages (from paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (3.4.7)
Requirement already satisfied: cffi>=1.1 in ./miniconda3/lib/python3.9/site-packages (from bcrypt>=3.1.3->paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (1.14.6)
Requirement already satisfied: pycparser in ./miniconda3/lib/python3.9/site-packages (from cffi>=1.1->bcrypt>=3.1.3->paramiko>=2.4->Fabric<3.0.0,>=2.7.0->milatools) (2.20)
Requirement already satisfied: codefind<0.2.0,>=0.1.2 in ./miniconda3/lib/python3.9/site-packages (from ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (0.1.3)
Requirement already satisfied: giving<0.5.0,>=0.4.1 in ./miniconda3/lib/python3.9/site-packages (from ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (0.4.2)
Requirement already satisfied: reactivex<5.0.0,>=4.0.0 in ./miniconda3/lib/python3.9/site-packages (from giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (4.0.4)
Requirement already satisfied: asttokens<3.0.0,>=2.2.1 in ./miniconda3/lib/python3.9/site-packages (from giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (2.2.1)
Requirement already satisfied: varname<0.11.0,>=0.10.0 in ./miniconda3/lib/python3.9/site-packages (from giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (0.10.0)
Requirement already satisfied: prompt_toolkit<4.0,>=2.0 in ./miniconda3/lib/python3.9/site-packages (from questionary<2.0.0,>=1.10.0->milatools) (3.0.30)
Requirement already satisfied: typing-extensions<5.0.0,>=4.1.1 in ./miniconda3/lib/python3.9/site-packages (from reactivex<5.0.0,>=4.0.0->giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (4.3.0)
Requirement already satisfied: executing<2.0,>=1.1 in ./miniconda3/lib/python3.9/site-packages (from varname<0.11.0,>=0.10.0->giving<0.5.0,>=0.4.1->ptera<2.0.0,>=1.4.1->coleo<0.4.0,>=0.3.0->milatools) (1.2.0)

Running mila init for another time gave the same error and it appears that issue persists, so I opened this issue.

Desktop:

Thanks a lot for this new feature. I can't wait to use it once this issue is resolved!

breuleux commented 1 year ago

I'm going to try to reproduce the problem later but in the meantime can you try answering "No" at the prompt ? The '*.server.mila.quebec' entry in ~/.ssh/config is too general and should exclude login.server.mila.quebec. Fix this? If that doesn't work, you can also manually remove or comment out that existing entry in ~/.ssh/config.

amansouri3476 commented 1 year ago

Answering "No" fixes the problem actually. I'm sorry I didn't try it myself, I thought that fix is a necessary step. I can now do ssh mila-cpu and mila code path/to/code to open a vscode window.

Thanks so much for the new features of milatools!

breuleux commented 1 year ago

No problem, it makes sense that you thought it was necessary. And what you reported appears to be an actual bug, so I'll keep this open until we can fix it.

breuleux commented 1 year ago

The bug should be fixed in 0.0.18.