Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

No module named externals #5633

homopolymer opened this Issue Dec 8, 2015 · 6 comments


None yet
4 participants

I installed matplotlib and scikit-bio via conda. An import error listed below occurred when I imported. Appreciate any help to solve it.

Python 2.7.11 |Anaconda 2.4.0 (64-bit)| (default, Dec 6 2015, 18:08:32)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

import skbio
Traceback (most recent call last):
File "", line 1, in
File "/home/fzeng/anaconda/lib/python2.7/site-packages/skbio/init.py", line 14, in
import skbio.io # noqa
File "/home/fzeng/anaconda/lib/python2.7/site-packages/skbio/io/init.py", line 230, in
File "/home/fzeng/anaconda/lib/python2.7/importlib/init.py", line 37, in import_module
File "/home/fzeng/anaconda/lib/python2.7/site-packages/skbio/io/format/ordination.py", line 195, in
from skbio.stats.ordination import OrdinationResults
File "/home/fzeng/anaconda/lib/python2.7/site-packages/skbio/stats/ordination/init.py", line 115, in
from ._correspondence_analysis import CA
File "/home/fzeng/anaconda/lib/python2.7/site-packages/skbio/stats/ordination/_correspondence_analysis.py", line 13, in
from ._base import Ordination, OrdinationResults
File "/home/fzeng/anaconda/lib/python2.7/site-packages/skbio/stats/ordination/_base.py", line 17, in
from mpl_toolkits.mplot3d import Axes3D
File "/home/fzeng/anaconda/lib/python2.7/site-packages/mpl_toolkits/mplot3d/init.py", line 4, in
from matplotlib.externals import six
ImportError: No module named externals


jenshnielsen commented Dec 8, 2015

It sounds like you somehow have two versions of matplotlib installed on top of each other.
I suggest uninstalling matplotlib with conda and then making sure that all leftovers of matplotlib and mpl_toolkits are removed from /home/fzeng/anaconda/lib/python2.7/site-packages and then try again.

Hi Nielsen, it works following your suggestions and thanks a lot. May I ask one more question that how do you find out there are two conflicting versions of matplotlib?


jenshnielsen commented Dec 8, 2015

It was just a guess. But there were two reasons

  • The six code was moved to external in 1.5 so it seems likely that some of your code is 1.5 and some of it older.
  • mpl_toolkits is a namespace package to allow basemap and other external packages to be installed into it. This makes it unreliable to uninstall when changing versions. I hope to be able to change this in a future version to avoid namespace packages.

@homopolymer homopolymer closed this Dec 8, 2015


Phlya commented May 30, 2017

I am having this problem now, and re-installing matplotlib didn't help... Anything I might be missing? Ubuntu 16.04, installation of python 3.5 parallel with 2.7 (tried reinstalling maptlotlib in both installations).

s1529682:~$ python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mpl_toolkits.axes_grid1 import ImageGrid
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/mpl_toolkits/axes_grid1/__init__.py", line 4, in <module>
    from matplotlib.externals import six
ImportError: No module named 'matplotlib.externals'

WeatherGod commented May 30, 2017


Phlya commented May 31, 2017

Ah, good idea, thanks, this helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment