autonomio / talos

Hyperparameter Experiments with TensorFlow and Keras
https://autonom.io
MIT License
1.62k stars 268 forks source link

AttributeError on import: Backend has no attribute 'required_interactive_framework' #308

Closed bjtho08 closed 5 years ago

bjtho08 commented 5 years ago

So I wanted to do some grid searching for my model to improve its prediction. I decided to try talos, so I used

  pip install talos

And wrote the import statement

  import talos as ta

This is where it went wrong. I got the output listed below the checkboxes. I noticed that matplotlib had been downgraded to 2.2.3 after installing talos, so I force upgraded it to the latest stable again. The error message before and after were, I believe, slightly different, but both involved the backend in some way. I'm using python 3.6.0 on ubuntu 16.04 and running my model in a notebook using jupyterlab.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-12-1f96ca05ae20> in <module>()
      5 import datetime
      6 import numpy as np
----> 7 import talos as ta
      8 import matplotlib.pyplot as plt
      9 from sklearn.model_selection import GridSearchCV

~/.pyenv/versions/3.6.0/lib/python3.6/site-packages/talos/__init__.py in <module>()
      1 # import commands
      2 from .scan.Scan import Scan
----> 3 from .commands.reporting import Reporting
      4 from .commands.predict import Predict
      5 from .commands.deploy import Deploy

~/.pyenv/versions/3.6.0/lib/python3.6/site-packages/talos/commands/reporting.py in <module>()
      3 
      4 if is_connected() is True:
----> 5     from astetik import line, hist, corr, regs, bargrid, kde, box
      6 
      7 from ..metrics.names import metric_names

~/.pyenv/versions/3.6.0/lib/python3.6/site-packages/astetik/__init__.py in <module>()
      1 # PLOTS
----> 2 from .plots.corr import corr
      3 from .plots.hist import hist
      4 from .plots.kde import kde
      5 from .plots.pie import pie

~/.pyenv/versions/3.6.0/lib/python3.6/site-packages/astetik/plots/corr.py in <module>()
      4 import numpy as np
      5 import matplotlib
----> 6 matplotlib.use('Agg')
      7 # ENDS #
      8 import matplotlib.pyplot as plt

~/.pyenv/versions/3.6.0/lib/python3.6/site-packages/matplotlib/__init__.py in use(arg, warn, force)
   1389         if force:
   1390             from matplotlib.pyplot import switch_backend
-> 1391             switch_backend(name)
   1392     # Finally if pyplot is not imported update both rcParams and
   1393     # rcDefaults so restoring the defaults later with rcdefaults

~/.pyenv/versions/3.6.0/lib/python3.6/site-packages/matplotlib/pyplot.py in switch_backend(newbackend)
    211                newbackend, Backend.backend_version)
    212 
--> 213     required_framework = Backend.required_interactive_framework
    214     if required_framework is not None:
    215         current_framework = \

AttributeError: type object 'Backend' has no attribute 'required_interactive_framework'
bjtho08 commented 5 years ago

Turns out my issue was that I was trying to import talos into an already running kernel that already had matplotlib.pyplot loaded. Restarting the kernel removed the error.