InsightSoftwareConsortium / InsightSoftwareConsortium/ITK

Externally built remote modules require duplication of Python3_ROOT_DIR

Open
#2,238 1 comment 1 reaction 0 assignees View on GitHub
type:Design
Dominant language
C++
Stars
1.7k
Forks
748
Avg merge
1d 1h
Merged PRs (30d)
64

Description

### Description

If non-default Python version is chosen for ITK by creating cache entry `Python3_ROOT_DIR` (e.g. setting it to `C:/Program Files/Python37`), it needs to be also created and set to the same path for all the externally built remote modules too. Otherwise a run-time issue is created when trying to `import itk`:
```text
Message=Module use of python38.dll conflicts with this version of Python.
Source=M:\Dev\ITK-vs19\Wrapping\Generators\Python\itk\StrainPython.py
StackTrace:
File "M:\Dev\ITK-vs19\Wrapping\Generators\Python\itk\StrainPython.py", line 13, in
from . import _StrainPython
File "M:\Dev\ITK-vs19\Wrapping\Generators\Python\itk\support\itkBase.py", line 262, in load
l_spec.loader.exec_module(l_module) # pytype: disable=attribute-error
File "M:\Dev\ITK-vs19\Wrapping\Generators\Python\itk\support\itkBase.py", line 110, in itk_load_swig_module
l_module = loader.load(swig_module_name)
File "M:\Dev\ITK-vs19\Wrapping\Generators\Python\itk\__init__.py", line 111, in _initialize_module
_itkBase.itk_load_swig_module(module, sys.modules[__name__].__dict__)
File "M:\Dev\ITK-vs19\Wrapping\Generators\Python\itk\__init__.py", line 123, in
_initialize_module()
File "M:\Dev\ITK-git\Modules\Filtering\ImageIntensity\wrapping\test\itkImageFilterNumPyInputsTest.py", line 21, in
import itk
```

### Expected behavior

Externally built remote modules pick up Python version from ITK, so duplicating manual specification of Python version is not necessary.

### Versions

Affects current master.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.