question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

[BUG] Databricks is not identified as Jupyter

See original GitHub issue

You may find a solution to your problem in the docs or issues.

Describe the bug

Databricks is not considered as โ€œJupyterโ€, therefore JUPYTER_LINES and JUPYTER_COLUMNS has no effect on the console log

Provide a minimal code example that demonstrates the issue if you can. If the issue is visual in nature, consider posting a screenshot.

Databricks has a Ipython type InteractiveShell which is neither Ipython or ZMQInteractiveShell

image

def _is_jupyter() -> bool:  # pragma: no cover
    """Check if we're running in a Jupyter notebook."""
    try:
        get_ipython  # type: ignore[name-defined]
    except NameError:
        return False
    ipython = get_ipython()  # type: ignore[name-defined]
    shell = ipython.__class__.__name__
    if "google.colab" in str(ipython.__class__) or shell == "ZMQInteractiveShell":
        return True  # Jupyter notebook or qtconsole
    elif shell == "TerminalInteractiveShell":
        return False  # Terminal running IPython
    else:
        return False  # Other type (?)

If youโ€™re using Rich in a terminal:

python -m rich.diagnose
pip freeze | grep rich

If youโ€™re using Rich in a Jupyter Notebook, run the following snippet in a cell and paste the output in your bug report.

from rich.diagnose import report
report()
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ <class 'rich.console.Console'> โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ A high level console interface.                                             โ”‚
โ”‚                                                                             โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ <console width=80 None>                                                 โ”‚ โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚
โ”‚                                                                             โ”‚
โ”‚     color_system = None                                                     โ”‚
โ”‚         encoding = 'utf-8'                                                  โ”‚
โ”‚             file = <PythonShellImpl.ConsoleBuffer object at 0x7f462b809970> โ”‚
โ”‚           height = 25                                                       โ”‚
โ”‚    is_alt_screen = False                                                    โ”‚
โ”‚ is_dumb_terminal = False                                                    โ”‚
โ”‚   is_interactive = False                                                    โ”‚
โ”‚       is_jupyter = False                                                    โ”‚
โ”‚      is_terminal = False                                                    โ”‚
โ”‚   legacy_windows = False                                                    โ”‚
โ”‚         no_color = False                                                    โ”‚
โ”‚          options = ConsoleOptions(                                          โ”‚
โ”‚                        size=ConsoleDimensions(width=80, height=25),         โ”‚
โ”‚                        legacy_windows=False,                                โ”‚
โ”‚                        min_width=1,                                         โ”‚
โ”‚                        max_width=80,                                        โ”‚
โ”‚                        is_terminal=False,                                   โ”‚
โ”‚                        encoding='utf-8',                                    โ”‚
โ”‚                        max_height=25,                                       โ”‚
โ”‚                        justify=None,                                        โ”‚
โ”‚                        overflow=None,                                       โ”‚
โ”‚                        no_wrap=False,                                       โ”‚
โ”‚                        highlight=None,                                      โ”‚
โ”‚                        markup=None,                                         โ”‚
โ”‚                        height=None                                          โ”‚
โ”‚                    )                                                        โ”‚
โ”‚            quiet = False                                                    โ”‚
โ”‚           record = False                                                    โ”‚
โ”‚         safe_box = True                                                     โ”‚
โ”‚             size = ConsoleDimensions(width=80, height=25)                   โ”‚
โ”‚        soft_wrap = False                                                    โ”‚
โ”‚           stderr = False                                                    โ”‚
โ”‚            style = None                                                     โ”‚
โ”‚         tab_size = 8                                                        โ”‚
โ”‚            width = 80                                                       โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€โ”€โ”€ <class 'rich._windows.WindowsConsoleFeatures'> โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Windows features available.                           โ”‚
โ”‚                                                       โ”‚
โ”‚ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ โ”‚
โ”‚ โ”‚ WindowsConsoleFeatures(vt=False, truecolor=False) โ”‚ โ”‚
โ”‚ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ โ”‚
โ”‚                                                       โ”‚
โ”‚ truecolor = False                                     โ”‚
โ”‚        vt = False                                     โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€ Environment Variables โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ {                                  โ”‚
โ”‚     'TERM': 'unknown',             โ”‚
โ”‚     'COLORTERM': None,             โ”‚
โ”‚     'CLICOLOR': None,              โ”‚
โ”‚     'NO_COLOR': None,              โ”‚
โ”‚     'TERM_PROGRAM': None,          โ”‚
โ”‚     'COLUMNS': None,               โ”‚
โ”‚     'LINES': None,                 โ”‚
โ”‚     'JUPYTER_COLUMNS': '200',      โ”‚
โ”‚     'JUPYTER_LINES': '50',         โ”‚
โ”‚     'JPY_PARENT_PID': None,        โ”‚
โ”‚     'VSCODE_VERBOSE_LOGGING': None โ”‚
โ”‚ }                                  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
platform="Linux"

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
willmcgugancommented, Jul 27, 2022

There is no future proof way of detecting Jupyter that I know of. Iโ€™d accept a PR for whatever fudge is required to detect Databricksโ€ฆ

1reaction
noklamcommented, Jul 27, 2022

Iโ€™ll make a PR if this is ok, try to detect DATABRICKS_ROOT_VIRTUALENV_ENV.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Value Labels fail to display in Databricks notebook but they ...
with this code, I can see the value labels in my Anaconda's Jupyter however, they are not displayed in my Databricks notebook? any...
Read more >
Troubleshooting unresponsive Python notebooks or canceled ...
This article provides an overview of troubleshooting steps you can take if a notebook is unresponsive or cancels commands.
Read more >
Databricks Connect | Databricks on AWS
Databricks Connect allows you to connect your favorite IDE (Eclipse, IntelliJ, PyCharm, RStudio, Visual Studio Code), notebook server (Jupyter Notebook,ย ...
Read more >
Databricks Notebook Rendering Issue: IPython.lib.display ...
Expected Output โ€“ Jupyter Notebook image ... -explainer-dashboard-output-in-databricks-notebook-is-not ... Fatal error: Python kernel is unresponsive.
Read more >
Can you import a Jupyter notebook to a Databricks workspace?
Python job run error messages are unreadable ... Is there any limitation in querying the no. of SQL queries in Databricks SQL workspace....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found