Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ImportError: No module named 'mpl_toolkits' #3252

Closed
@cgohlke

Description

@cgohlke

matplotlib.test() fails with 13 of the following errors using matplotlib-1.4.0rc1 on Windows, any Python version:

======================================================================
ERROR: Failure: ImportError (No module named 'mpl_toolkits')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "X:\Python34\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "X:\Python34\lib\site-packages\nose\loader.py", line 285, in generate
    for test in g():
  File "X:\Python34\lib\site-packages\matplotlib\testing\decorators.py", line 157, in test
    baseline_dir, result_dir = _image_directories(self._func)
  File "X:\Python34\lib\site-packages\matplotlib\testing\decorators.py", line 322, in _image_directories
    mod_file = find_dotted_module(func.__module__)[1]
  File "X:\Python34\lib\site-packages\matplotlib\testing\decorators.py", line 316, in find_dotted_module
    res = file, path, _ = imp.find_module(sub_mod, path)
  File "X:\Python34\lib\imp.py", line 297, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named 'mpl_toolkits'

Running the tests via nosetests.exe mpl_toolkits fails with:

======================================================================
FAIL: Failure: AssertionError ()
----------------------------------------------------------------------
Traceback (most recent call last):
  File "X:\Python34\lib\site-packages\nose\failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "X:\Python34\lib\site-packages\nose\loader.py", line 285, in generate
    for test in g():
  File "X:\Python34\lib\site-packages\matplotlib\testing\decorators.py", line 157, in test
    baseline_dir, result_dir = _image_directories(self._func)
  File "X:\Python34\lib\site-packages\matplotlib\testing\decorators.py", line 308, in _image_directories
    assert mods.pop(0) == 'tests'
AssertionError

Adding an empty __init__.py file to Lib\site-packages\mpl_toolkits\ fixes these errors.

Importing mpl_toolkits via import mpl_toolkits from the interpreter or in scripts works.

Using numpy-1.8.1, nose-1.3.3, and setuptools-3.8.1. Matplotlib is installed using bdist_wininst installers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions