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

Impossible to "ssh-copy-id mila" in the "mila init" process on Windows 11 #63

Closed
Basile-Terv opened this issue Oct 31, 2023 · 1 comment · Fixed by #65
Closed

Impossible to "ssh-copy-id mila" in the "mila init" process on Windows 11 #63

Basile-Terv opened this issue Oct 31, 2023 · 1 comment · Fixed by #65
Labels
windows Issues related to Windows support

Comments

@Basile-Terv
Copy link

Make sure you can reproduce the issue with the latest version available

pip install milatools --upgrade
[milatools command e.g. mila code ...]

What command did you run?

mila init
Then i entered my username on the mila cluster as asked by the command prompt.
Then I answered to the question

+Host mila
+  HostName login.server.mila.quebec
+  User basile.terver
+  PreferredAuthentications publickey,keyboard-interactive
+  Port 2222
+  ServerAliveInterval 120
+  ServerAliveCountMax 5
+
+
+Host mila-cpu
+  User basile.terver
+  Port 2222
+  ForwardAgent yes
+  StrictHostKeyChecking no
+  LogLevel ERROR
+  UserKnownHostsFile /dev/null
+  RequestTTY force
+  ConnectTimeout 600
+  ServerAliveInterval 120
+  ProxyCommand ssh mila "/cvmfs/config.mila.quebec/scripts/milatools/slurm-proxy.sh mila-cpu --mem=8G"
+  RemoteCommand /cvmfs/config.mila.quebec/scripts/milatools/entrypoint.sh mila-cpu
+
+
+Host *.server.mila.quebec !*login.server.mila.quebec
+  HostName %h
+  User basile.terver
+  ProxyJump mila
+
?
Is this OK?

Then I answered yes to the question
? You have no public keys. Generate one?
Then I answered yes to the question
? Your public key does not appear be registered on the cluster. Register it? Yes
Then I got the error below.

Describe the bug

In the "mila init process" on my Windows PC, I get stucked at this point, although I upgrade the milatools package.

Traceback (most recent call last):
  File "C:\Users\terve\anaconda3\envs\mila\Lib\site-packages\milatools\cli\commands.py", line 43, in main
    auto_cli(milatools)
  File "C:\Users\terve\anaconda3\envs\mila\Lib\site-packages\coleo\cli.py", line 656, in auto_cli
    result = run_cli(entry, args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\terve\anaconda3\envs\mila\Lib\site-packages\coleo\cli.py", line 628, in run_cli
    return call(opts=opts, args=args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\terve\anaconda3\envs\mila\Lib\site-packages\coleo\cli.py", line 587, in thunk
    result = fn(*args)
             ^^^^^^^^^
  File "C:\Users\terve\anaconda3\envs\mila\Lib\site-packages\milatools\cli\commands.py", line 161, in init
    here.run("ssh-copy-id", "mila")
  File "C:\Users\terve\anaconda3\envs\mila\Lib\site-packages\milatools\cli\local.py", line 28, in run
    return subprocess.run(
           ^^^^^^^^^^^^^^^
  File "C:\Users\terve\anaconda3\envs\mila\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\terve\anaconda3\envs\mila\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\terve\anaconda3\envs\mila\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable

Screenshots

image (4) image (3) ![image (2)](https://github.com/mila-iqia/milatools/assets/146956184/70576fd4-74a5-4107-be86-3f9b37394750) ![image (1)](https://github.com/mila-iqia/milatools/assets/146956184/cf74d81f-f8c9-42d2-80b6-7d391b383d78) ![image](https://github.com/mila-iqia/milatools/assets/146956184/cd9b4ec8-0ba8-4ceb-bf04-35a7887311fc)

Desktop (please complete the following information):

  • OS: [Windows 11]

Additional context

I started following Victor Schmidt's guide (https://vsch.notion.site/YAMSS-5471da23464e41d4bad5e3517d273dea#0742904b6e384aba94b29a24b69e7b0e) on my WSL machine. But I decided to try milatools because I am on Windows, which is a problem if I want to open VS Code on a compute node following Victor's guide.

@ZHANG-GuiGui
Copy link

Hi, I have the same problem. I found one issue may be helpful. #19

lebrice added a commit to lebrice/milatools that referenced this issue Nov 2, 2023
lebrice added a commit to lebrice/milatools that referenced this issue Nov 6, 2023
@lebrice lebrice added the windows Issues related to Windows support label Nov 7, 2023
lebrice added a commit to lebrice/milatools that referenced this issue Nov 8, 2023
lebrice added a commit that referenced this issue Nov 11, 2023
* Dont add ControlMaster ssh entries on Windows

Signed-off-by: Fabrice Normandin <[email protected]>

* Remove the unused params of _add_ssh_entry

Signed-off-by: Fabrice Normandin <[email protected]>

* Rebase on Master

Signed-off-by: Fabrice Normandin <[email protected]>

* Fix isort issues

Signed-off-by: Fabrice Normandin <[email protected]>

* Fix the `mila init` command on windows

Fixes #63

Signed-off-by: Fabrice Normandin <[email protected]>

* Fix black formatting errors

Signed-off-by: Fabrice Normandin <[email protected]>

* Fix the equivalent of ssh-copy-id, now works!

Signed-off-by: Fabrice Normandin <[email protected]>

* Attempt to fix running `mila code` from WSL

Signed-off-by: Fabrice <[email protected]>

* Fix whitespace errors and run `code` directly

Signed-off-by: Fabrice Normandin <[email protected]>

* Set the remote.SSH settings in User Settings Json

Signed-off-by: Fabrice Normandin <[email protected]>

* Show that VsCode settings are found

Signed-off-by: Fabrice Normandin <[email protected]>

* Remove the VsCode settings thing for now

Signed-off-by: Fabrice Normandin <[email protected]>

* Use `here.run` to run the command

Signed-off-by: Fabrice <[email protected]>

* Skip the hostname checking on Windows machines

Signed-off-by: Fabrice <[email protected]>

* Fix black formatting issue

Signed-off-by: Fabrice Normandin <[email protected]>

* Fix missing condition in WSL check

Signed-off-by: Fabrice Normandin <[email protected]>

* Warn WSL users if `mila init` not done on Windows

Signed-off-by: Fabrice Normandin <[email protected]>

* Also setup Windows SSH config from WSL

Signed-off-by: Fabrice Normandin <[email protected]>

* Fix isort issues

Signed-off-by: Fabrice Normandin <[email protected]>

* Reuse existing fn to setup windows SSH file

Signed-off-by: Fabrice Normandin <[email protected]>

* Preserve ordering of SSH entries when copying

Signed-off-by: Fabrice Normandin <[email protected]>

* Copy both public and private key files

Signed-off-by: Fabrice Normandin <[email protected]>

* Add tests for the Windows SSH setup from WSL

Signed-off-by: Fabrice Normandin <[email protected]>

* Remove need for pytest-mock dependency

Signed-off-by: Fabrice Normandin <[email protected]>

* Fix a bug in the added tests

Signed-off-by: Fabrice Normandin <[email protected]>

* Remove accidentally-added .pre-commit-config.yaml

Signed-off-by: Fabrice Normandin <[email protected]>

---------

Signed-off-by: Fabrice Normandin <[email protected]>
Signed-off-by: Fabrice <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Issues related to Windows support
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants