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

mila code /full/path/to/remote/code does not work properly when launched from WSL Ubuntu on Windows 11 #37

Closed
josephdviviano opened this issue Mar 22, 2023 · 5 comments · Fixed by #65

Comments

@josephdviviano
Copy link

josephdviviano commented Mar 22, 2023

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

Steps to reproduce:

# Install wsl on win11
# run all commands from linux terminal:
pip install milatools --upgrade
mila init  # puts publickey on cluster
mila code /full/path/to/remote/codebase

> (default) jdv@lyndon:/home
> $ mila code /home/mila/v/vivianoj/code/gfneco
> (->) $ salloc
> salloc: --------------------------------------------------------------------------------------------------
> salloc: # Using default long-cpu partition (CPU-only)
> salloc: --------------------------------------------------------------------------------------------------
> salloc: Granted job allocation 2991990
> salloc: Waiting for resource configuration
> salloc: Nodes cn-f003 are ready for job
> (local) $ '/mnt/c/Users/Joseph Viviano/AppData/Local/Programs/Microsoft VS Code/bin/code' -nw --remote ssh-remote+cn-f003.server.mila.quebec /home/mila/v/vivianoj/code/gfneco

Describe the bug

At this point, vscode will successfully launch, but the instance will be in a strange state:

Screenshot 2023-03-22 134246

A few things are notable here. The terminal instance is local. The folder is also local, and pointing to a folder which does not exist. vscode is successfully tunnelled into WSL:Ubuntu (bottom left corner). I am not sure whether a fix is to launch mila code from the windows side, will try that next.

Desktop (please complete the following information):

  • OS: Windows 11 w/ WSL Ubuntu
(default) jdv@lyndon:/home
$ uname -a
Linux lyndon 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Thank you :)

@josephdviviano
Copy link
Author

josephdviviano commented Mar 22, 2023

I've found a solution, thanks to this issue #19

  • In windows terminal (cmd, NOT wsl), generate a rsa key in cmd, and place your public key on the mila cluster. You can also do this for wsl separately, but you won't be using this for the mila code command.
  • If required, install python using the Microsoft Store (likely other methods work, just haven't tried).
  • Run pip install milatools in cmd to install it on the windows side.
  • Add the location of milatools and vscode to your Windows Path following this guide.
  • For reference, the paths I needed to add were:
    • C:\Users\Joseph Viviano\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0
    • C:\Users\Joseph Viviano\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts
    • C:\Users\Joseph Viviano\AppData\Local\Programs\Microsoft VS Code\bin.
  • Save all entries, and restart your windows terminal (completely close and relaunch, do not try to open a new cmd tab!!!).
  • Now, mila code will work in cmd, but it will not be able to launch code (I don't understand why). To resolve this, you must run mila code path/to/remote/folder from an Administrator instance of cmd.

So when all is said and done, you simply launch cmd as an admin, then run mila code <path>, and you can run your remote vscode instance on the mila cluster from Windows 11.

@lebrice
Copy link
Collaborator

lebrice commented Apr 5, 2023

Hey @josephdviviano , did you try running mila init inside the WSL shell, to setup your ssh config?

@josephdviviano
Copy link
Author

josephdviviano commented Apr 5, 2023

Yes -- this does not work, it produces the behaviour in the first post. I've now successfully performed the second post on two different Windows machines successfully.

@chrisemezue
Copy link

chrisemezue commented Jun 12, 2023

I've found a solution, thanks to this issue #19

  • In windows terminal (cmd, NOT wsl), generate a rsa key in cmd, and place your public key on the mila cluster. You can also do this for wsl separately, but you won't be using this for the mila code command.

  • If required, install python using the Microsoft Store (likely other methods work, just haven't tried).

  • Run pip install milatools in cmd to install it on the windows side.

  • Add the location of milatools and vscode to your Windows Path following this guide.

  • For reference, the paths I needed to add were:

    • C:\Users\Joseph Viviano\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0
    • C:\Users\Joseph Viviano\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts
    • C:\Users\Joseph Viviano\AppData\Local\Programs\Microsoft VS Code\bin.
  • Save all entries, and restart your windows terminal (completely close and relaunch, do not try to open a new cmd tab!!!).

  • Now, mila code will work in cmd, but it will not be able to launch code (I don't understand why). To resolve this, you must run mila code path/to/remote/folder from an Administrator instance of cmd.

So when all is said and done, you simply launch cmd as an admin, then run mila code <path>, and you can run your remote vscode instance on the mila cluster from Windows 11.

@josephdviviano thanks for this. Have you been able to find a workaround to make this work with WSL? Your setup is based on CMD, and I have set up everything on WSL already.

@josephdviviano
Copy link
Author

I doubt it will ever work on WSL - it's a win11 limitation I think - It's worth reproducing the effort on the cmd side.

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

Successfully merging a pull request may close this issue.

3 participants