# Failed to import SimpleITK in Python following its installation through miniconda on Win11-x64

**URL:** <https://discourse.itk.org/t/failed-to-import-simpleitk-in-python-following-its-installation-through-miniconda-on-win11-x64/6460>\
**Category:** Beginner Questions\
**Created:** [February 22, 2024, 2:34am UTC](https://discourse.itk.org/t/failed-to-import-simpleitk-in-python-following-its-installation-through-miniconda-on-win11-x64/6460 "2024-02-22T02:34:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ms-hashemi](https://discourse.itk.org/user_avatar/discourse.itk.org/ms-hashemi/32/3924_2.png) [@ms-hashemi](https://discourse.itk.org/u/ms-hashemi)\
**Post date:** [February 22, 2024, 2:34am UTC](https://discourse.itk.org/t/failed-to-import-simpleitk-in-python-following-its-installation-through-miniconda-on-win11-x64/6460/1 "2024-02-22T02:34:13Z")

</div>

Hi everyone,

I would like to work with SimpleITK in Python. It seems that it has been installed successfully via miniconda on my Win11-x64 system, but when I try to import it in the interactive environment of Python, I encounter the following error:

Python 3.11.5 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:26:23) [MSC v.1916 64 bit (AMD64)] on win32  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import SimpleITK  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in   
> > > File “C:\ProgramData\miniconda3\envs\mytorch\Lib\site-packages\SimpleITK\__init_\_.py”, line 18, in   
> > > from SimpleITK.SimpleITK import \*  
> > > File “C:\ProgramData\miniconda3\envs\mytorch\Lib\site-packages\SimpleITK\SimpleITK.py”, line 13, in   
> > > from . import \_SimpleITK  
> > > ImportError: DLL load failed while importing \_SimpleITK: The specified module could not be found.

By the way, this is the list of packages installed in my miniconda environment:

# packages in environment at C:\ProgramData\miniconda3\envs\mytorch:

# 

# Name Version Build Channel

abseil-cpp 20230802.0 h5da7b33\_2  
absl-py 2.1.0 pyhd8ed1ab\_0 conda-forge  
aiohttp 3.9.3 py311ha68e1ae\_0 conda-forge  
aiosignal 1.3.1 pyhd8ed1ab\_0 conda-forge  
attrs 23.2.0 pyh71513ae\_0 conda-forge  
blas 1.0 mkl  
blinker 1.7.0 pyhd8ed1ab\_0 conda-forge  
bottleneck 1.3.7 py311hd7041d2\_0  
brotli-python 1.0.9 py311hd77b12b\_7  
bzip2 1.0.8 he774522\_0  
c-ares 1.26.0 hcfcfb64\_0 conda-forge  
ca-certificates 2024.2.2 h56e8100\_0 conda-forge  
cached-property 1.5.2 py\_0  
cachetools 5.3.2 pyhd8ed1ab\_0 conda-forge  
certifi 2024.2.2 py311haa95532\_0  
cffi 1.16.0 py311h2bbff1b\_0  
charset-normalizer 2.0.4 pyhd3eb1b0\_0  
click 8.1.7 win\_pyh7428d3b\_0 conda-forge  
colorama 0.4.6 py311haa95532\_0  
contextlib2 21.6.0 py311haa95532\_0  
cryptography 41.0.3 py311h89fc84f\_0  
cuda-cccl 12.3.101 0 nvidia  
cuda-cudart 12.1.105 0 nvidia  
cuda-cudart-dev 12.1.105 0 nvidia  
cuda-cupti 12.1.105 0 nvidia  
cuda-libraries 12.1.0 0 nvidia  
cuda-libraries-dev 12.1.0 0 nvidia  
cuda-nvrtc 12.1.105 0 nvidia  
cuda-nvrtc-dev 12.1.105 0 nvidia  
cuda-nvtx 12.1.105 0 nvidia  
cuda-opencl 12.3.101 0 nvidia  
cuda-opencl-dev 12.3.101 0 nvidia  
cuda-profiler-api 12.3.101 0 nvidia  
cuda-runtime 12.1.0 0 nvidia  
eigen 3.4.0 h91493d7\_0 conda-forge  
fftw 3.3.10 nompi\_h38027f0\_108 conda-forge  
filelock 3.13.1 py311haa95532\_0  
freetype 2.12.1 ha860e81\_0  
frozenlist 1.4.1 py311ha68e1ae\_0 conda-forge  
giflib 5.2.1 h8cc25b3\_3  
gmpy2 2.1.2 py311h7f96b67\_0  
google-auth 2.28.0 pyhca7485f\_0 conda-forge  
google-auth-oauthlib 1.2.0 pyhd8ed1ab\_0 conda-forge  
grpc-cpp 1.48.2 h6772dbd\_4  
grpcio 1.48.2 py311h6772dbd\_4  
gtest 1.14.0 h91493d7\_1 conda-forge  
h5py 3.8.0 nompi\_py311h3a26632\_100 conda-forge  
hdf5 1.12.2 nompi\_h57737ce\_101 conda-forge  
icc\_rt 2022.1.0 h6049295\_2  
idna 3.4 py311haa95532\_0  
importlib-metadata 7.0.1 pyha770c72\_0 conda-forge  
intel-openmp 2023.1.0 h59b6b97\_46320  
jinja2 3.1.2 py311haa95532\_0  
jpeg 9e h2bbff1b\_1  
lerc 3.0 hd77b12b\_0  
libaec 1.1.2 h63175ca\_1 conda-forge  
libboost 1.82.0 h3399ecb\_2  
libboost-python 1.82.0 py311h12feb9d\_6 conda-forge  
libcublas 12.1.0.26 0 nvidia  
libcublas-dev 12.1.0.26 0 nvidia  
libcufft 11.0.2.4 0 nvidia  
libcufft-dev 11.0.2.4 0 nvidia  
libcurand 10.3.4.101 0 nvidia  
libcurand-dev 10.3.4.101 0 nvidia  
libcurl 8.5.0 h86230a5\_0  
libcusolver 11.4.4.55 0 nvidia  
libcusolver-dev 11.4.4.55 0 nvidia  
libcusparse 12.0.2.55 0 nvidia  
libcusparse-dev 12.0.2.55 0 nvidia  
libdeflate 1.17 h2bbff1b\_1  
libffi 3.4.4 hd77b12b\_0  
libitk 5.3.0 h6e1890f\_0 conda-forge  
libjpeg-turbo 2.0.0 h196d8e1\_0  
libnpp 12.0.2.50 0 nvidia  
libnpp-dev 12.0.2.50 0 nvidia  
libnvjitlink 12.1.105 0 nvidia  
libnvjitlink-dev 12.1.105 0 nvidia  
libnvjpeg 12.1.1.14 0 nvidia  
libnvjpeg-dev 12.1.1.14 0 nvidia  
libpng 1.6.39 h8cc25b3\_0  
libprotobuf 3.20.3 h23ce68f\_0  
libssh2 1.10.0 he2ea4bf\_2  
libtiff 4.4.0 h8a3f274\_2  
libuv 1.44.2 h2bbff1b\_0  
libwebp 1.3.2 hbc33d0d\_0  
libwebp-base 1.3.2 h2bbff1b\_0  
libzlib 1.2.13 hcfcfb64\_5 conda-forge  
lz4-c 1.9.4 h2bbff1b\_0  
markdown 3.5.2 pyhd8ed1ab\_0 conda-forge  
markupsafe 2.1.1 py311h2bbff1b\_0  
medpy 0.4.0 py311h9ea8ea8\_6 conda-forge  
mkl 2023.1.0 h6b88ed4\_46358  
mkl-service 2.4.0 py311h2bbff1b\_1  
mkl\_fft 1.3.8 py311h2bbff1b\_0  
mkl\_random 1.2.4 py311h59b6b97\_0  
ml-collections 0.1.1 pyhd8ed1ab\_0 conda-forge  
mpc 1.1.0 h7edee0f\_1  
mpfr 4.0.2 h62dcd97\_1  
mpir 3.0.0 hec2e145\_1  
mpmath 1.3.0 py311haa95532\_0  
multidict 6.0.5 py311ha68e1ae\_0 conda-forge  
networkx 3.1 py311haa95532\_0  
numexpr 2.8.7 py311h1fcbade\_0  
numpy 1.26.2 py311hdab7c0b\_0  
numpy-base 1.26.2 py311hd01c5d8\_0  
oauthlib 3.2.2 pyhd8ed1ab\_0 conda-forge  
openjpeg 2.4.0 h4fc8c34\_0  
openssl 3.2.1 hcfcfb64\_0 conda-forge  
pandas 2.1.4 py311hf62ec03\_0  
pillow 10.0.1 py311h045eedc\_0  
pip 23.3.1 py311haa95532\_0  
protobuf 3.20.3 py311hd77b12b\_0  
pyasn1 0.5.1 pyhd8ed1ab\_0 conda-forge  
pyasn1-modules 0.3.0 pyhd8ed1ab\_0 conda-forge  
pycparser 2.21 pyhd3eb1b0\_0  
pyjwt 2.8.0 pyhd8ed1ab\_1 conda-forge  
pyopenssl 23.2.0 py311haa95532\_0  
pysocks 1.7.1 py311haa95532\_0  
python 3.11.5 he1021f5\_0  
python-dateutil 2.8.2 pyhd3eb1b0\_0  
python-tzdata 2023.3 pyhd3eb1b0\_0  
python\_abi 3.11 2\_cp311 conda-forge  
pytorch 2.1.1 py3.11\_cuda12.1\_cudnn8\_0 pytorch  
pytorch-cuda 12.1 hde6ce7c\_5 pytorch  
pytorch-mutex 1.0 cuda pytorch  
pytz 2023.3.post1 py311haa95532\_0  
pyu2f 0.1.5 pyhd8ed1ab\_0 conda-forge  
pyyaml 6.0.1 py311h2bbff1b\_0  
re2 2022.04.01 h0e60522\_0 conda-forge  
requests 2.31.0 py311haa95532\_0  
requests-oauthlib 1.3.1 pyhd8ed1ab\_0 conda-forge  
rsa 4.9 pyhd8ed1ab\_0 conda-forge  
scipy 1.11.4 py311hc1ccb85\_0  
setuptools 68.0.0 py311haa95532\_0  
simpleitk 2.2.1 py311h67644cf\_1 conda-forge  
six 1.16.0 pyhd3eb1b0\_1  
sqlite 3.41.2 h2bbff1b\_0  
sympy 1.12 py311haa95532\_0  
tbb 2021.8.0 h59b6b97\_0  
tensorboard 2.15.2 pyhd8ed1ab\_0 conda-forge  
tensorboard-data-server 0.7.0 py311h1ea47a8\_1 conda-forge  
tensorboardx 2.2 pyhd3eb1b0\_0  
tk 8.6.12 h2bbff1b\_0  
torchaudio 2.1.1 pypi\_0 pypi  
torchvision 0.16.1 pypi\_0 pypi  
tqdm 4.65.0 py311h746a85d\_0  
typing\_extensions 4.7.1 py311haa95532\_0  
tzdata 2023c h04d1e81\_0  
ucrt 10.0.22621.0 h57928b3\_0 conda-forge  
urllib3 1.26.18 py311haa95532\_0  
vc 14.2 h21ff451\_1  
vc14\_runtime 14.38.33130 h82b7239\_18 conda-forge  
vs2015\_runtime 14.38.33130 hcb4865c\_18 conda-forge  
werkzeug 3.0.1 pyhd8ed1ab\_0 conda-forge  
wheel 0.41.2 py311haa95532\_0  
win\_inet\_pton 1.1.0 py311haa95532\_0  
xz 5.4.2 h8cc25b3\_0  
yaml 0.2.5 he774522\_0  
yarl 1.9.4 py311ha68e1ae\_0 conda-forge  
zipp 3.17.0 pyhd8ed1ab\_0 conda-forge  
zlib 1.2.13 hcfcfb64\_5 conda-forge  
zstd 1.5.5 hd43e919\_0

I appreciate your prompt assistance to resolve this issue.

Best,

Mohammad

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [February 22, 2024, 1:06pm UTC](https://discourse.itk.org/t/failed-to-import-simpleitk-in-python-following-its-installation-through-miniconda-on-win11-x64/6460/2 "2024-02-22T13:06:19Z")

</div>

Please try the latest SimpleITK 2.3.1 version from Conda forge in a clean environment.

---

<div class="post-metadata">

**Author:** ![ms-hashemi](https://discourse.itk.org/user_avatar/discourse.itk.org/ms-hashemi/32/3924_2.png) [@ms-hashemi](https://discourse.itk.org/u/ms-hashemi)\
**Post date:** [February 23, 2024, 12:12am UTC](https://discourse.itk.org/t/failed-to-import-simpleitk-in-python-following-its-installation-through-miniconda-on-win11-x64/6460/3 "2024-02-23T00:12:03Z")

</div>

Thank you so much. I did so, and it worked in a new conda environment. So, afterward, I specified the exact 2.3.1 version in the conda install command to make it work in the original environment too.

---

<div class="post-metadata">

**Author:** ![Taz](https://discourse.itk.org/user_avatar/discourse.itk.org/taz/32/3999_2.png) [@Taz](https://discourse.itk.org/u/Taz)\
**Post date:** [April 12, 2024, 8:28pm UTC](https://discourse.itk.org/t/failed-to-import-simpleitk-in-python-following-its-installation-through-miniconda-on-win11-x64/6460/4 "2024-04-12T20:28:49Z")

</div>

I have tried doing this as well, but doing the following:

conda install -c conda-forge simpleitk

in a fresh conda environment installs simpleitk without letting me import the module for use. It is in my environment list though:

# Name Version Build Channel

\_libgcc\_mutex 0.1 conda\_forge conda-forge  
\_openmp\_mutex 4.5 2\_gnu conda-forge  
bzip2 1.0.8 hd590300\_5 conda-forge  
c-ares 1.28.1 hd590300\_0 conda-forge  
ca-certificates 2024.2.2 hbcca054\_0 conda-forge  
eigen 3.4.0 h00ab1b0\_0 conda-forge  
expat 2.6.2 h59595ed\_0 conda-forge  
fftw 3.3.10 nompi\_hc118613\_108 conda-forge  
hdf5 1.14.3 nompi\_h4f84152\_100 conda-forge  
icu 73.2 h59595ed\_0 conda-forge  
keyutils 1.6.1 h166bdaf\_0 conda-forge  
krb5 1.21.2 h659d440\_0 conda-forge  
ld\_impl\_linux-64 2.40 h41732ed\_0 conda-forge  
lerc 4.0.0 h27087fc\_0 conda-forge  
libaec 1.1.3 h59595ed\_0 conda-forge  
libcurl 8.7.1 hca28451\_0 conda-forge  
libdeflate 1.20 hd590300\_0 conda-forge  
libedit 3.1.20191231 he28a2e2\_2 conda-forge  
libev 4.33 hd590300\_2 conda-forge  
libexpat 2.6.2 h59595ed\_0 conda-forge  
libffi 3.4.2 h7f98852\_5 conda-forge  
libgcc-ng 13.2.0 h807b86a\_5 conda-forge  
libgfortran-ng 13.2.0 h69a702a\_5 conda-forge  
libgfortran5 13.2.0 ha4646dd\_5 conda-forge  
libgomp 13.2.0 h807b86a\_5 conda-forge  
libhwloc 2.9.3 default\_h554bfaf\_1009 conda-forge  
libiconv 1.17 hd590300\_2 conda-forge  
libitk 5.3.0 h26001f5\_8 conda-forge  
libjpeg-turbo 3.0.0 hd590300\_1 conda-forge  
libnghttp2 1.58.0 h47da74e\_1 conda-forge  
libnsl 2.0.1 hd590300\_0 conda-forge  
libpng 1.6.43 h2797004\_0 conda-forge  
libsqlite 3.45.2 h2797004\_0 conda-forge  
libssh2 1.11.0 h0841786\_0 conda-forge  
libstdcxx-ng 13.2.0 h7e041cc\_5 conda-forge  
libtiff 4.6.0 h1dd3fc0\_3 conda-forge  
libuuid 2.38.1 h0b41bf4\_0 conda-forge  
libwebp-base 1.3.2 hd590300\_1 conda-forge  
libxcrypt 4.4.36 hd590300\_1 conda-forge  
libxml2 2.12.6 h232c23b\_1 conda-forge  
libzlib 1.2.13 hd590300\_5 conda-forge  
ncurses 6.4.20240210 h59595ed\_0 conda-forge  
openssl 3.2.1 hd590300\_1 conda-forge  
pip 24.0 pyhd8ed1ab\_0 conda-forge  
python 3.12.2 hab00c5b\_0\_cpython conda-forge  
python\_abi 3.12 4\_cp312 conda-forge  
readline 8.2 h8228510\_1 conda-forge  
setuptools 69.2.0 pyhd8ed1ab\_0 conda-forge  
simpleitk 2.3.1 py312h30efb56\_2 conda-forge  
tbb 2021.11.0 h00ab1b0\_1 conda-forge  
tk 8.6.13 noxft\_h4845f30\_101 conda-forge  
tzdata 2024a h0c530f3\_0 conda-forge  
wheel 0.43.0 pyhd8ed1ab\_1 conda-forge  
xz 5.2.6 h166bdaf\_0 conda-forge  
zlib 1.2.13 hd590300\_5 conda-forge  
zstd 1.5.5 hfc55251\_0 conda-forge

---

<div class="post-metadata">

**Author:** ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)\
**Post date:** [April 15, 2024, 3:35pm UTC](https://discourse.itk.org/t/failed-to-import-simpleitk-in-python-following-its-installation-through-miniconda-on-win11-x64/6460/5 "2024-04-15T15:35:28Z")

</div>

Hello,

The following Dockerfile works:

```auto
FROM ubuntu:22.04

ADD https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh /root
RUN bash /root/Miniconda3-latest-Linux-x86_64.sh -b -p /root/miniconda3
RUN . /root/miniconda3/bin/activate && \
    conda config --add channels conda-forge && \
    conda config --set channel_priority strict && \
    conda install simpleitk
RUN . /root/miniconda3/bin/activate && \
    python -c "import SimpleITK; print(SimpleITK.Version())"
ENTRYPOINT ["/root/miniconda3/bin/conda", "list"]

```

I am not sure what is different about your environment to cause the issue or conflict of packages. If you are able to reproduce the issue in a Dockerfile, then it can be looked into further.
