[Language Server] "Unable to resolve module" for app project
See original GitHub issueEnvironment data
- VS Code version: Version 1.25.1 (1.25.1)
- Extension version (available under the Extensions sidebar): 2018.7.0
- OS and version: macOS 10.13.6
- Python version (& distribution if applicable, e.g. Anaconda): 3.6.3
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): virtualenv
- Relevant/affected Python packages and their versions: XXX
Actual behavior
I have a few directories that form my python workspace. Each directory is a separate python project (either app, that’s executed, or library, that has setup.py and is installed) with a separate env configured inside vscode. I’ve turned on new “language server” feature.
Imports from my app are underlined and say “Unable to resolve <module>. Intellisense may be missing.” Imports from my libs work fine.
Expected behavior
I’d like language server to process apps as well (autocomplete, goto, etc.)
Logs
Starting Microsoft Python language server.
[Info - 10:43:22 PM] Created Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreter instance from Microsoft.PythonTools.Interpreter.Ast.AstPythonInterpreterFactory
Initializing for /Users/yevhen/.virtualenvs/<app_project>/bin/python
Issue Analytics
- State:
- Created 5 years ago
- Reactions:23
- Comments:42 (9 by maintainers)
Top Results From Across the Web
Unable to Resolve Module in React Native App - Stack Overflow
To solve it you need to view the mentioned file and change the file location to the correct location. Share.
Read more >Language Server Extension Guide - Visual Studio Code
Learn how to create Language Servers to provide rich language features in Visual Studio Code.
Read more >Environment - You.com
react native - EXPO: Unable to resolve module '. ... asyncGeneratorStep (/Users/pierrebresson/Documents/Git/nmf-app/node_modules/metro/src/Server.js:99:24) ...
Read more >typescript-language-server - npm
Start using typescript-language-server in your project by running `npm i ... module names to be resolved in the initial completions request.
Read more >Using Visual Studio Code | Manual - Deno
We realize that not every project you might edit with vscode is a Deno ... for Deno APIs as well as the ability...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m also having the same issue.
All relative imports within my own code (non-3rd party) are marked as unable to resolve module. Jedi handles the code correctly.
Logs
I got this down to a minimal set of steps:
Create a project structure like this
package
is a package with an empty__init__.py
file.test.py
tries toimport package
.env
is a virtual environment (python3 -m venv env
)Open this folder in fresh install of VSCode 1.25 and vscode-python 2018.7.0 as a single-folder workspace (just
Open folder
), with Jedi disabled. Set the Python interpreter to the one in the virtual environment.You’ll see the “IntelliSense may be missing” message for the
import package
line.To be honest, the virtual environment doesn’t make a difference, I just included it because it’s one more place to look for the package in addition to the system libs and our own packages, and it isn’t working either. I tested this on Debian 9, but I don’t think it makes a difference (others have different setups). Import, auto-completion and signatures for global packages (e.g.:
datetime
,json
) work just fine.As I said in my previous message, adding folders manually in
python.autoComplete.extraPaths
makes it work.