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

Created on 27 Jan 2019  路  12Comments  路  Source: jupyter/notebook

This error is arising when I run a notebook in conda env that I had previously created in another env.

AttributeError                            Traceback (most recent call last)
~/miniconda3/envs/wip_conda/lib/python3.6/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/wip_conda/lib/python3.6/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/wip_conda/lib/python3.6/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'

Most helpful comment

I have exactly the same issue here. I haven't looked the spacy code to understand what it is causing the issue, however, as a quite dirty workaround, it is possible to add the following line:

get_ipython().config.get('IPKernelApp', {})['parent_appname'] = ""

This should avoid panda to break.

All 12 comments

I'm having this issue too, specifically when trying to print Pandas DataFrames. I've noticed that DataFrames print fine when I've only loaded Pandas (import pandas as pd). But when I also import spacy, I get this error.

I am running JupyterLab v. 0.35.4, Python v. 3.7.2, and Pandas v. 0.24.0 inside a Pipenv virtual environment on MacOS 10.14.2. Happy to provide other information if helpful.

This also occurred to me this morning when displaying a data frame in Jupyter Lab. I'm running it through a conda environment and the import is handled by fastai. I tried importing Pandas on its own and it works fine. My set up is similar to what chadbot lists ^^

I have exact same experience as @A2ed
Also, the sequence of import (importing pandas before fastai), does not seem to help.

For me removing the dataframe / series returns from my functions "resolved" the issue. I'm also having spacy in the same env and same imports, so will check that as well later today.

I have exactly the same issue here. I haven't looked the spacy code to understand what it is causing the issue, however, as a quite dirty workaround, it is possible to add the following line:

get_ipython().config.get('IPKernelApp', {})['parent_appname'] = ""

This should avoid panda to break.

I also get the issue when I have both pandas and spacy, like @chadbot did.

As a simple workaround until the issue is fixed:

from IPython.display import HTML
HTML(df)

I'm also having same issue

Same problem here.

The workaround from @viniciuscadorereed sets notebook behavior back to normal for me (fixes default dataframe view in output cells - don't have to call HTML(df) for each display). Execute this line anywhere prior to displaying a dataframe:

get_ipython().config.get('IPKernelApp', {})['parent_appname'] = ""

Current setup:

  • python 3.6.6
  • pandas 0.24.0
  • jupyter 4.4.0
  • spacy 2.0.18

This will be resolved in the next update of pandas and we'll also be issuing a workaround for spaCy. If you're interested, see here for some background on the problem: pandas-dev/pandas#25036

Same problem here.

The workaround from @viniciuscadorereed sets notebook behavior back to normal for me (fixes default dataframe view in output cells - don't have to call HTML(df) for each display). Execute this line anywhere prior to displaying a dataframe:

get_ipython().config.get('IPKernelApp', {})['parent_appname'] = ""

This solved the issue for me.

from IPython.display import HTML

Does not work in case of Null in DataFrame!

ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cancan101 picture cancan101  路  3Comments

mmngreco picture mmngreco  路  3Comments

qnicole-zakka picture qnicole-zakka  路  3Comments

arbaazsama picture arbaazsama  路  3Comments

mowe96 picture mowe96  路  3Comments