# Installation of ITKElastix with pip

**URL:** https://discourse.itk.org/t/installation-of-itkelastix-with-pip/4936
**Category:** Beginner Questions
**Tags:** python, elastix
**Created:** [April 24, 2022, 12:32pm UTC](https://discourse.itk.org/t/installation-of-itkelastix-with-pip/4936 "2022-04-24T12:32:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![edgar](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/b487fb/32.png) [@edgar](https://discourse.itk.org/u/edgar)
#### Post date: [April 24, 2022, 12:32pm UTC](https://discourse.itk.org/t/installation-of-itkelastix-with-pip/4936/1 "2022-04-24T12:32:12Z")

</div>

Hello!

I tried to look into ITKElastix. As posted [on the repository](https://github.com/InsightSoftwareConsortium/ITKElastix), I did

```
pip install itk-elastix

```

but I also installed TubeTK, ITKStrain, SciPy, Scikit-image and Scikit-learn

```
pip install itk-tubetk itk-strain
pip install scipy
pip install scikit-image scikit-learn

```

The last command gave me

```
ERROR: imageio 2.17.0 has requirement pillow>=8.3.2, but you'll have pillow 7.0.0 which is incompatible.
ERROR: tifffile 2022.4.22 has requirement numpy>=1.19.2, but you'll have numpy 1.17.4 which is incompatible.

```

Thus, I upgraded

```
pip install -U pillow
pip install -U numpy

```

Now, I have these (among others):

```
itk 5.3rc4              
itk-core 5.3rc4              
itk-elastix 0.13.0              
itk-filtering 5.3rc4              
itk-io 5.3rc4              
itk-minimalpathextraction 1.2.0               
itk-numerics 5.3rc4              
itk-registration 5.3rc4              
itk-segmentation 5.3rc4              
itk-strain 0.3.5               
itk-tubetk 1.1
numpy 1.22.3
Pillow 9.1.0
scikit-image 0.19.2              
scikit-learn 1.0.2               
scipy 1.8.0

```

However (or may be because of that), I get this error:

```
registered_image, params = itk.elastix_registration_method(fixed_image, moving_image)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/edgar/.local/lib/python3.8/site-packages/itk/support/lazy.py", line 138, in __getattribute__
    base.itk_load_swig_module(module, namespace)
  File "/home/edgar/.local/lib/python3.8/site-packages/itk/support/base.py", line 96, in itk_load_swig_module
    itk_load_swig_module(dep, namespace)
  File "/home/edgar/.local/lib/python3.8/site-packages/itk/support/base.py", line 96, in itk_load_swig_module
    itk_load_swig_module(dep, namespace)
  File "/home/edgar/.local/lib/python3.8/site-packages/itk/support/base.py", line 92, in itk_load_swig_module
    l_data = itk_base_global_module_data[name]
KeyError: 'ITKImageSources'

```

What should I try to make it work? Thanks!

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [April 25, 2022, 1:38pm UTC](https://discourse.itk.org/t/installation-of-itkelastix-with-pip/4936/2 "2022-04-25T13:38:43Z")

</div>

Newer numpy shouldn’t be a problem for ITK. I think we require 1.20.3 or something. What I suggest is uninstall ITK, then manually remove all the mentions of it in relevant `site-packages`, and then install again. If this doesn’t fix it, try it again, but with version 5.2.1.

---

<div class="post-metadata">

### Author: ![edgar](https://discourse.itk.org/letter_avatar_proxy/v4/letter/e/b487fb/32.png) [@edgar](https://discourse.itk.org/u/edgar)
#### Post date: [April 26, 2022, 9:44am UTC](https://discourse.itk.org/t/installation-of-itkelastix-with-pip/4936/3 "2022-04-26T09:44:58Z")

</div>

Oh, ok. I was getting an error message from `itk-tubetk` about the version. This is what worked for me:

```
# Uninstall current ITK packages
pip uninstall itk-elastix itk-tubetk itk-strain itk itk-core itk-filtering itk-io itk-minimalpathextraction itk-numerics itk-registration itk-segmentation
# Upgrade pip (to enable pip cache purge)
pip install -U pip
# Get rid of pip cache
pip cache purge
# Re-install ITK, ITKElastix and TubeTK (a version compatible with ITK: 5.2 is the latest on pip, and itk-tubetk 1.1 requires 5.3)
pip install itk{,-{elastix,strain,tubetk==1.0.0}}

```

Thank you (:
