diff --git a/bob/io/image/utils.py b/bob/io/image/utils.py
index 0865850d6a1431e369a04daef3bf2f1a7d231018..3f0986ddf1048935a92ee957eb96cc5550eb60de 100644
--- a/bob/io/image/utils.py
+++ b/bob/io/image/utils.py
@@ -1,5 +1,4 @@
 import numpy as np
-import matplotlib.pyplot as plt
 
 
 def to_matplotlib(img):
@@ -64,6 +63,7 @@ def imshow(img, cmap=None, **kwargs):
     object
         Returns whatever ``plt.imshow`` returns.
     '''
+    import matplotlib.pyplot as plt
 
     if cmap is None and img.ndim == 2:
         cmap = 'gray'
diff --git a/conda/meta.yaml b/conda/meta.yaml
index a3cf6267147a7e38f6c5a4b0f3dd2a4d63482f33..57103ddb9bd8c46bfd003315c00c089f9bb92853 100644
--- a/conda/meta.yaml
+++ b/conda/meta.yaml
@@ -40,9 +40,10 @@ requirements:
   run:
     - python
     - setuptools
-    - matplotlib
     - boost
     - {{ pin_compatible('numpy') }}
+  run_constrained:
+    - matplotlib
 
 test:
   imports:
@@ -59,6 +60,7 @@ test:
     - coverage
     - sphinx
     - sphinx_rtd_theme
+    - matplotlib
 
 about:
   home: https://www.idiap.ch/software/bob/
diff --git a/doc/extra-intersphinx.txt b/doc/extra-intersphinx.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6ccafc3f904ba0d6ffda0fdc2802e0d6a59a3832
--- /dev/null
+++ b/doc/extra-intersphinx.txt
@@ -0,0 +1 @@
+matplotlib
diff --git a/requirements.txt b/requirements.txt
index 8c00d21761f84565528cceb1bc15387eccd04c8f..6256c751814003280f64dc1167a64e6c3e2474ad 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,4 +4,3 @@ bob.extension
 bob.blitz
 bob.core
 bob.io.base
-matplotlib
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6ccafc3f904ba0d6ffda0fdc2802e0d6a59a3832
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1 @@
+matplotlib