-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Resolve local package installed with pip install -e . #1473
Comments
See also: microsoft/pylance-release#78 I haven't looked into this, but I think this is because we remove paths that point into the workspace but are outside the interpreter prefix (which is usually editable installs pointing into the works). |
Thanks for pointing out related issue. I saw a temporary solution by adding an extra path in |
Can you provide specific repro steps? I'm looking for a specific example of a package that doesn't work when it is installed using editable install. |
Here is package repo https://github.com/qubvel/segmentation_models.pytorch .I cloned and |
I cloned this repo, installed it with How are you specifying your python environment? Are you using the environment selector within VS Code (the one provided by the Python extension)? Or are you using a "pyrightconfig.json" file and specifying a "venv" setting? |
I 'm using |
If you use the "venv" setting in pyrightconfig, pyright uses its own internal logic to find the Arguably, the internal logic used in the "venv" case should be enhanced to know about ".pth" files, but if you're happy with the workaround, I'm fine closing this issue. |
Actually in some case, I need to use |
To be clear, you can still use pyrightconfig.json and specify different executionEnvironment roots. You just can't specify the "venv" setting. |
After searching for some issues, activate conda env and open neovim in terminal, pyright can use activated python env. It satisfies my need now. |
Sorry to revive this old issue but being very new to (TL;DR: Python sees
Maybe I am missing some nuance? |
This is an old issue, and the original problem was fixed long ago. The problem you're now experiencing is a new problem introduced in PEP 660 and recent releases of setuptools. These changes made editable installs incompatible with all static analysis tools. The static typing community warned the authors of PEP 660 and setuptools that this would happen, but they unfortunately decided to go ahead with the change anyway. Now the broader Python community is experiencing this pain. For more details and workarounds, refer to this documentation. |
That's unfortunate. Thanks for the link, much appreciated! |
For posterity, what ended up working was to add a
And I could also make it work by adding the following to my
(Note how relative paths work for I wish there were a way to define a user wide |
I cloned a python package repository. If I use command
pip install -e .
to install package in development mode, pyright can't resolve it. But withpip install .
, pyright resolve that package normally. Is this a bug or needing an enhancement?The text was updated successfully, but these errors were encountered: