WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Problem running ty server for project in WSL #2663

@klonuo

Description

@klonuo

Hi,

This is my LSP setting:

{
    "clients": {
        "ty": {
            "enabled": true,
            "command": ["ty", "server"],
            "selector": "source.python"
        }
    }
}

If I open WSL project ty server crushes.

From the LSP log:

# --> ty initialize (1):
{
    "processId": 10276,
    "clientInfo": {"name": "Sublime Text LSP", "version": "2.6.0"},
    "rootUri": "file://wsl.localhost/Ubuntu-20.04/home/klo/projects/api",
    "rootPath": "\\\\wsl.localhost\\Ubuntu-20.04\\home\\klo\\projects\\api",
    "workspaceFolders": [
        {
            "name": "api",
            "uri": "file://wsl.localhost/Ubuntu-20.04/home/klo/projects/api",
        }
    ],
    # ...
}

then:

# <<< ty (1) (duration: 461ms):
{
    "capabilities": {
        "completionProvider": {"triggerCharacters": ["."]},
        "declarationProvider": True,
        "definitionProvider": True,
        "documentHighlightProvider": True,
        "documentSymbolProvider": True,
        "executeCommandProvider": {
            "commands": ["ty.printDebugInformation"],
            "workDoneProgress": False,
        },
        "hoverProvider": True,
        "inlayHintProvider": {},
        "positionEncoding": "utf-16",
        "referencesProvider": True,
        "selectionRangeProvider": True,
        "semanticTokensProvider": {
            "full": True,
            "legend": {
                "tokenModifiers": ["definition", "readonly", "async"],
                "tokenTypes": [
                    "namespace",
                    "class",
                    "parameter",
                    "selfParameter",
                    "clsParameter",
                    "variable",
                    "property",
                    "function",
                    "method",
                    "keyword",
                    "string",
                    "number",
                    "decorator",
                    "builtinConstant",
                    "typeParameter",
                ],
            },
            "range": True,
        },
        "signatureHelpProvider": {
            "retriggerCharacters": [")"],
            "triggerCharacters": ["(", ","],
        },
        "typeDefinitionProvider": True,
        "workspaceSymbolProvider": True,
        "textDocumentSync": {"change": {"syncKind": 2}, "didOpen": {}, "didClose": {}},
    },
    "serverInfo": {"name": "ty", "version": "0.0.1-alpha.22"},
}

which results in:

ty: ty failed
ty: Cause: Failed to start server
ty: Cause: Workspace URL is not a file or directory:

Url {
    scheme: "file",
    cannot_be_a_base: false,
    username: "",
    password: None,
    host: Some(Domain("wsl.localhost")),
    port: None,
    path: "/Ubuntu-20.04/home/klo/projects/api",
    query: None,
    fragment: None,
}

And right after that it reports:

 -> ty initialized: {}
 -> ty workspace/didChangeConfiguration: {}
 -> ty textDocument/didOpen: {'textDocument': {'uri': 'file://wsl.localhost/Ubuntu-20.04/...

and finally:

ty: 2025-10-15 17:07:11.489449800 ERROR Failed to create project for `\\wsl.localhost\Ubuntu-20.04\home\klo\projects\api`: Failed to discover the site-packages directory: Invalid local virtual environment `\\?\UNC\wsl.localhost\Ubuntu-20.04\home\klo\projects\api\.venv`: Could not find a `site-packages` directory for this Python installation/executable. Falling back to default settings
:: [17:07:11.489] <-  ty window/showMessage: {'message': 'Failed to load project rooted at \\\\wsl.localhost\\Ubuntu-20.04\\home\\klo\\projects\\api. Please refer to the logs for more details.', 'type': 1}
ty: 2025-10-15 17:07:11.490223200  INFO Defaulting to python-platform `win32`
ty: 2025-10-15 17:07:11.585543400 ERROR panicked at crates\ty_server\src\session.rs:546:30:
ty: Default configuration to be valid: Failed to discover the site-packages directory
ty: 
ty: Caused by:
ty:     Invalid local virtual environment `\\?\UNC\wsl.localhost\Ubuntu-20.04\home\klo\projects\api\.venv`: Could not find a `site-packages` directory for this Python installation/executable

I reported first in astral's repo thinking the issue is from the server: astral-sh/ty#1362

I even tried to run ty from within WSL as reported in above issue, w/o success:

"settings": {
  "LSP": {
    "ty": {
      "enabled": true,
      "command":["wsl", "--shell-type", "login", "--",  "ty", "server"],
      "selector": "source.python"
    }
  }
}

However if I open the same WSL project in Zed, ty server works correctly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions