X Tutup
Skip to content

six environment polluted when misuse of matplotlib import #8290

@alexandnpu

Description

@alexandnpu

Bug report

Bug summary

  • For not-so-careful beginners, misuse of import pollute six environment

Code for reproduction

For first time use after pip install matplotlib

import matplotlib as plt

Actual outcome

Traceback (most recent call last):
  File "draw_plot.py", line 4, in <module>
    import matplotlib as plt
  File "/path/to/.alexpy3/lib/python3.6/site-packages/matplotlib/__init__.py", line 129, in <module>
    from six.moves.urllib.request import urlopen
ImportError: cannot import name 'urlopen'

after this, the same import error still stays.

python
> from six.moves.urllib.request import urlopen
ImportError: cannot import name 'urlopen'

Expected outcome

  • six environment should not be polluted even for misuse of matplotlib

Matplotlib version

  • Matplotlib version, 2.0.0
  • Python version, 3.6.0
  • Platform, OSX
  • How did you install Matplotlib and Python, pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup