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

VSCode reporting unresolved import on local package #669

Closed
MatejVitek opened this issue Feb 27, 2019 · 5 comments
Closed

VSCode reporting unresolved import on local package #669

MatejVitek opened this issue Feb 27, 2019 · 5 comments
Labels
duplicate This issue or pull request already exists
Milestone

Comments

@MatejVitek
Copy link

I'm using VSCode with the python language plugin and using a conda environment. The project is set up to use the conda environment's interpreter. I installed a local package into that conda environment recently, using python setup.py install. This package is now getting reported as an unresolved import in VSCode.

Howevert, the package imports correctly inside VSCode from VSCode's terminal, as well as by running the file (right click -> run file in terminal). See screenshot:

screenshot from 2019-02-27 16-18-14

This SO question appears to be describing a very similar problem, so I'm not the only one seeing this issue.

@qubitron qubitron added this to the March 2019.1 milestone Mar 6, 2019
@jakebailey
Copy link
Member

We released a new version of the language server to the beta download channel (0.2.16). You can set this in your VS Code settings.json to get it:

"python.analysis.downloadChannel": "beta"

I'd appreciate it if you could retest with your setup.

Additionally, the Python output panel should show the list of search paths the language server is using; if your issue persists it'd be good to see it. With conda, we may need to have the extension "activate" it before launching so that the right variables are set.

@MatejVitek
Copy link
Author

I've downloaded the beta build but it's still reporting an unresolved import.

This is the Python server's output to the output panel:

Starting Microsoft Python language server.
[Info - 11:40:38 AM] GetCurrentSearchPaths /home/user/anaconda/envs/keras/bin/python
[Info - 11:40:38 AM] SearchPaths:
[Info - 11:40:38 AM] /home/user/anaconda/envs/keras/lib/python3.7
[Info - 11:40:38 AM] /home/user/anaconda/envs/keras/lib/python3.7/lib-dynload
[Info - 11:40:38 AM] /home/user/anaconda/envs/keras/lib/python3.7/site-packages
[Info - 11:40:38 AM] /home/user/anaconda/envs/keras/lib/python37.zip;/home/user/anaconda/envs/keras/lib/python3.7;/home/user/anaconda/envs/keras/lib/python3.7/lib-dynload;/home/user/anaconda/envs/keras/lib/python3.7/site-packages;/home/user/anaconda/envs/keras/lib/python3.7/site-packages/My_Python_Libraries-1.0-py3.7.egg;
[Info - 11:40:38 AM] /home/user/anaconda/envs/keras/bin
[Info - 11:40:40 AM] Microsoft Python Language Server version 0.2.16.0
[Info - 11:40:40 AM] Initializing for /home/user/anaconda/envs/keras/bin/python

Not the My_Python_Libraries .egg file in the SearchPaths. This .egg file contains my installed libraries (I have checked the path).

@jakebailey
Copy link
Member

I don't believe we support egg files yet. #196

@MikhailArkhipov
Copy link

Since this is specifically #196 rather than the import resolution issue, changing release.

@MikhailArkhipov
Copy link

Folding into #196

@MikhailArkhipov MikhailArkhipov added the duplicate This issue or pull request already exists label Mar 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants