diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c95b91e95a5d47f7392958d6fa179adc426c7d28..814643744d177c86191ae6b6b15fb20d9cd7353b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -239,9 +239,6 @@ build documentation:
     - build:latest
   stage: test
   script:
-    - apt-get update && apt-get install -y librsvg2-bin  # for converting svgs to pdfs
-    - pip install git+https://github.com/jupyter-widgets/jupyter-sphinx sphinxcontrib-svg2pdfconverter
-    - python -m ipykernel install --user --name kwant-latest
     - make -C doc clean; make -C doc html SPHINXOPTS='-A website_deploy=True -n -W -D jupyter_execute_default_kernel=kwant-latest' SOURCE_LINK_TEMPLATE="$CI_PROJECT_URL"/blob/\$\$r/\$\$f
   artifacts:
     paths:
@@ -254,9 +251,6 @@ build PDF documentation:
     - build:latest
   stage: test
   script:
-    - apt-get update && apt-get install -y librsvg2-bin  # for converting svgs to pdfs
-    - pip install git+https://github.com/jupyter-widgets/jupyter-sphinx sphinxcontrib-svg2pdfconverter
-    - python -m ipykernel install --user --name kwant-latest
     - make -C doc latex SPHINXOPTS='-n -W -D jupyter_execute_default_kernel=kwant-latest'
     - cd doc/build/latex
     - make all-pdf
diff --git a/docker/Dockerfile.conda b/docker/Dockerfile.conda
index dc2b0b31cd7606b15db637c2d541903eb20df3ae..5deab0b3898547bd8087fd0f0e6ea74c8b8b58a2 100644
--- a/docker/Dockerfile.conda
+++ b/docker/Dockerfile.conda
@@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
         # Additional tools for running CI
         file rsync openssh-client \
         # Documentation building
-        inkscape texlive-full zip \
+        inkscape texlive-full zip librsvg2-bin \
     && apt-get clean && \
     rm -rf /var/lib/apt/lists/*
 
@@ -18,3 +18,5 @@ COPY kwant-latest.yml kwant-stable.yml kwant-stable-no-extras.yml /
 RUN conda env create -qf kwant-stable.yml
 RUN conda env create -qf kwant-stable-no-extras.yml
 RUN conda env create -qf kwant-latest.yml
+
+RUN /usr/local/envs/kwant-latest/bin/python -m ipykernel install --user --name kwant-latest
diff --git a/docker/kwant-latest.yml b/docker/kwant-latest.yml
index 94d526fb8a98a19da302e015f092886c8742e6ba..8c35dce64fd3370d874ccd8c8b447784b15d090f 100644
--- a/docker/kwant-latest.yml
+++ b/docker/kwant-latest.yml
@@ -26,3 +26,6 @@ dependencies:
     - sphinx=1.7.4  # later versions seem to have problems
     - numpydoc
     - requests
+    - pip:
+        - sphinxcontrib-svg2pdfconverter
+        - git+https://github.com/jupyter-widgets/jupyter-sphinx
diff --git a/docker/kwant-stable-no-extras.yml b/docker/kwant-stable-no-extras.yml
index afb5ed70dbe61cc369b597d568119a87c8cc60a3..99b2af168a075b1536b3cdd4234bbedc387b51fb 100644
--- a/docker/kwant-stable-no-extras.yml
+++ b/docker/kwant-stable-no-extras.yml
@@ -19,7 +19,3 @@ dependencies:
     - pytest-cov
     - pytest-flakes
     - pytest-pep8
-    # Documentation building
-    - sphinx=1.7.4  # later versions seem to have problems
-    - numpydoc
-    - requests
diff --git a/docker/kwant-stable.yml b/docker/kwant-stable.yml
index e2d02a00e8d745c9b8c710097fd1869fd9cf128a..5e16a86a5858063c7928a2833c81083e7a34924e 100644
--- a/docker/kwant-stable.yml
+++ b/docker/kwant-stable.yml
@@ -22,7 +22,3 @@ dependencies:
     - pytest-cov
     - pytest-flakes
     - pytest-pep8
-    # Documentation building
-    - sphinx=1.7.4  # later versions seem to have problems
-    - numpydoc
-    - requests