Skip to content
Advertisement

Installing GDCM on Windows — ImportError

I am trying to install GDCM on Windows (10, x64) so I can use the GDCM package with Python 3.6.5, and am finding it completely impossible.

I have tried every combination of:

  • Installing GDCM-2.8.7-Windows-x86_64, GDCM-2.8.7-Windows-x86.exe, GDCM-2.8.4-Windows-x86.exe (separately, of course)
  • Adding To PYTHONPATH: C:Program FilesPython36; C:Program FilesPython36Lib; C:Program FilesPython36DLLs; C:Program FilesPython36Scripts; C:Program FilesGDCM 2.8; C:Program FilesGDCM 2.8lib; C:Program FilesGDCM 2.8bin; C:Program FilesGDCM 2.8include; C:Program FilesGDCM 2.8 (and even PYTHONHOME)
  • Copying the files gdcm.py, gdcmswig.py and _gdcmswig.pyd into site-packages and DLLs

The best I can get is copying the above mentioned files to site-packages, which allows python to detect the gdcm package (when the files are removed from site-packages it detects nothing), but returns the error:

>>> import gdcm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:Program FilesPython36libsite-packagesgdcm.py", line 68, in 
<module>
from gdcmswig import *
File "C:Program FilesPython36libsite-packagesgdcmswig.py", line 20, in 
<module>
_gdcmswig = swig_import_helper()
File "C:Program FilesPython36libsite-packagesgdcmswig.py", line 19, in 
swig_import_helper
return importlib.import_module(mname)
File "C:Program FilesPython36libimportlib__init__.py", line 126, in 
import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: DLL load failed: The specified module could not be found.

Installing the _x86 version instead returns the error “%1 is not a Valid Win32 application”.

I downloaded dependencyWalker to analyse _gdcmswig.pyd, but from this I cannot understand much. The problem is not MSVCP100.dll, as I have vc_redist_x64 installed. It does mention Python34.dll, but the answer below got the exact same installer working on Python 3.6.

The solution mentioned at: how to install gdcm python wrapping on Windows System? does not work for me.

Lastly, I cannot get python to detect the package from the Program Files/GDCM 2.8/bin, regardless of what is in PATH, PYTHONPATH, or PYTHONHOME; I don’t know if this is normal or not.

I have spent hours on this, to no avail; any help is greatly appreciated.

Advertisement

Answer

For posterity:

For me, it seems the issue was indeed that the official provided binaries were compiled for Python 3.4; I have no idea how this person got the same installer working on Python 3.6.

The solution was to build the package binaries myself; there was no “one-click” solution. For my ridiculously convoluted adventure in troubleshooting this problem, see: https://motivatedbylaziness.wordpress.com/2018/07/06/the-impossible-journey-of-a-simple-task/

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement