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
{{ message }}
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
Unresolved import for builtin packages after reload #1156
Same problem with python 3.6. I do not really think that this problem is related to python version though I did not test all versions. I noticed this problem after using
"python.autoComplete.extraPaths": [ "${workspaceFolder}/src" ],
and using autosave with autopep8 few times (seem like some pep8 formating must occure but not sure). Simple folder structure:
root/
\_env
\_src
\_.vscode
Before the problem occurs all autocomplete functions works well. After the problem sys, time and other builtin packages are unrecognized.
Edit:
Seem to happen always just after python log [Info - 7:16:23 PM] Reloading modules... which seem to happen always if autopep8 makes some changes to files.]
Edit2:
I tried to disable autopep8 and instead tried to use this macro:
using runInTerminal and macros which seem to work fine and sys does not throw unresolved import . Also language server was not reloaded which seem to be related. In trace log from language server first run analyses shows Analysis of sys(CompiledBuiltin) queued but when reload occurs no builtin are analyzed even though other packages seem to be analyzed again.
Interesting. The reloading is due to our file watcher detecting changes on disk to reload files (for package installation and so on, see also #1076 for the issue on improving that mechanism).
It might be the case that when we go reload modules, some builtins are getting lost.
johnybx Also, we'd appreciate it if you could try the daily build, which includes a few race fixes among other things that we think could have fixed the missing builtins issues:
I have the same issue with builtin 'sys' and 'time', and I tried the daily build. It did not help. Python version is 3.7.3. So it's not limited to 2.7.
Now that I've fixed the path watcher to watch the correct things, I've observed this happening for some libraries, in my case array and itertools. When the reload happens, it seems like some modules are getting lost. Needs testing.
Changes are not in stable feed yet. "python.analysis.downloadChannel": "daily" is 0.3.59. We do not push builds with large changes into stable immediately, so when an issue is closed, it does not mean the fix shows up in stable next day.
There isn't any clarification from the PR/merge process as to which version of Python Language Server PR#1446 is getting merged into, so people using the stable build don't know which version to keep an eye out for.
Is it possible to do more with the Releases feature in GitHub in that respect? Presumably a build takes a specific point in time in the git history and therefore that could be tagged with the version assigned by the build?
At the moment, the version numbers aren't "true" semver; the last number is actually just a build number we trigger manually (versions may skip or repeat commits). Improving this is something that'd be good once we're more stable.
Jake Bailey (@jakebailey) i am experiencing this with RemoteSSH connection. The above line doesn't appear to work (the line in the config is dimmed, as if the option does not exist), so i can't test with the beta/daily version. I am using VSCode Insiders build. How do i get the latest Python extension?
The option is not documented, which is why VS Code does not think it exists. If you set beta and reload, the extension should download an updated copy. Beta is currently 0.3.72.
The language server and the extension are versioned separately; you don't need to get the latest extension in order to get the latest language server.
Alexander Sher (@AlexanderSher) I'm still seeing this issue with 'itertools' import under centos, is it a known problem?
Sys info:
OS: CentOS Linux release 7.7.1908
Code: 1.39.2
Python: 2.7.16 (also on 2.7.5)
Python-language-server: 0.4.71.0
Unless this occurs only after a reload (package install), then it's likely not related to this old issue. I'd appreciate it if you could file a new issue with your info.
Activity
thernstig commentedon Jun 5, 2019
This happens to our project as well, e.g. for the
sysmodule, but other modules work just fine. Example of our imports:I am using the language server (i.e this is our setting
"python.jediEnabled": false,).As it is quite a basic functionality to be able to get IntelliSense for builtin packages it hampers development speed by quite a bit.
johnybx commentedon Jun 9, 2019
Same problem with python 3.6. I do not really think that this problem is related to python version though I did not test all versions. I noticed this problem after using
"python.autoComplete.extraPaths": [ "${workspaceFolder}/src" ],and using autosave with autopep8 few times (seem like some pep8 formating must occure but not sure). Simple folder structure:
Before the problem occurs all autocomplete functions works well. After the problem sys, time and other builtin packages are unrecognized.
Edit:
Seem to happen always just after python log
[Info - 7:16:23 PM] Reloading modules...which seem to happen always if autopep8 makes some changes to files.]Edit2:
I tried to disable autopep8 and instead tried to use this macro:
using runInTerminal and macros which seem to work fine and sys does not throw unresolved import . Also language server was not reloaded which seem to be related. In trace log from language server first run analyses shows
Analysis of sys(CompiledBuiltin) queuedbut when reload occurs no builtin are analyzed even though other packages seem to be analyzed again.jakebailey commentedon Jun 10, 2019
Interesting. The reloading is due to our file watcher detecting changes on disk to reload files (for package installation and so on, see also #1076 for the issue on improving that mechanism).
It might be the case that when we go reload modules, some builtins are getting lost.
jakebailey commentedon Jun 10, 2019
johnybx Also, we'd appreciate it if you could try the daily build, which includes a few race fixes among other things that we think could have fixed the missing builtins issues:
johnybx commentedon Jun 11, 2019
Jake Bailey (@jakebailey) I already tried
but it did not resolve this issue.
need47 commentedon Jun 11, 2019
I have the same issue with builtin 'sys' and 'time', and I tried the daily build. It did not help. Python version is 3.7.3. So it's not limited to 2.7.
pcolmer commentedon Jun 12, 2019
I'm occasionally hitting this problem. I'm currently running 1.36.0-insider. I'm developing against a folder opened inside a container.
jakebailey commentedon Jul 15, 2019
Now that I've fixed the path watcher to watch the correct things, I've observed this happening for some libraries, in my case
arrayanditertools. When the reload happens, it seems like some modules are getting lost. Needs testing.[-]Unresolved import for builtin packages (Python 2.7)[/-][+]Unresolved import for builtin packages after reload[/+]jakebailey commentedon Aug 7, 2019
This might have been fixed in #1402. See also #1345.
johnybx commentedon Aug 15, 2019
Jake Bailey (@jakebailey) Problem still occurs - builtin packages are unresolved after reload of language server.
johnybx commentedon Aug 19, 2019
Alexander Sher (@AlexanderSher) Jake Bailey (@jakebailey) still occurs in Microsoft Python Language Server version 0.3.47.0.
MikhailArkhipov commentedon Aug 19, 2019
Changes are not in stable feed yet. "python.analysis.downloadChannel": "daily" is 0.3.59. We do not push builds with large changes into stable immediately, so when an issue is closed, it does not mean the fix shows up in stable next day.
pcolmer commentedon Aug 20, 2019
That is certainly a good point to make but, as someone who does use the stable build, I get frustrated by the following:
The comment in Merges from db #1446 says "may fix Unresolved import for builtin packages after reload #1156) (my emphasis on "may").
There isn't any clarification from the PR/merge process as to which version of Python Language Server PR#1446 is getting merged into, so people using the stable build don't know which version to keep an eye out for.
Given the "may" ... perhaps the issue ought to be left open until it is definite that Unresolved import for builtin packages after reload #1156 is fixed by that PR?
8 remaining items
jakebailey commentedon Aug 26, 2019
At the moment, the version numbers aren't "true" semver; the last number is actually just a build number we trigger manually (versions may skip or repeat commits). Improving this is something that'd be good once we're more stable.
Fix microsoft#1156: Unresolved import for builtin packages after reload
jakebailey commentedon Sep 3, 2019
We believe this to be fixed. We'd appreciate if anyone with this issue could try out the beta and see if the issue goes away.
anatolyburakov commentedon Sep 4, 2019
Jake Bailey (@jakebailey) i am experiencing this with RemoteSSH connection. The above line doesn't appear to work (the line in the config is dimmed, as if the option does not exist), so i can't test with the beta/daily version. I am using VSCode Insiders build. How do i get the latest Python extension?
jakebailey commentedon Sep 4, 2019
The option is not documented, which is why VS Code does not think it exists. If you set beta and reload, the extension should download an updated copy. Beta is currently 0.3.72.
The language server and the extension are versioned separately; you don't need to get the latest extension in order to get the latest language server.
anatolyburakov commentedon Sep 5, 2019
Jake Bailey (@jakebailey) i believe the issue is fixed for me, thanks! at least i haven't seen any problems so far.
jonathanwall commentedon Sep 13, 2019
this fixed it for me so far
jakebailey commentedon Sep 13, 2019
The fix is now out in stable, so you don't need to set this variable to get this fix (though we always like testers).
noamsto commentedon Oct 24, 2019
Alexander Sher (@AlexanderSher) I'm still seeing this issue with 'itertools' import under centos, is it a known problem?

Sys info:
OS: CentOS Linux release 7.7.1908
Code: 1.39.2
Python: 2.7.16 (also on 2.7.5)
Python-language-server: 0.4.71.0
jakebailey commentedon Oct 24, 2019
Unless this occurs only after a reload (package install), then it's likely not related to this old issue. I'd appreciate it if you could file a new issue with your info.
Merges from db
Fix microsoft#1156: Unresolved import for builtin packages after relo…