dunovank / jupyter-themes

Custom Jupyter Notebook Themes
MIT License
9.76k stars 1.06k forks source link

No module named 'jupyterthemes' #374

Closed fabiom91 closed 4 years ago

fabiom91 commented 4 years ago

Hi I'm trying to set up the plot style, but I'm not able to import jupyterthemes. The command line commands works fine but I cannot import it in Jupiter notebook:

from jupyterthemes import jtplot
jtplot.style()
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-b5403954c825> in <module>
      1 # import jtplot submodule from jupyterthemes
----> 2 from jupyterthemes import jtplot
      3 
      4 # currently installed theme will be used to
      5 # set plot style if no arguments provided

ModuleNotFoundError: No module named 'jupyterthemes'

PS. if I run python in a shell and import jupyterthemes, it works

fabiom91 commented 4 years ago

Ok the issue was with my Jupiter kernel: If you have the same issue, do the following:

open a terminal window and run python:

import sys
sys.executable

then run the same on a Jupiter notebook. To me, the 2 output path where different so I searched in finder for kernel.json (there could be more then one) and they all look the same. You have to find one that has the same path of your sys.executable output in the Jupyter notebook. Then you can replace it with the path given by the output of sys.executable in the terminal window:

{
 "argv": [
  "REPLACE-THIS-WITH-THE-CORRECT-EXECUTABLE-PATH",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "heterodimers",
 "language": "python"
}

restart the notebook.