Skip to content


Subversion checkout URL

You can clone with
Download ZIP


sphinxext.ipython_directive broken #2053

merged 1 commit into from

3 participants


When I installed MPL 1.2.1, my sphinx broke. I now get this error that I didn't before:

Could not import extension matplotlib.sphinxext.ipython_directive (exception: cannot import name Config)

My bad. Seems the only issue is an upgrade to IPython is required. Would be nice if there was a more clear error rather than that fairly cryptic failure


Thanks @ibell - we can certainly improve this message.

Given that the matplotlib.sphinxext.ipython_* directives all require IPython, I'm tempted to recommend that matplotlib deprecates these directives in favour of the IPython managed ones (here: - that would require some coordination with IPython to allow IPython users to import the sphinx extensions, but that seems like a reasonable thing to request.

@mdboom & @fperez - do you have any feelings on this?


I think that was discussed years ago, with the same conclusion, but I think this was forgotten. I'm all in favor of deprecating the matplotlib copies for 1.3, and removing in 1.4.


I think that would probably be fine, couldn't you just import IPython's rather than fully deprecating it and breaking people's code?


The problem is that IPython doesn't install its sphinx extensions. I've filed a bug for that.



I think that would probably be fine, couldn't you just import IPython's rather than fully deprecating it and breaking people's code?

We could certainly do that for a release cycle along with a deprecation warning - but in truth there is a cost to keeping legacy stuff around, so in the long term we will certainly be removing this (provided it does get exposed by IPython in future releases).


I've attached a fix that should address the original problem in this issue, and give a better error message if the IPython is too old. (Unfortunately, I don't know exactly which minimum version of IPython is required, so that is not in the message). In the long run, we'll deprecate this (or import from IPython when they are available to do so), but that will have to be done in the future, so I've created #2062 for that.

@pelson pelson merged commit 22c3978 into matplotlib:master

1 check was pending

Details default The Travis CI build is in progress
@mdboom mdboom deleted the mdboom:ipython-directive-error-message branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 24, 2013
  1. @mdboom
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/matplotlib/sphinxext/
12 lib/matplotlib/sphinxext/
@@ -80,9 +80,15 @@
# Our own
-from IPython import Config, InteractiveShell
-from IPython.core.profiledir import ProfileDir
-from IPython.utils import io
+ from IPython import Config, InteractiveShell
+ from IPython.core.profiledir import ProfileDir
+ from IPython.utils import io
+except ImportError:
+ raise ImportError(
+ "Unable to import the necessary objects from IPython. "
+ "You may need to install or upgrade your IPython installation.")
# Globals
Something went wrong with that request. Please try again.