Search code examples
jupyter-notebookanacondadarkmode

Name error and syntax error when trying to activate jupyterthemes


I am new to Python and Jupyter Notebook (with Anaconda), so bear with me if the answer to this is obvious. I would like to change my Jupyter Notebook to dark mode. There are a lot of tutorials out there to do so with jupyter-themes, e.g. here. They are straight forward, and all say exactly the same thing, but it simply does not work for me.

When I'm in Jupyter Notebook, installing the themes either with conda install -c conda-forge jupyterthemes or pip install jupyterthemes seem to work just fine. However, the following commands will give me the following errors.

jt -l will return

---------------------------------------------------------------------------

NameError Traceback (most recent call last)

Input In [5], in <cell line: 1>()

----> 1 jt -h

NameError: name 'jt' is not defined

and

jt -t chesterish will give

Input In [89]

jt -t chesterish

^

SyntaxError: invalid syntax

Same story for any other theme. Any idea what I'm doing wrong? Should I enter the code somewhere else that I'm not aware of?

Either way, thanks in advance and cheers!


Solution

  • If you're in the notebook, try adding an exclamation point before any jt call: !jt -l. If you change the theme like !jt -t chesterish you'll have to restart jupyter notebook for the change to take place, though. Otherwise, you should be able to do the command without the exclamation point in the anaconda prompt. Hopefully this works! Cheers.