# Python IDE autocompletion for upcoming VTK 9.1

**URL:** https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708
**Category:** Development
**Created:** [September 27, 2021, 9:27pm UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708 "2021-09-27T21:27:38Z")
**Posts on this page:** 11
**Page:** 2

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [September 30, 2021, 3:20pm UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/21 "2021-09-30T15:20:11Z")

</div>

> [@will.schroeder](#):
>
> /usr/local/lib/libpython3.6m.a

For shared VTK builds, a shared libpython is needed. If you build Python yourself, use `--enable-shared` when you configure it.

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [September 30, 2021, 3:24pm UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/22 "2021-09-30T15:24:02Z")

</div>

I never build python, I just use the system install. However I’m going to clean my python environment, it’s likely I have different versions around and confusion is the result.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [September 30, 2021, 3:43pm UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/23 "2021-09-30T15:43:18Z")

</div>

Hi Will, there’s something funny going on because “/usr/local/lib/libpython3.6m.a” is not where ubuntu puts libpython. The system’s python should be in “/usr/lib”.

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [September 30, 2021, 4:06pm UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/24 "2021-09-30T16:06:50Z")

</div>

I’m building from scratch, I’ve removed a lot of junk. Thanks for the help, I’m hopeful that this will fix it.

---

<div class="post-metadata">

### Author: ![will.schroeder](https://discourse.vtk.org/user_avatar/discourse.vtk.org/will.schroeder/32/233_2.png) [@will.schroeder](https://discourse.vtk.org/u/will.schroeder)
#### Post date: [September 30, 2021, 5:07pm UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/25 "2021-09-30T17:07:23Z")

</div>

I’m good now, my python environment needed some love. Thanks,

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [October 1, 2021, 1:22am UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/26 "2021-10-01T01:22:58Z")

</div>

@dgobbi as a first step, do you see any issues replacing `import vtk` in the Python examples with `import vtkmodules.all as vtk`?

My thinking here is that users using IDEs will get a list of options etc., (which they don’t get with just `import vtk`), and this will facilitate learning/comprehension when experimenting.

The second step would be to gradually replace `import vtkmodules.all as vtk` with just the relevant imports. This does bring it more into line with C++ usage.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [October 1, 2021, 1:32am UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/27 "2021-10-01T01:32:56Z")

</div>

> [@amaclean](#):
>
> replacing `import vtk` in the Python examples

I think that’s a great idea.

To satisfy my own curiosity, I tried it with vim-jedi but its autocompletion was slooow for the vtk module (too much stuff inside, must not cache efficiently). Importing just the needed modules was definitely faster.

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [October 1, 2021, 1:36am UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/28 "2021-10-01T01:36:58Z")

</div>

Thanks, I’l do it.

There is also a significant improvement in importing just the needed modules in Windows!

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [October 1, 2021, 1:44am UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/29 "2021-10-01T01:44:45Z")

</div>

Well, Linux loads executables and shared libraries/modules by memory-mapping. So loading a library/module for a second time is essentially free, even if the module is huge. The module persists in RAM until memory pressure causes it to swap out.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.vtk.org/u/ben.boeckel)
#### Post date: [October 1, 2021, 2:24am UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/30 "2021-10-01T02:24:23Z")

</div>

[This issue](https://gitlab.kitware.com/vtk/vtk/-/issues/17435) is “tracking” the porting of the test suite as well.

---

<div class="post-metadata">

### Author: ![amaclean](https://discourse.vtk.org/user_avatar/discourse.vtk.org/amaclean/32/224_2.png) [@amaclean](https://discourse.vtk.org/u/amaclean)
#### Post date: [October 1, 2021, 4:04am UTC](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708/31 "2021-10-01T04:04:40Z")

</div>

@ben.boeckel At least we now have a script that users can use to get a list of the needed modules.

[Previous page](https://discourse.vtk.org/t/python-ide-autocompletion-for-upcoming-vtk-9-1/6708.md?page=1)
