zed
zed copied to clipboard
editor fails to pick python .venv correctly or accept the path when entered.
Summary
editor fails to pick python .venv correctly or accept the path when entered.
Description
Steps to reproduce:
- have a python project one folder level down in a project eg /main_project_folder/python_project 2.venv stored in /main_project_folder/python_project/.venv (venv is failed to be picked up automatically.
- Then click on venv folder in footer of editor and pasting in the full path location . zed returns 'No matches'
- venv isn't picked up... imports all broken
Expected Behavior: venv picked up automatically and or can be set manually with full path Actual Behavior: both fail.
specifying it in settings.json also doesn't help. and specifying the venv in a pyproject.toml also doesn't help (or trying only one of these options).
setting extract
"languages": {
"Python": {
"show_edit_predictions": false,
"language_servers": ["pyright", "ruff"],
"project_root": "agent",
"format_on_save": "on",
"python_path": "/Users/yunti/Dev/traffease_man/agent/.venv/bin/python",
"formatter": [
{
"language_server": {
"name": "ruff"
}
},
{
"code_actions": {
"source.organizeImports.ruff": true,
"source.fixAll.ruff": true
Zed Version and System Specs
Zed: v0.185.10 (Zed) OS: macOS 15.3.2 Memory: 16 GiB Architecture: aarch64
Thanks for reporting. Seems to be a duplicate of #27331.
Also note that neither "project_root" nor "python_path" are valid keys in language specific settings, we should show an error message for this but unfortunately our language settings validation isn't great right now.
@probably-neb I'm not sure it's a duplicated issue. Things were working well since a recent update (less than one week ago).
Now, the editor cannot find non native python package.
@probably-neb I'm not sure it's a duplicated issue. Things were working well since a recent update (less than one week ago).
Now, the editor cannot find non native python package.
Yes it was working better before. A pyproject.toml seemed to help but without this the venv wasn't picked up, but now it's doesn't work at all (as of the last week or two).
Understood, reopening
Understood, reopening
Thanks should I reword the title to make it clearer and distinct from the other issue?
Zed updated to 0.185.12 today and all imports from installed packages in a virtualenv stopped working.
The virtualenv name is recognised and shown at the bottom right though. I'm not sure if this is the same bug?
My complete settings:
{
"ui_font_size": 20,
"buffer_font_size": 23.0,
"theme": {
"mode": "system",
"light": "Zed Legacy: Atelier Sulphurpool Dark",
"dark": "One Dark"
},
"languages": {
"Python": {
"language_servers": ["!pylsp", "pyright"]
}
}
}
Zed 0.185.12 Ubuntu 24.10
Zed updated to 0.185.12 today and all imports from installed packages in a virtualenv stopped working.
The virtualenv name is recognised and shown at the bottom right though. I'm not sure if this is the same bug?
My complete settings:
{ "ui_font_size": 20, "buffer_font_size": 23.0, "theme": { "mode": "system", "light": "Zed Legacy: Atelier Sulphurpool Dark", "dark": "One Dark" }, "languages": { "Python": { "language_servers": ["!pylsp", "pyright"] } } }Zed 0.185.12 Ubuntu 24.10
@afandian thanks! actually when using the downloaded pylsp from Zed, the completion/suggestion from lsp looks extremely slow. After applying you configuration, Lsp completion works like a charm. IMHO, I think with the default lsp setup, there are some race conditions happened between Zed edit suggestion versus lsp completion on key stroke. Thank you once again.
@greatMonster11 I think this is entirely separate to this specific issue but glad it was useful! The workaround is from here: https://github.com/zed-industries/zed/issues/21076#issuecomment-2508893051
This is really a terrible issue. I wish it will be fixed as soon as possible, or otherwise I could only downgrade Zed version :(
This is really a terrible issue. I wish it will be fixed as soon as possible, or otherwise I could only downgrade Zed version :(
Have you tried adding this to pyproject.toml?
[tool.pyright]
venvPath = "."
venv = ".venv"
I think this can be reproduced without the nested project structure:
- Clone this repo: https://github.com/volfpeter/fasthx
- Run
poetry install(make sure you have the venv in project folder setting set in some way) - Open the repo in Zed -> virtual env and installed libs are both correctly recognized
- Open
pyproject.toml - Remove the
[tool.pyright]section from the config and save the file -> virtual env is still seemingly recognized, but installed libs are not
Here's my settings file:
{
"edit_predictions": {
"mode": "eager",
"copilot": {
"proxy": null,
"proxy_no_verify": null
},
"enabled_in_text_threads": false
},
"buffer_font_size": 13,
"ui_font_size": 16,
"unnecessary_code_fade": 0.8,
"features": {
"edit_prediction_provider": "zed"
},
"agent": {
"default_model": {
"provider": "google",
"model": "gemini-2.0-flash"
},
"version": "2"
},
"languages": {
"Python": {
"format_on_save": "on",
"formatter": [
{
"code_actions": {
"source.organizeImports.ruff": true,
"source.fixAll.ruff": true
}
},
{
"language_server": {
"name": "ruff"
}
}
]
}
},
"project_panel": {
"auto_reveal_entries": false
},
"tabs": {
"git_status": true
},
"telemetry": {
"metrics": true
},
"theme": {
"mode": "system",
"light": "One Light",
"dark": "Github Dark"
}
}
This is really a terrible issue. I wish it will be fixed as soon as possible, or otherwise I could only downgrade Zed version :(
Have you tried adding this to
pyproject.toml?[tool.pyright] venvPath = "." venv = ".venv"
This fixes the linter errors but the original bug still remains that Zed doesn't recognize the virtual environments that start with a period. i.e. .venv when using uv.
This is really a terrible issue. I wish it will be fixed as soon as possible, or otherwise I could only downgrade Zed version :(
Have you tried adding this to
pyproject.toml?[tool.pyright] venvPath = "." venv = ".venv"
Nope. But I don't know why zed picks up .venv environment correctly all of a sudden. Both pylsp and pyright works fine on v0.186.6-pre.
Still facing the issue. Tried all workarounds. no luck. - Zed 0.188.5
I am about to re-land the changes that were reverted at the end of April in https://github.com/zed-industries/zed/pull/31893; this means that soon the venv situation should be a bit better.
I use the ruff in my venv, and while pyright and testing seem to be fixed, ruff is still broken. Not sure if this is related but pyright also doesn't pick up the settings in pyproject.toml at the root of the repo, and I don't know how to point it at it explicitly.
@bkgthumanity Are you still seeing this?
@bkgthumanity Are you still seeing this?
Nope all fixed now thanks.