You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.
In [2]: from IPython.nbconvert.filters.highlight import _pygments_highlight
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-703783dd7ab9> in <module>()
----> 1 from IPython.nbconvert.filters.highlight import _pygments_highlight
ImportError: cannot import name _pygments_highlight
Woops, looks like I have an aged IPython version.
ipython -V
1.2.1
Although I checked running from IPython.nbconvert.filters.highlight import _pygment_highlight in IPython and it doesn't error. This is for the IPython version > 2.0. Why would it fail inside of the ipynb plugin and not IPython notebook?
Ran pip install ipython[all] too.
I downloaded the newest release on Github, tar xvfz ipython-2.1.0.tar.gz, cd ipython-2.1.0/, python setup.py install, and it didn't fix. I double-checked by uninstalling pip uninstall ipython. Confirmed it was gone, then reran python setup.py install, and it returns 1.2.1 instead of 2.1.0. Maybe IPython didnt update their internal version number with the release?
Anyway, besides a version number issue that may be unrelated, I don't see why the tryfrom IPython.nbconvert.filters.highlight import _pygment_highlight would fail when I can run it in IPython?
The text was updated successfully, but these errors were encountered:
Okay, I was being silly about the version number stuff, there were conflicting IPython versions. I solved that with apt-get remove ipython. So, with version 2.1.0.
try:
from IPython.nbconvert.filters.highlight import _pygment_highlight
except ImportError:
# IPython < 2.0
from IPython.nbconvert.filters.highlight import _pygments_highlight
And the earlier import wasnt the issue, maybe instead of _pygments I needed output = _pygment_highlight(source, formatter, language, metadata) in the custom_highlighter method. but now with the correct version, things work a-okay.
Hi, I have Pygments installed, but get an error
Updates:
You can duplicate this in IPython, using the line #27 in ipynb.py
Woops, looks like I have an aged IPython version.
Although I checked running
from IPython.nbconvert.filters.highlight import _pygment_highlight
in IPython and it doesn't error. This is for the IPython version > 2.0. Why would it fail inside of the ipynb plugin and not IPython notebook?Ran
pip install ipython[all]
too.I downloaded the newest release on Github,
tar xvfz ipython-2.1.0.tar.gz
,cd ipython-2.1.0/
,python setup.py install
, and it didn't fix. I double-checked by uninstallingpip uninstall ipython
. Confirmed it was gone, then reranpython setup.py install
, and it returns1.2.1
instead of2.1.0
. Maybe IPython didnt update their internal version number with the release?Anyway, besides a version number issue that may be unrelated, I don't see why the
try
from IPython.nbconvert.filters.highlight import _pygment_highlight
would fail when I can run it in IPython?The text was updated successfully, but these errors were encountered: