-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import resolution not respecting virtual environments #5943
Comments
@rchiodo, I'm guessing this is related to your real path changes. Could you investigate? |
Sure let me try to reproduce the problem. It sounds like it should reproduce with a pip venv too. |
Yeah, I can reproduce. I think it has something to do with translating paths on the command line. If you put the 'venvFolder' into the pyrightconfig.json, I believe that will fix the problem temporarily. At least if I have this in pyrightconfig.json, I can't reproduce: {
"venv": ".venv",
"venvPath": "."
} But with this: {
"venv": ".venv",
} and passing |
Oh whoops, I shouldn't put 'Fixed' in the titles of the PRs. |
I am seeing this also on 1.1.327 as well (upgraded from 1.1.325) -- doesn't matter if i specify |
Seems like it has to do something with symlinks ?
|
Yes, this is related to symlinks. There is already a fix in place, and it will be included in next week's pyright release. In the meantime, you can work around the issue by downgrading to 1.1.326. Apologies for the regression. |
Thank you for the tool and the work. |
This is addressed in pyright 1.1.328, which I just published. It will also be included in a future release of pylance. |
@mattiacolombomc, this issue has been fixed and closed. If you're experiencing a similar issue, then it's different than the original. If you think that you are seeing a bug, please file a new issue with repro steps as described in the bug template. |
Describe the bug
When updating from
1.1.321
to1.1.327
, I am receivingreportMissingImports
in all of my projects. I use poetry to manage python dependencies & virtual environment for both local deployment and pipeline execution.When running pyright, I run
npm exec --no -- pyright --venvpath ./
withvenv = ".venv"
set in mypyproject.toml
. I typically (especially in pipeline executions) do not activate the virtual environment prior to running pyright.For all versions prior to
1.1.327
, this worked fine. However, after updating pyright raisesreportMissingImports
for all dependencies that exist only in my virtual environment (e.g.pytest
for my tests).If I activate my python virtual environment prior to running pyright, it is able to resolve the imports correctly.
All repos I am seeing this in are private or I would provide a link to an example.
VS Code extension or command-line
Identified via command line.
The text was updated successfully, but these errors were encountered: