Skip to content

Pandas output is broken after fastai import #1531

@noise-field

Description

@noise-field

Describe the bug
After importing fastai.text, pandas output (like .head()) raises an exception:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~/miniconda3/envs/ml/lib/python3.7/site-packages/IPython/core/formatters.py in __call__(self, obj)
    343             method = get_real_method(obj, self.print_method)
    344             if method is not None:
--> 345                 return method()
    346             return None
    347         else:

~/miniconda3/envs/ml/lib/python3.7/site-packages/pandas/core/frame.py in _repr_html_(self)
    647         # display HTML, so this check can be removed when support for
    648         # IPython 2.x is no longer needed.
--> 649         if console.in_qtconsole():
    650             # 'HTML output is disabled in QtConsole'
    651             return None

~/miniconda3/envs/ml/lib/python3.7/site-packages/pandas/io/formats/console.py in in_qtconsole()
    121             ip.config.get('KernelApp', {}).get('parent_appname', "") or
    122             ip.config.get('IPKernelApp', {}).get('parent_appname', ""))
--> 123         if 'qtconsole' in front_end.lower():
    124             return True
    125     except NameError:

AttributeError: 'LazyConfigValue' object has no attribute 'lower'

Provide your installation details

=== Software === 
python        : 3.7.2
fastai        : 1.0.42
fastprogress  : 0.1.18
torch         : 1.0.0
nvidia driver : 384.130
torch cuda    : 9.0.176 / is available
torch cudnn   : 7401 / is enabled

=== Environment === 
platform      : Linux-4.4.0-62-generic-x86_64-with-debian-stretch-sid
distro        : #83-Ubuntu SMP Wed Jan 18 14:10:15 UTC 2017
conda env     : ml
python        : /home/username/miniconda3/envs/ml/bin/python
sys.path      : /home/username/ml_experiments
/home/username/miniconda3/envs/ml/lib/python37.zip
/home/username/miniconda3/envs/ml/lib/python3.7
/home/username/miniconda3/envs/ml/lib/python3.7/lib-dynload

/home/username/miniconda3/envs/ml/lib/python3.7/site-packages
/home/username/miniconda3/envs/ml/lib/python3.7/site-packages/IPython/extensions
/home/username/.ipython

The same problem exists with python 3.6 (except with python 3.6 there seems to be a broken dataclasses dependency as well).

To Reproduce
Import pandas, read a dataframe, show head. Then import * from fastai.text. Show head again.

# coding: utf-8
# In[1]:
import pandas as pd

# In[3]:
df = pd.DataFrame(pd.np.zeros((2, 2))) 

# In[4]:
df  # works fine

# In[5]:
from fastai.text import *

# In[6]:
df  # doesn't work now

Expected behavior
Output is the same.

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