You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the last two releases the python lsp is not properly picking up packages in my venv.
Functionally, this manifests in errors like Error [15:6] Import "dotenv" could not be resolved showing up in certain tool calls. This was not a problem on earlier releases.
Just grabbed 0.5.6, as I saw that it had a fix for a bug around this (#1994), but the issue persists.
I am a new user of opencode, and I get the following error/warning:
Error [2:8] Import "typer" could not be resolved
and co. I am using version 0.15.7 and the virtual environment is .venv/. What am I missing? It seems like opencode fails to find/see the virtual environment.
I didn't change anything, but now it seems to be OK even without the config. I'm still getting a little confused here though... It seems like opencode fails to identify the right environment and I get the following error:
Shell Check the help output to confirm the --debug flag is added
$ cd /Users/foo/bar && python main.py --help
Traceback (most recent call last):
File "/Users/drorata/dev/humaintain/vimeo_manage/main.py", line 3, in <module>
import typer
ModuleNotFoundError: No module named 'typer'
Activity
[-]Python lsp not detecting packages in venv[/-][+]Python lsp not resolving packages in venv[/+]rekram1-node commentedon Aug 18, 2025
hmm I am gonna look into this and try to replicate
rekram1-node commentedon Aug 18, 2025
I am assuming this is default behavior right? this isn't due to a custom lsp config
are you using
uv?jscheel commentedon Aug 18, 2025
afaik I don't have any special lsp config. I am definitely using uv though.
rekram1-node commentedon Aug 18, 2025
cool, I will try to replicate
Edit: Managed to replicate
rekram1-node commentedon Aug 18, 2025
Ik the issue! @jscheel I will make a more elegant solution but for the time being if you set:
title="pyrightconfig.json"
{ "venvPath": ".", "venv": ".venv" }at the root of your project it should be fixed
rekram1-node commentedon Aug 18, 2025
I will get a patch out for this later tonight most likely, will be in one of the next releases
jscheel commentedon Aug 18, 2025
@rekram1-node just stepped away from my computer, but I'll give it a try shortly. Thank you!
rekram1-node commentedon Aug 18, 2025
if it doesnt just lmk the patch needs to be sophisticated anyway cause not everyone has it in .venv
jscheel commentedon Aug 19, 2025
@rekram1-node seems to fix it for me 👍 Thanks!
rekram1-node commentedon Aug 31, 2025
should be fixed in next release, I got busy and got to this much later than I wanted to
drorata commentedon Oct 18, 2025
I am a new user of opencode, and I get the following error/warning:
and co. I am using version 0.15.7 and the virtual environment is
.venv/. What am I missing? It seems likeopencodefails to find/see the virtual environment.rekram1-node commentedon Oct 18, 2025
@drorata does that config thing I mentioned above fix it?
If not you can disable the python lsp for now put the following in your opencode.json:
{
“pyright”: {
disabled: true
}}
pardon my horrible json im typing on phone haha so just make that valid json and itll work^^
drorata commentedon Oct 19, 2025
I tried to place either of the following in
opencode.json:{ "venvPath": ".", "venv": ".venv" }and
{ "pyright": { "disabled": true } }In both cases I got the following error:
rekram1-node commentedon Oct 19, 2025
@drorata in opencode.json:
The other reply was about pyrightconfig.json:
#2050 (comment)
drorata commentedon Oct 20, 2025
I'm sorry for the noise -
I didn't change anything, but now it seems to be OK even without the config. I'm still getting a little confused here though... It seems like
opencodefails to identify the right environment and I get the following error:It should have tried something like:
because I'm using
venv.rekram1-node commentedon Oct 20, 2025
hmm ill look into that