Notebook: Autocompletion fails within cell defining object

Created on 28 Dec 2018  Â·  2Comments  Â·  Source: jupyter/notebook

Running jupyter notebook from the latest Anaconda Build (2018.12, fresh install). This includes Notebook 5.7.4. Windows 7 x64 build.

I hope the following GIF illustrates the issue. If not, I can try to explain more:

jupyter_autocomplete

If I define an object within a specific cell (in the above GIF, a dataframe), then return to the cell and reference the object again, the autocompletion fails to identify the properties of the object. You can see in the console output that the arrays returned are 0 length. In any other cell, the autocompletion identifies the object properties (213 in the example above).

I find this change quite annoying when I'm making plots in the notebook (matplotlib and seaborn). I often will generate a fig and axis within a cell, produce a 'rough draft' of the plot, then return to the original cell and put on finishing touches (labels, titles, etc.). Most of the time, I like to keep all of the plot's code contained within a single cell.

I originally noticed the problem after updating my anaconda environment (conda update conda followed by conda update --all), I thought that I may have done something wrong, so I uninstalled then reinstalled with the latest Anaconda environment, but the behavior persisted.

In 5.7.4, new version of codemirror is bundled (v37 compared to v35 in previous release). Perhaps this is the origin? That's my best guess as the contexthint.js hasn't been updated since 2015 and completer.js hasn't been updated since April 2018.

Most helpful comment

I set-up an env in Anaconda using the latest Jupyter tools and have been poking around at this issue. At first, I tried a following stack traces to determine what might be the cause (no luck). Then, I decided confirm that this was a Notebook issue. I found the following reversions did not fix the problem:

  • Notebook 5.7.4 → 5.6.0
  • jedi 0.13.2 → 0.12.1
  • jupyter_client 5.2.4 → 5.2.3

Therefore, I'm closing this issue.

I could only narrow the problem down to one of the following packages:

  • ipykernel >4.10.0

    • 5.1.0 did not revert the behavior

  • ipython>6.5.0

    • 7.0.1 and 7.1.1 did not revert the behavior.

    • 7.2.0 did cause the problem to re-emerge.

  • jupyter_console >5.2.0

    • 6.0.0 did not revert the behavior

  • prompt_toolkit >1.0.15

    • 2.0.7 did not revert the behavior

I'm guessing that it has something to do with the ipython issues reported here
https://github.com/ipython/ipython/issues/11530

Edit: after selectively updating packages, I narrowed the issue down to ipython 7.2.0. The problem was solved after placing the following code in ~/.ipython/profile_default/ipython_config.py

c = get_config()
c.IPCompleter.use_jedi = False

The fix was noted in other issues, including the link above, as well as https://github.com/ipython/ipython/issues/11546 by

All 2 comments

I tried creating a conda environment with notebook version 5.6, but that didn't fix the behavior. I think that has something to do with needing to install another jupyter kernel within the environment. To simplify things, I uninstalled Anaconda and reinstalled version Anaconda3 5.3.1 for Windows x64. This fixed the behavior:

jupyter_autocomplete2

The installed notebook version is 5.6.0. Python version 3.7.0

I hope this helps to narrow down the origin. I can provide additional information as needed. I'll keep poking around trying to figure out the cause.

I set-up an env in Anaconda using the latest Jupyter tools and have been poking around at this issue. At first, I tried a following stack traces to determine what might be the cause (no luck). Then, I decided confirm that this was a Notebook issue. I found the following reversions did not fix the problem:

  • Notebook 5.7.4 → 5.6.0
  • jedi 0.13.2 → 0.12.1
  • jupyter_client 5.2.4 → 5.2.3

Therefore, I'm closing this issue.

I could only narrow the problem down to one of the following packages:

  • ipykernel >4.10.0

    • 5.1.0 did not revert the behavior

  • ipython>6.5.0

    • 7.0.1 and 7.1.1 did not revert the behavior.

    • 7.2.0 did cause the problem to re-emerge.

  • jupyter_console >5.2.0

    • 6.0.0 did not revert the behavior

  • prompt_toolkit >1.0.15

    • 2.0.7 did not revert the behavior

I'm guessing that it has something to do with the ipython issues reported here
https://github.com/ipython/ipython/issues/11530

Edit: after selectively updating packages, I narrowed the issue down to ipython 7.2.0. The problem was solved after placing the following code in ~/.ipython/profile_default/ipython_config.py

c = get_config()
c.IPCompleter.use_jedi = False

The fix was noted in other issues, including the link above, as well as https://github.com/ipython/ipython/issues/11546 by

Was this page helpful?
0 / 5 - 0 ratings