Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Python unresolved import issue #1137

@DonJayamanne

Description

@DonJayamanne

@chudytom commented on Sun May 26 2019

Environment data

  • VS Code version: 1.34.0
  • Extension version (available under the Extensions sidebar): 2019.4.12954
  • OS and version: Windows 10 v. 1809
  • Python version (& distribution if applicable, e.g. Anaconda): 3.5.2 64-bit without Conda
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): I guess I have no venv set up.
  • Relevant/affected Python packages and their versions: Microsoft Python Language Server v. 0.2.86

Actual behaviour

I open VSCode in a root folder where all my code exists. Part of it looks like this:

  • workspaceRootFolder
    • .vscode
    • network
      • section_network_input.py
    • timepredictionslib
      • build
      • dist
      • timepredictionslib
        • Here in subfolders are all my classes in the module
    • .env

In the 'network' folder I have some script that I run straight from PowerShell whereas in 'timepredictionslib' I have my custom module where I store all reuasuable classes.

All code runs smooth when run by the Python interpreter, however when I disabled Jedi and switched to Microsoft Python Language Server I get the 'unresolved import' error
image

I already added the '.env' file with the following content:
PYTHONPATH=timepredictionslib

and added the file as python.envFile as was advised here:
microsoft/vscode-python#3840 (comment)

Also I added python.autoComplete.extraPaths as was proposed here:
#1099

But none of these helped. Do you guys have any idea what else I need to do for the Lanugage Server to discover my library?

One more thing. When I tried to update the first import presented in the attached screen it is then discovered by the Language Server and IntelliSense but not by Pylint and the Python interpreter:
image

Steps to reproduce:

If needed I will create a smaller project with similiar configuration and push it to GutHub.

Logs

Output for Python in the Output panel
image

settings.json for Python

image

Metadata

Metadata

Assignees

Labels

editable-installspip editable installs / setup.py develop

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions