Search code examples
pythonjupyter-notebookanacondajupyterjupyter-lab

Jupyter Themes (`jt`) not applying on Windows (Anaconda) — Theme missing and no changes after refresh


After a fresh Anaconda installation on Windows, I installed jupyterthemes via conda-forge and attempted to set the onedork theme using jt -t onedork. While the command generates a custom.css file in %APPDATA%\.jupyter\custom\, the Jupyter Notebook interface remains unchanged, and the onedork theme does not appear in the Jupyter Notebook settings dropdown. This persists even after clearing browser/Jupyter caches and restarting the kernel.

Installation Log:

(base) PS C:\Users\RehanPlayz> conda install -c conda-forge jupyterthemes
Channels:
 - conda-forge
 - defaults
Platform: win-64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: D:\anaconda3

  added / updated specs:
    - jupyterthemes


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    certifi-2024.12.14         |     pyhd8ed1ab_0         158 KB  conda-forge
    conda-25.1.0               |  py312h2e8e312_0         1.1 MB  conda-forge
    jupyterthemes-0.20.0       |     pyhd8ed1ab_2         4.7 MB  conda-forge
    lesscpy-0.15.1             |     pyhd8ed1ab_1          41 KB  conda-forge
    libexpat-2.6.3             |       he0c23c2_0         136 KB  conda-forge
    libsqlite-3.48.0           |       h67fdade_1         876 KB  conda-forge
    libzlib-1.2.13             |       h2466b09_6          55 KB  conda-forge
    openssl-3.4.0              |       ha4e3fda_1         8.1 MB  conda-forge
    python-3.12.3              |h2628c8c_0_cpython        15.4 MB  conda-forge
    python_abi-3.12            |          5_cp312           7 KB  conda-forge
    ucrt-10.0.22621.0          |       h57928b3_1         547 KB  conda-forge
    vc14_runtime-14.42.34433   |      h6356254_24         736 KB  conda-forge
    vs2015_runtime-14.42.34433 |      hfef2bbc_24          17 KB  conda-forge
    zlib-1.2.13                |       h2466b09_6         105 KB  conda-forge
    ------------------------------------------------------------
                                           Total:        31.9 MB

The following NEW packages will be INSTALLED:

  jupyterthemes      conda-forge/noarch::jupyterthemes-0.20.0-pyhd8ed1ab_2
  lesscpy            conda-forge/noarch::lesscpy-0.15.1-pyhd8ed1ab_1
  libexpat           conda-forge/win-64::libexpat-2.6.3-he0c23c2_0
  libsqlite          conda-forge/win-64::libsqlite-3.48.0-h67fdade_1
  libzlib            conda-forge/win-64::libzlib-1.2.13-h2466b09_6
  python_abi         conda-forge/win-64::python_abi-3.12-5_cp312
  ucrt               conda-forge/win-64::ucrt-10.0.22621.0-h57928b3_1
  vc14_runtime       conda-forge/win-64::vc14_runtime-14.42.34433-h6356254_24

The following packages will be UPDATED:

  conda              pkgs/main::conda-24.11.3-py312haa9553~ --> conda-forge::conda-25.1.0-py312h2e8e312_0
  zlib                    pkgs/main::zlib-1.2.13-h8cc25b3_1 --> conda-forge::zlib-1.2.13-h2466b09_6

The following packages will be SUPERSEDED by a higher-priority channel:

  certifi            pkgs/main/win-64::certifi-2024.12.14-~ --> conda-forge/noarch::certifi-2024.12.14-pyhd8ed1ab_0
  python                pkgs/main::python-3.12.7-h14ffc60_0 --> conda-forge::python-3.12.3-h2628c8c_0_cpython


Proceed ([y]/n)? y


Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
(base) PS C:\Users\RehanPlayz> jt -l
Available Themes:
   chesterish
   grade3
   gruvboxd
   gruvboxl
   monokai
   oceans16
   onedork
   solarizedd
   solarizedl
(base) PS C:\Users\RehanPlayz> jt -t onedork
(base) PS C:\Users\RehanPlayz> jupyter notebook
[I 2025-01-24 18:27:01.952 ServerApp] Extension package jupyter_lsp took 0.4627s to import
[W 2025-01-24 18:27:01.953 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2025-01-24 18:27:02.320 ServerApp] Extension package jupyter_server_terminals took 0.3666s to import
[W 2025-01-24 18:27:03.703 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2025-01-24 18:27:12.043 ServerApp] Extension package panel.io.jupyter_server_extension took 8.3205s to import
[I 2025-01-24 18:27:12.044 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2025-01-24 18:27:12.053 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2025-01-24 18:27:12.066 ServerApp] jupyterlab | extension was successfully linked.
[I 2025-01-24 18:27:12.079 ServerApp] notebook | extension was successfully linked.
[I 2025-01-24 18:27:14.372 ServerApp] notebook_shim | extension was successfully linked.
[I 2025-01-24 18:27:14.373 ServerApp] panel.io.jupyter_server_extension | extension was successfully linked.
[I 2025-01-24 18:27:14.492 ServerApp] notebook_shim | extension was successfully loaded.
[I 2025-01-24 18:27:14.495 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2025-01-24 18:27:14.496 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2025-01-24 18:27:14.519 LabApp] JupyterLab extension loaded from D:\anaconda3\Lib\site-packages\jupyterlab
[I 2025-01-24 18:27:14.520 LabApp] JupyterLab application directory is D:\anaconda3\share\jupyter\lab
[I 2025-01-24 18:27:14.521 LabApp] Extension Manager is 'pypi'.
[I 2025-01-24 18:27:14.859 ServerApp] jupyterlab | extension was successfully loaded.
[I 2025-01-24 18:27:14.868 ServerApp] notebook | extension was successfully loaded.
[I 2025-01-24 18:27:14.869 ServerApp] panel.io.jupyter_server_extension | extension was successfully loaded.
[I 2025-01-24 18:27:14.872 ServerApp] Serving notebooks from local directory: C:\Users\RehanPlayz
[I 2025-01-24 18:27:14.873 ServerApp] Jupyter Server 2.14.1 is running at:
[I 2025-01-24 18:27:14.873 ServerApp] http://localhost:8888/tree?token=e48606499e8e2fb7722fbd8b393432e50e825086116a19d8
[I 2025-01-24 18:27:14.873 ServerApp]     http://127.0.0.1:8888/tree?token=e48606499e8e2fb7722fbd8b393432e50e825086116a19d8
[I 2025-01-24 18:27:14.873 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2025-01-24 18:27:14.991 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/Users/RehanPlayz/AppData/Roaming/jupyter/runtime/jpserver-13384-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/tree?token=e48606499e8e2fb7722fbd8b393432e50e825086116a19d8
        http://127.0.0.1:8888/tree?token=e48606499e8e2fb7722fbd8b393432e50e825086116a19d8
[W 2025-01-24 18:27:15.115 ServerApp] Could not determine npm prefix: [WinError 2] The system cannot find the file specified
[I 2025-01-24 18:27:15.307 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation

What I tried:

  1. Installed jupyterthemes using conda install -c conda-forge jupyterthemes.

  2. Ran jt -t onedork.

  3. Restarted Jupyter Notebook and performed a hard browser refresh (Ctrl + Shift + R).

  4. Verified custom.css exists in the correct directory.

  5. Reinstalled Anaconda and repeated the steps.

Expected Behavior: Apply the onedork theme to the Jupyter Notebooks.

Actual Results: No theme changes and onedork is not even present in the theme dropdown.
Actual Results


Solution

  • The issue is you are trying to apply a theming system to the wrong version of Jupyter Notebook.
    The screenshot I see looks more like Jupyter Notebook 7. If you go to the Anaconda/conda page about the command you are using, you'll see it has a link to the 'Home' of it. There you can see at present the project hasn't been updated in over two years.

    A lot has changed in the Jupyter ecosystem in these last few years. Several pertinent resources on this topic can be found in the bottom half of my answer to 'New Jupyter Notebook Interface'.

    Specifically salient to this issue you have encountered...
    At the Home repo for the project there was also a related issue posted in 2023, albeit with no response. It basically asks that a note be put on the main page about this.

    Another source detailing what you describe doing is not the way to go about this for Jupyter Notebook 7+ can be found in the documentation for the current Jupyter Notebook here. There at the top under 'Custom themes in Notebook 7', it says, "In Notebook 7, the way to create custom themes has changed. This means that custom themes developed for Notebook 6 or earlier will not work with Notebook 7 and upwards. This is for example the case for community contributed themes such as jupyter-themes." (Bold added for emphasis here.)

    Your options

    • The middle of the current Jupyter Notebook's 'Custom themes in Notebook 7' documentation page covers how you can find and use themes in the current version of Juputer Notebook. It even lists some of them there.

    • If you absolutely need to use this particular specific theme, then you are looking to use NbClassic which allows, for the time being, the old Notebook version 6 to work with the new infrastructure supporting JupyterLab and Jupyter Notebook 7+, which is newly implemented from the ground up and built on the JupyterLab components. My answer I referenced earlier here covers more about this NbClasic option at the top there.