Python autocomplete in VS Code not working with external libraries in conda environment

2.3k views Asked by At

I have installed several libraries into a conda environment named "foo". I am using Visual Studio Code as my IDE.

Autocomplete works fine for almost all packages, except for the library "openmesh" (see below): Autocomplete with openmesh

Autcomplete with a different library

I have selected the correct python interpreter in VS Code: Interpreter

As confirmed in the bottom left corner.

Version

Furthermore, I have tried to add it to the autocomplete path in the settings of VS Code, however, there was no change, even after relaunching.

Extra Paths

Autocomplete works fine with PyCharm, as seen here: Pycharm

What am I doing wrong?

3

There are 3 answers

0
Youssef Atta'i On

Had a similar problem, auto-completion was not working with python.

The following worked for me:

Use the keyboard shortcut to open the command palette:

Ctrl + Shift + P

and search for:

Python: Restart Language Server

Hit enter. Now give it another try.

0
Daniel L On

https://code.visualstudio.com/docs/python/environments : There are two types of environments that you can create for your workspace: virtual and conda environments.

you have to work into a workspace

0
Muhammad Hussain On

Open your Terminal, activate your environment (i.e. conda activate foo), and then launch VS Code from within terminal in which you activated your environment (i.e. code . or code /path/to/directory). This worked for me.

If you are on Windows you can follow this link