Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named matplotlib.pyplot #71

Open
raczben opened this issue Jun 12, 2019 · 1 comment
Open

ImportError: No module named matplotlib.pyplot #71

raczben opened this issue Jun 12, 2019 · 1 comment

Comments

@raczben
Copy link

raczben commented Jun 12, 2019

I get the following error during running the example code from the README

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named matplotlib.pyplot
@raczben
Copy link
Author

raczben commented Jun 12, 2019

The root-cause is located in the init.py:

The problem occures if the ahakab is run from the non-default python interpreter.

Current snippet:

try:
    import matplotlib
    if os.system('python -c "import matplotlib.pyplot as plt;plt.figure()"'):
        # no display, use a display-less backend
        matplotlib.use('Agg')
except ImportError:
    # plotting.py will complain about this later on.
    pass

Suggestion:

import sys

try:
    import matplotlib
    if os.system(sys.executable + ' -c "import matplotlib.pyplot as plt;plt.figure()"'):
        # no display, use a display-less backend
        matplotlib.use('Agg')
except ImportError:
    # plotting.py will complain about this later on.
    pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant