0

I am just starting to use vtk with python.

I use Anaconda + VTK 8.2.0 (installed with Anaconda Navigator)

In VScode I tried the example: https://vtk.org/Wiki/VTK/Examples/Python/Cylinder

Result: It works, it shows a cylinder.

Problem: VScode highlights some 'problems':

No name 'util' in module 'vtk'

Unable to import 'vtk.util.colors' ...

example image

I think it has something to do with the pylint extension, but I don't know how to solve it.

Kind regards, Kns

kns
  • 1
  • 1
  • Hi, welcome to stackoverflow! Are you using a virtual environment? – Joey Mar 18 '19 at 01:18
  • No, I'm running a clean installation of Anaconda – kns Mar 18 '19 at 10:26
  • 1
    Found a solution: https://stackoverflow.com/a/52260240/11216179 – kns Mar 18 '19 at 11:25
  • Glad to hear that. Maybe you'd consider to formulate an [answer to your own question](https://stackoverflow.com/help/self-answer) so that others who encounter the same problem can benefit from it ;-) – Joey Mar 18 '19 at 11:48

1 Answers1

0

Solution (see also: https://stackoverflow.com/a/52260240/11216179 , post of BlakcRece )

In VS Code;

  1. click on File > Preferences > Settings.

  2. Scroll down to "Python Configurations" in the left window

  3. scroll down to "Python Linting: Mypy Args" in the right window

  4. click on "Edit in settings.json" link

  5. edit the json to include: "--extension-pkg-whitelist=vtk"

  6. ( Or if you want to add all libraries: edit the json to include: "--extension-pkg-whitelist=all" )

kns
  • 1
  • 1