Skip to content

Issue specifying python_interpreter #2

@jegork

Description

@jegork

Currently, I have an issue specifying python_interpreter to use pyrefly in my venv
My project is managed by poetry.

If I have the following zed config

  "lsp": {
    "pyrefly": {
      "binary": {
        "path": ".venv/bin/pyrefly",
        "arguments": ["lsp"],
        "env": {
          "PYREFLY_PYTHON_INTERPRETER": ".venv/bin/python"
        }
      },
      "settings": {
        "python": {
          "pythonPath": ".venv/bin/python"
        },
        "pyrefly": {
          "python_interpreter": ".venv/bin/python"
        }
      }
    }

I get the following error highlighted on my imports

Could not find import of `sqlalchemy.ext.asyncio`, looked in these locations (from config in `/Users/jegorkitskerkin/Documents/projects/cynthai-backend/pyproject.toml`):
Import root (inferred from project layout): "/Users/jegorkitskerkin/Documents/projects/cynthai-backend"
Site package path (queried from interpreter at `/Users/jegorkitskerkin/.local/bin/python3`): ["/Users/jegorkitskerkin/.local/share/uv/python/cpython-3.13.3-macos-aarch64-none/lib/python3.13", "/Users/jegorkitskerkin/.local/share/uv/python/cpython-3.13.3-macos-aarch64-none/lib/python3.13/lib-dynload", "/Users/jegorkitskerkin/.local/share/uv/python/cpython-3.13.3-macos-aarch64-none/lib/python3.13/site-packages"] (Pyrefly import-error)

You can see that even though python_interpreter and the env variable are set, it still queries the system wide python interpreter.

However, the issue is fixed if I specify in my pyproject.toml

[tool.pyrefly]
python_interpreter = ".venv/bin/python"

could it be linked to?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions