mila-iqia / milatools

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

Bug with mila init ssh path in WSL #109

Open MyriamLizotte opened 6 months ago

MyriamLizotte commented 6 months ago

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

Describe the bug

For windows, with some accounts, the $env:UserName used to create the path to the home directory does not match the actual home directory. See this. The current code here creates the home path as "/mnt/c/Users/Myriam" when it should be "/mnt/c/Users/Myria". To fix this, I just did a hack of:

def get_windows_home_path_in_wsl() -> Path:
    assert running_inside_WSL()
    windows_username = subprocess.getoutput("powershell.exe '$env:HomePath'").strip()
    windows_username = windows_username.replace('\\', '/')
    return Path(f"/mnt/c/{windows_username}")

Also, a separate thing, I just set up WSL, and in order to get the command to work that changed the permission of the ssh folder, I had to follow the steps here.

Desktop (please complete the following information):

lebrice commented 6 months ago

Hi @MyriamLizotte, thanks for posting this. That's very helpful info. I'll take a look.