ITKPythonPackage
ITKPythonPackage copied to clipboard
itk.Vector fails in anaconda+windows
After installing itk 5.3rc4 in a fresh anaconda environment, we get an error when loading ITKCommonPython (e.g. by calling itk.Vector). However, creating an environment with a standalone install of python (without anaconda) works fine. You can find more details on the latter in this issue https://github.com/InsightSoftwareConsortium/ITKElastix/issues/154, where we originally spotted the error. Any ideas where is it coming from?
(base) PS C:\> conda create -n itk-env python=3.9.12
Collecting package metadata (current_repodata.json): done
Solving environment: done
## Package Plan ##
environment location: C:\Users\Konstantinos\Anaconda3\envs\itk-env
added / updated specs:
- python=3.9.12
The following NEW packages will be INSTALLED:
ca-certificates pkgs/main/win-64::ca-certificates-2022.4.26-haa95532_0
certifi pkgs/main/win-64::certifi-2022.6.15-py39haa95532_0
openssl pkgs/main/win-64::openssl-1.1.1p-h2bbff1b_0
pip pkgs/main/win-64::pip-21.2.4-py39haa95532_0
python pkgs/main/win-64::python-3.9.12-h6244533_0
setuptools pkgs/main/win-64::setuptools-61.2.0-py39haa95532_0
sqlite pkgs/main/win-64::sqlite-3.38.5-h2bbff1b_0
tzdata pkgs/main/noarch::tzdata-2022a-hda174b7_0
vc pkgs/main/win-64::vc-14.2-h21ff451_1
vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
wincertstore pkgs/main/win-64::wincertstore-0.2-py39haa95532_2
Proceed ([y]/n)? y
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate itk-env
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) PS C:\> conda activate itk-env
(itk-env) PS C:\> pip install --pre itk
Collecting itk
Using cached itk-5.3rc4-cp39-cp39-win_amd64.whl (8.3 kB)
Collecting itk-segmentation==5.3rc4
Using cached itk_segmentation-5.3rc4-cp39-cp39-win_amd64.whl (5.2 MB)
Collecting numpy
Using cached numpy-1.23.0-cp39-cp39-win_amd64.whl (14.7 MB)
Collecting itk-io==5.3rc4
Using cached itk_io-5.3rc4-cp39-cp39-win_amd64.whl (8.5 MB)
Collecting itk-numerics==5.3rc4
Using cached itk_numerics-5.3rc4-cp39-cp39-win_amd64.whl (20.2 MB)
Collecting itk-filtering==5.3rc4
Using cached itk_filtering-5.3rc4-cp39-cp39-win_amd64.whl (24.0 MB)
Collecting itk-core==5.3rc4
Using cached itk_core-5.3rc4-cp39-cp39-win_amd64.whl (36.1 MB)
Collecting itk-registration==5.3rc4
Using cached itk_registration-5.3rc4-cp39-cp39-win_amd64.whl (9.1 MB)
Installing collected packages: numpy, itk-core, itk-numerics, itk-filtering, itk-segmentation, itk-registration, itk-io, itk
Successfully installed itk-5.3rc4 itk-core-5.3rc4 itk-filtering-5.3rc4 itk-io-5.3rc4 itk-numerics-5.3rc4 itk-registration-5.3rc4 itk-segmentation-5.3rc4 numpy-1.23.0
(itk-env) PS C:\> python
Python 3.9.12 (main, Apr 4 2022, 05:22:27) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import itk
>>> itk.Vector
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Konstantinos\Anaconda3\envs\itk-env\lib\site-packages\itk\support\lazy.py", line 138, in __getattribute__
base.itk_load_swig_module(module, namespace)
File "C:\Users\Konstantinos\Anaconda3\envs\itk-env\lib\site-packages\itk\support\base.py", line 132, in itk_load_swig_module
l_module = loader.load(swig_module_name)
File "C:\Users\Konstantinos\Anaconda3\envs\itk-env\lib\site-packages\itk\support\base.py", line 291, in load
l_spec.loader.exec_module(l_module) # pytype: disable=attribute-error
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\Konstantinos\Anaconda3\envs\itk-env\lib\site-packages\itk\support\..\ITKCommonPython.py", line 13, in <module>
from . import _ITKCommonPython
ImportError: DLL load failed while importing _ITKCommonPython: The specified module could not be found.
Hi @ntatsisk , thanks for the report. We are releasing 5.3rc4.post1 soon -- it will be interesting to see if this addresses this issue.
Thanks @thewtex. Unfortunately, version 5.3rc4.post1 leads to the same error for me.
@ntatsisk thanks for the testing and update! I made a few notes in: https://github.com/InsightSoftwareConsortium/ITK/issues/3391#issuecomment-1192955848
A note to re-test with itk-5.3.0 -- we updated the toolchain to VS2022.
@thewtex, I just checked with itk-5.3.0 and the issue is indeed resolved. Feel free from my side to close the issue. Thanks! :)