Building dicom

I’ve just tried building the vtk-dicom library from David Gobbi.
I have VTK freshly built from git sources, configured with
shared-objects on and wrap-python on [using Python 3]. Building the DICOM library is fine however when it comes to try using the Python bindings I get
ModuleNotFoundError: No module named ‘vtkDICOMPython’
I can’t locate a dylib in the DICOM build area, so it would be useful to know

  • where should the Python library files be found after install?
  • are there any PATH setting s that need updating?
    I’,m building on OSX 11.1
    cmake version 3.19.6
    Python 3.9.1

I’m not desperate to use DICOM per se but I was hoping to use the library sources as a guide to resolvesome issues with a different library.


The Python module has a “.so” suffix, even on macOS, and is called “vtkDICOM”. The “Python” suffix was removed from all vtk-python modules as of VTK 9.

For details on loading the module, see Testing/ (and Testing/CMakeLists.txt).

Hope this helps,

Thanks David,
I’ve been through there but with no effect. For information. I’m not seeing a vtkDICOMPython* any where what I get after make
in the lib subdir

cmake libvtkDICOM.0.8.12.dylib libvtkDICOM.a python3.10 vtk

libdicomcli.a libvtkDICOM.1.dylib libvtkDICOM.dylib python3.9

In lib/python3.10/site-packages/


I didn’t see any failure after make [install]. Have I forgotten to do something?



For VTK 9, there is no vtkDICOMPython anything. The Python module will be In my vtk-dicom build tree, it is located here:


Its use requires setting the Python path. If it isn’t being built, then make sure that BUILD_PYTHON_WRAPPERS=ON is enabled in your configuration (it should be enabled automatically if you built VTK itself with VTK_WRAP_PYTHON).

Don’t trust “make install” to do the right thing for vtk-dicom, because I still haven’t fully updated it for VTK 9. In general, the best way to build & use vtk-dicom is to enable it as a remote module during the VTK build. If built this way, it will be properly installed along with the rest of the VTK python modules.

Making progress, I’ve now confirmed that I have
in /usr/local/lib/python3.9/site-packages/vtk/modules/
However vtkpython isstill not lodading it

import vtk

Traceback (most recent call last):

File “”, line 1, in

File “/usr/local/lib/python3.9/site-packages/”, line 30, in

all_m = importlib.import_module(‘vtkmodules.all’)

File “/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/”, line 127, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File “/usr/local/lib/python3.9/site-packages/vtkmodules/”, line 20, in

from .vtkViewsCore import *

ImportError: dlopen(/usr/local/lib/python3.9/site-packages/vtkmodules/, 2): Symbol not found: _iconv

Referenced from: /usr/lib/libarchive.2.dylib

Expected in: /usr/local/lib//libiconv.2.dylib

in /usr/lib/libarchive.2.dylib

import vtkDICOM

Traceback (most recent call last):

File “”, line 1, in

ModuleNotFoundError: No module named ‘vtkDICOM’

I’m not sure why the _iconv error isappearing.

Could I check what version of Python do you have, from where?

thanks again

An import vtk will only load modules that were part of the VTK build. There isn’t any way for third-party modules such as vtk-dicom to insert themselves after-the-fact.

Take a look at the script to see an example of how the module can be loaded. But as I mentioned in my previous post, you can’t trust the “make install” for vtk-dicom to put everything in the right place. In order to import vtkDICOM you must manually place somewhere within the python path, or set the PYTHONPATH variable.

I’m using python-3.8, installed via the installer.

I haven’t ever encountered a missing _iconv symbol, and I’m not aware of how vtkViewsCore uses iconv. It’s very unlikely to be related to Python. Either the VTK::ViewsCore module is missing a necessary dependency, or else there is some kind of symbol visibility issue.

Regarding the _iconv symbol error for /usr/lib/libarchive.2.dylib, the only VTK module that uses libarchive is VTK::CommonArchive. So it’s very strange that the error occurred during the loading of vtkViewsCore.

Can you try loading the modules individually?

import vtkmodules.vtkCommonCore
import vtkmodules.vtkCommonArchive
import vtkmodules.vtkViewsCore

thanks David. I’m painfully familiar with is problem from other systems on OSX but sadly thats the only system I have access to these days :-(.
I think I triggered the problem by modifying my path vars. Once I’ve restore iconv sanity I’ll get back to looking at TestDICOMPython.
Many thanks for taking the time to respond.
best regards