GithubHelp home page GithubHelp logo

Comments (17)

ostrokach avatar ostrokach commented on August 30, 2024 7

I had to add 'IPython.sphinxext.ipython_console_highlighting' to extensions in my conf.py. Somehow the old IPython docs have this info but the new ones don't.

Adding '**.ipynb_checkpoints' to exclude_patterns fixed the other problem.

Thanks!

from nbsphinx.

mgeier avatar mgeier commented on August 30, 2024 1

What do you mean by "a bug in its installation procedure"?

expected behavior:

  1. install the ipython package
  2. the 'ipython3' lexer is available without additional actions to be taken

your observed behavior:

  1. install ipython
  2. the 'ipython3' lexer is not available

Therefore, I suspect there is a bug somewhere.
I don't know how the "registration" process of the lexer is supposed to work, but it definitely shows different behavior on different systems.

For me, on Linux/Debian shows the expected behavior.
It works also for the automatic build on readthedocs.

from nbsphinx.

mgeier avatar mgeier commented on August 30, 2024 1

@adamjstewart

ipywidgets should only be required if there are widgets in the notebooks, more specifically, if there is some application/vnd.jupyter.widget-state+json data.

If you have widgets, you somehow have to provide the appropriate JavaScript files, which is done automatically if ipywidgets is available or manually with nbsphinx_widgets_path, see https://nbsphinx.readthedocs.io/en/0.8.9/code-cells.html#Interactive-Widgets-(HTML-only).

If none of your notebooks has any widgets but the warning is still shown, please let me know, because that may be a bug.

And yes, if you want to have code highlighting in code cells, you'll have to install IPython, see https://nbsphinx.readthedocs.io/en/0.8.9/installation.html#Pygments-Lexer-for-Syntax-Highlighting.

from nbsphinx.

mgeier avatar mgeier commented on August 30, 2024 1

A new issue appeared very recently, see #687.

from nbsphinx.

mgeier avatar mgeier commented on August 30, 2024

Hmm, for me this has always worked; the lexer should be part of the "IPython" package: http://ipython.readthedocs.org/en/stable/development/lexer.html.

Can you try to re-install this package?

This happens even with an empty index.rst file (it seems to find my .ipynb_checkpoints folder).

Yes, Sphinx searches the whole source directory (including subfolders) for notebook files and parses all of them, regardless of what's in your index.rst. You should probably add something like this to your conf.py:

exclude_patterns = ['_build', '**.ipynb_checkpoints']

See http://nbsphinx.readthedocs.org/en/latest/usage.html.

from nbsphinx.

mgeier avatar mgeier commented on August 30, 2024

Good to know that you found a solution that works for you!

But still, IMHO the ipython3 lexer should work automatically.
I've never used ipython_console_highlighting (or anything else) explicitly and it just works.
I think this should be somehow be automatically registered when installing the IPython package.

from nbsphinx.

nehalecky avatar nehalecky commented on August 30, 2024

FWIW: I'm also hitting this same warning when building the documentation of the the nbsphinx repo. After cloning and installing dependencies, I run sphinx-build -b html doc doc/html whilc checked out to version 0.2.8.

The fix proposed by @ostrokach :

I had to add 'IPython.sphinxext.ipython_console_highlighting' to extensions in my conf.py.

also worked for me, warnings are gone.

Thanks!

from nbsphinx.

michaelaye avatar michaelaye commented on August 30, 2024

The advise of

adding 'IPython.sphinxext.ipython_console_highlighting' to extensions in my conf.py

is not in the installation instructions yet, should it be added? I also receive this warning

/Users/klay6683/Dropbox/src/pyciss/docs/examples.ipynb:: WARNING: Pygments lexer name 'ipython3' is not known

multiple times for a single almost empty notebook and adding the above extension removed (masked?) that warning.

from nbsphinx.

mgeier avatar mgeier commented on August 30, 2024

@michaelaye If you get the warning even if you have the ipython package installed, this is IMHO a bug in its installation procedure. I'm re-opening this issue as a reminder.

Adding the IPython.sphinxext.ipython_console_highlighting extension is only a work-around, but not the real solution of the problem.

We can add a hint regarding the work-around to the docs (feel free to make a PR!), but it would be also very good to find the actual cause for the problem (and solve it).

from nbsphinx.

adrn avatar adrn commented on August 30, 2024

I'm getting the same warnings. I set up a fresh conda environment, installed all packages as described in http://nbsphinx.readthedocs.io/en/0.2.12/usage.html

What do you mean by "a bug in its installation procedure"?

from nbsphinx.

mgeier avatar mgeier commented on August 30, 2024

So the reason might be a buggy Anaconda package: ContinuumIO/anaconda-issues#1430

from nbsphinx.

mgeier avatar mgeier commented on August 30, 2024

I'm not sure if the Anaconda package is still broken, but this can definitely be solved by using the conda-forge channel.

from nbsphinx.

timothydmorton avatar timothydmorton commented on August 30, 2024

FWIW, I have not had problems with syntax highlighting in nbsphinx when I build locally, but I hit this problem when building with nbsphinx on readthedocs. Not sure if this is helpful or not.

from nbsphinx.

timothydmorton avatar timothydmorton commented on August 30, 2024

OK, looks like I just needed to add ipython to the requirements.txt; didn't need to add the extension referenced above.

from nbsphinx.

mretegan avatar mretegan commented on August 30, 2024

The port version on macOS gives the same error. The one installed from pip works fine.

from nbsphinx.

adamjstewart avatar adamjstewart commented on August 30, 2024

I know this issue is ancient, but I just encountered the same problem on ReadTheDocs with all the latest versions. A simple pip install sphinx nbsphinx doesn't install ipython, so I end up with the warning message:

foo.ipynb:: WARNING: Pygments lexer name 'ipython3' is not known

If I also install ipython, the warning message changes:

WARNING: nbsphinx_widgets_path not given and ipywidgets module unavailable

So it seems like either ipywidgets is required, or nbsphinx_widgets_path must be set. Should ipywidgets be listed as a required dependency, or is this an optional dependency only needed for the ipython lexer?

from nbsphinx.

Bilokin avatar Bilokin commented on August 30, 2024

Hello, I have the same issue as @adamjstewart and my code highlight in the jupyter pages doesn't work and it broke a few days or weeks ago.
Example: https://syscorrfw.readthedocs.io/en/latest/particleid_weight_production.html
Is this issue already being worked on?
Which steps should I take to resolve it for my package?

from nbsphinx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.