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

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

Open
mikkokotila opened this issue Jan 27, 2019 · 13 comments
Open

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

mikkokotila opened this issue Jan 27, 2019 · 13 comments

Comments

@mikkokotila
Copy link

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'
@chadbot
Copy link

chadbot commented Jan 28, 2019

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.

@A2ed
Copy link

A2ed commented Jan 28, 2019

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 ^^

@sahilseth
Copy link

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

@mikkokotila
Copy link
Author

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.

@viniciuscadorereed
Copy link

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.

@Etang21
Copy link

Etang21 commented Jan 30, 2019

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

@jmunar
Copy link

jmunar commented Jan 30, 2019

As a simple workaround until the issue is fixed:

from IPython.display import HTML
HTML(df)

@haskarb
Copy link

haskarb commented Jan 31, 2019

I'm also having same issue

@CloudCray
Copy link

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

@ines
Copy link

ines commented Jan 31, 2019

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

@pechyonkin
Copy link

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.

@mdalvi
Copy link

mdalvi commented Sep 25, 2019

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().

@Mani-ghahremani
Copy link

I have the same problem in jupyter Notebook after updating my pandas Library(pip install --upgrade pandas). Then I restart the Kernel and it solved!:)


AttributeError Traceback (most recent call last)
~\Anaconda3\lib\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:

~\Anaconda3\lib\site-packages\pandas\core\frame.py in repr_html(self)
796 max_cols = get_option("display.max_columns")
797 max_colwidth = get_option("display.max_colwidth")
--> 798 show_dimensions = get_option("display.show_dimensions")
799 if get_option("display.expand_frame_repr"):
800 width, _ = console.get_console_size()

~\Anaconda3\lib\site-packages\pandas\io\formats\format.py in to_html(self, buf, encoding, classes, notebook, border)
986 notebook : {True, False}, optional, default False
987 Whether the generated HTML is for IPython Notebook.
--> 988 border : int
989 A border=border attribute is included in the opening
990 <table> tag. Default pd.options.display.html.border.

AttributeError: 'NotebookFormatter' object has no attribute 'get_result'

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