-
Notifications
You must be signed in to change notification settings - Fork 767
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
Remote container default search paths #1527
Comments
can you provide the logs from "Python Language Server" output window with trace enabled? did you select the correct python interpreter or just using the default? |
Will do so, I didn't think it would provide much, as it seems very clear that the combination of remote container forcing pip install into the user-local location was just resulting in the pips being installed in a location not scanned by pylance by default, as I thought was confirmed by the workaround of adding it manually.
Given I'm using the remote containers plugin to build a container in which to run python for this, it selects the correct python interpreter by default. So yes, it is default, and it is also correct ;-) |
vscode ➜ /workspaces/es-logger (master ✗) $ pip install stevedore
Defaulting to user installation because normal site-packages is not writeable
Collecting stevedore
Downloading stevedore-3.3.0-py3-none-any.whl (49 kB)
|████████████████████████████████| 49 kB 594 kB/s
Collecting pbr!=2.1.0,>=2.0.0
Downloading pbr-5.6.0-py2.py3-none-any.whl (111 kB)
|████████████████████████████████| 111 kB 5.3 MB/s
Installing collected packages: pbr, stevedore
Successfully installed pbr-5.6.0 stevedore-3.3.0
vscode ➜ /workspaces/es-logger (master ✗) $
|
Pylance doesn't support You shouldn't need to put site-packages into extraPaths; are you activating the interpreter that those paths are tied to? |
Hmmm, I'll take another look.
This is all done automatically by the reopening in a container. Prior to the switch to Pylance this just worked, which is very frustrating. I'll take a look, I wonder is it just a delay in Pylance re-scanning. |
I'd check the bottom left to see which interpreter is being used. This should have affected any analysis, as they all rely on knowing the interpreter to then get paths. |
Yes, I am looking at that. The point about using a remote container, is that the container is built with a default python, and then that is supposed to be used for these dev tasks. This is indeed happening, the terminal and the language server all appear to be executing using the default python in the container. The problem is that the language server is not reacting when packages are installed. Having removed the additional search path, and then retesting by reloading the window after a pip install of a missing module, I can confirm it is simply that pylance is never refreshing state when new pip packages are installed. |
Ah, that is a known bug, yes. See #923. Note that there's a "restart language server" command you can use in the meantime to restart without fully reloading the editor. |
Great, thanks for the fast attention. I guess adding the extra path must have made the language server restart and given the appearance of working. I’ll make sure to add the pip install into the container builds to avoid in future. Thanks again! |
Environment data
Expected behaviour
When installing requirements into the python environment in the remote container, the default search path for Pylance will pick it up and use it for source analysis.
Actual behaviour
Imports were not found even after pip install had run.
Logs
Code Snippet / Additional information
Adding this to the settings resolved the issue. It would be good to see this as default behaviour, or at least offer it as a possibility in the quick fix text
The text was updated successfully, but these errors were encountered: