zed icon indicating copy to clipboard operation
zed copied to clipboard

pyflake uses system python instead of selected python

Open SIGSTACKFAULT opened this issue 11 months ago • 2 comments

Check for existing issues

  • [x] Completed

Describe the bug / provide steps to reproduce it

Python 3.12 improved f-string parsing, but Zed doesn't appear to support it.

I hypothesize this is because pyflake is using the system python version (3.9) instead of the one selected in the statusbar (3.13 homebrew).

Also, there is no (documented) way to disable pyflake.

Zed Version and System Specs

Zed: v0.168.3 (Zed) OS: macOS 14.6.0 Memory: 16 GiB Architecture: aarch64

If applicable, add screenshots or screencasts of the incorrect state / behavior

Image

If applicable, attach your Zed.log file to this issue.

Zed.log
2025-01-15T10:57:46.465558-05:00 [INFO] ========== starting zed ==========
2025-01-15T10:57:46.520928-05:00 [INFO] Opening main db
2025-01-15T10:57:46.522229-05:00 [INFO] Opening main db
2025-01-15T10:57:46.536736-05:00 [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2025-01-15T10:57:46.672595-05:00 [INFO] set environment variables from shell:/opt/homebrew/bin/fish, path:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/cking/.cargo/bin:/Users/cking/.local/bin/:/Users/cking/.cargo/bin/:/opt/homebrew/bin:/Users/cking/.local/bin/:/Users/cking/.cargo/bin/:/opt/homebrew/bin
2025-01-15T10:57:46.707117-05:00 [INFO] No prompt template overrides directory found at /Users/cking/.config/zed/prompt_overrides. Using built-in prompts.
2025-01-15T10:57:46.707437-05:00 [INFO] No prompt template overrides directory found at /Users/cking/.config/zed/prompt_overrides. Using built-in prompts.
2025-01-15T10:57:46.707901-05:00 [INFO] extensions updated. loading 4, reloading 0, unloading 0
2025-01-15T10:57:46.743587-05:00 [INFO] Opening main db
2025-01-15T10:57:46.787221-05:00 [INFO] Opening main db
2025-01-15T10:57:46.810173-05:00 [ERROR] No path or contents found for buffer
2025-01-15T10:57:46.810641-05:00 [INFO] Opening main db
2025-01-15T10:57:46.81241-05:00 [INFO] open paths ["/Users/cking/.config/zed/settings.json"]
2025-01-15T10:57:46.831206-05:00 [INFO] attempting to start language server "json-language-server", path: "/Users/cking/.config/zed/settings.json", id: 1
2025-01-15T10:57:46.831378-05:00 [INFO] Initializing default prettier with plugins {}
2025-01-15T10:57:46.831537-05:00 [INFO] Initializing default prettier with plugins {}
2025-01-15T10:57:46.832048-05:00 [INFO] fetching latest version of language server "json-language-server"
2025-01-15T10:57:46.835989-05:00 [INFO] Initializing default prettier with plugins {}
2025-01-15T10:57:46.963954-05:00 [INFO] using project environment variables shell launched in "/Users/cking/test". PATH="/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/cking/.cargo/bin:/Users/cking/.local/bin/:/Users/cking/.cargo/bin/:/opt/homebrew/bin:/Users/cking/.local/bin/:/Users/cking/.cargo/bin/:/opt/homebrew/bin"
2025-01-15T10:57:46.968537-05:00 [INFO] using project environment variables shell launched in "/Users/cking/.config/zed/settings.json". PATH="/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/cking/.cargo/bin:/Users/cking/.local/bin/:/Users/cking/.cargo/bin/:/opt/homebrew/bin:/Users/cking/.local/bin/:/Users/cking/.cargo/bin/:/opt/homebrew/bin"
2025-01-15T10:57:47.074387-05:00 [INFO] starting language server process. binary path: "/opt/homebrew/bin/node", working directory: "/", args: ["/Users/cking/Library/Application Support/Zed/copilot/copilot-v0.7.0/dist/language-server.js", "--stdio"]
2025-01-15T10:57:47.143851-05:00 [INFO] Initializing default prettier with plugins {}
2025-01-15T10:57:47.49859-05:00 [INFO] Language server with id 0 sent unhandled notification window/logMessage:
{
  "type": 3,
  "message": "[lsp] GitHub Copilot Language Server 1.236.0 initialized"
}
2025-01-15T10:57:47.498749-05:00 [INFO] Language server with id 0 sent unhandled notification workspace/configuration:
{
  "items": [
    {
      "section": "github.copilot"
    },
    {
      "section": "github-enterprise"
    },
    {
      "section": "http"
    },
    {
      "section": "telemetry"
    }
  ]
}
2025-01-15T10:57:47.540861-05:00 [INFO] language server "json-language-server" is already installed
2025-01-15T10:57:47.541075-05:00 [INFO] starting language server process. binary path: "/opt/homebrew/bin/node", working directory: "/Users/cking/.config/zed", args: ["/Users/cking/Library/Application Support/Zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
2025-01-15T10:57:52.582905-05:00 [INFO] attempting to start language server "pyright", path: "/Users/cking/test", id: 2
2025-01-15T10:57:52.583045-05:00 [INFO] attempting to start language server "pylsp", path: "/Users/cking/test", id: 3
2025-01-15T10:57:52.583143-05:00 [INFO] attempting to start language server "basedpyright", path: "/Users/cking/test", id: 4
2025-01-15T10:57:52.583246-05:00 [INFO] attempting to start language server "ruff", path: "/Users/cking/test", id: 5
2025-01-15T10:57:52.583474-05:00 [INFO] Initializing default prettier with plugins {}
2025-01-15T10:57:52.584041-05:00 [INFO] fetching latest version of language server "pylsp"
2025-01-15T10:57:52.584136-05:00 [INFO] downloading language server "pylsp"
2025-01-15T10:57:52.589897-05:00 [ERROR] Failed to start language server "basedpyright": basedpyright must be installed and available in $PATH.
2025-01-15T10:57:52.590007-05:00 [ERROR] server stderr: ""
2025-01-15T10:57:52.590118-05:00 [INFO] starting language server process. binary path: "/opt/homebrew/bin/ruff", working directory: "/Users/cking/test", args: ["server"]
2025-01-15T10:57:52.663217-05:00 [INFO] fetching latest version of language server "pyright"
2025-01-15T10:57:53.243023-05:00 [INFO] language server "pyright" is already installed
2025-01-15T10:57:53.243154-05:00 [INFO] starting language server process. binary path: "/opt/homebrew/bin/node", working directory: "/Users/cking/test", args: ["/Users/cking/Library/Application Support/Zed/languages/pyright/node_modules/pyright/langserver.index.js", "--stdio"]
2025-01-15T10:57:53.443314-05:00 [INFO] language server 2: unregistered workspace/DidChangeWatchedFiles capability with id d73452e0-4727-48fb-abac-932579e6344b
2025-01-15T10:57:53.829439-05:00 [INFO] starting language server process. binary path: "/Users/cking/Library/Application Support/Zed/languages/pylsp/pylsp-venv/bin/pylsp", working directory: "/Users/cking/test", args: []

SIGSTACKFAULT avatar Jan 15 '25 15:01 SIGSTACKFAULT

I think you can workaround this by blowing away the pylsp venv and letting zed repopulate it (worked for me) - my was stored in ~/Library/Application\ Support/Zed/languages/pylsp

likely related: #22568

kaytwo avatar Jan 24 '25 20:01 kaytwo

Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!

github-actions[bot] avatar May 28 '25 07:05 github-actions[bot]

This issue was closed due to inactivity. If you're still experiencing this problem, please open a new issue with a link to this issue.

github-actions[bot] avatar Jun 04 '25 07:06 github-actions[bot]