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

Matplotlib issue arise when importing tensorlayer #79

Closed
ghost opened this issue Feb 2, 2017 · 2 comments
Closed

Matplotlib issue arise when importing tensorlayer #79

ghost opened this issue Feb 2, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 2, 2017

I am working with conda environment. After installing tensorlayer, I tried to import it: import tensorlayer as tl, but got such an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/tensorlayer/__init__.py", line 16, in <module>
    from . import files
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/tensorlayer/files.py", line 13, in <module>
    from . import visualize
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/tensorlayer/visualize.py", line 6, in <module>
    import matplotlib.pyplot as plt
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/matplotlib/pyplot.py", line 115, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
    globals(),locals(),[backend_name],0)
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/matplotlib/backends/backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import QtCore
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/matplotlib/backends/backend_qt5.py", line 26, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/matplotlib/backends/qt_editor/formlayout.py", line 56, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "/Users/yobichi/miniconda3/envs/dl/lib/python3.5/site-packages/matplotlib/backends/qt_compat.py", line 175, in <module>
    "Matplotlib qt-based backends require an external PyQt4, PyQt5,\n"
ImportError: Matplotlib qt-based backends require an external PyQt4, PyQt5,
or PySide package to be installed, but it was not found.

This issue is not supposed to arise with conda. When I import matplotlib individually, it works well. I wonder how can I deal with this issue. Thanks in advance!

@wagamamaz
Copy link
Collaborator

can you try

import matplotlib 
matplotlib.use('Agg')
import tensorlayer as tl

@ghost
Copy link
Author

ghost commented Feb 2, 2017

It solved the problem perfectly! Thanks a lot!!!

@ghost ghost closed this as completed Feb 2, 2017
This issue was closed.
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