Skip to content

Pyright unable to find venv/pythonPath with WSL2 #136

@didimelli

Description

@didimelli

Hello,
I am using SublimeText 4, installed on windows, to open a WSL2 project.

All my venvs are in the proj root dir, in the folder .venv (this means that python is at .venv/bin/python).

My pyright settings are the following:

{
    "settings": {
        "python.venvPath": "./.venv",
        "python.pythonPath": "./.venv/bin/python",
    }
}

When I open the log panel, what I see is this:

LSP-pyright: Pyright language server 1.1.222 starting
LSP-pyright: Server root directory: C:\Users\davide.melli\AppData\Local\Sublime Text\Package Storage\LSP-pyright\14.17.6\language-server\node_modules\pyright/dist/
LSP-pyright: No configuration file found.
LSP-pyright: No pyproject.toml file found.
LSP-pyright: Setting pythonPath for service "leaf-radio": "\Ubuntu-20.04\home\didi\leaf\leaf-radio\.venv\bin\python"
LSP-pyright: venvPath \Ubuntu-20.04\home\didi\leaf\leaf-radio\.venv is not a valid directory.
LSP-pyright: stubPath \Ubuntu-20.04\home\didi\leaf\leaf-radio\typings is not a valid directory.
LSP-pyright: Unable to get Python version from interpreter
LSP-pyright: Assuming Python platform Windows
LSP-pyright: Searching for source files
LSP-pyright: File or directory "\Ubuntu-20.04\home\didi\leaf\leaf-radio" does not exist.
LSP-pyright: No source files found.

Is there any way to make Pyright aware of the WSL mount and resolve the paths correctly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions