5

I have multiple kernels installed in Jupyter. without fully starting Jupyter in a browser I'd like to know which version of Python or Julia or R was used to create the notebook. is there a way to query the ipynb file using command line?

How to know which is running in Jupyter notebook? discusses how to change kernels. I'd like to be able just to interrogate the notebook.

tobias_k
  • 74,298
  • 11
  • 102
  • 155
ShpielMeister
  • 1,229
  • 7
  • 21
  • 4
    Jupyter Notebook file is a JSON document. It has metadata in there containing all information you need. You could parse it using `jq` or write your own Python script using `json` library – Georgy Dec 15 '17 at 22:48

1 Answers1

7

As @Georgy said, you can use jq, ie.:

ismael-vc@toybox ~/Downloads % cat Untitled.ipynb | jq '.metadata.kernelspec'
{
  "display_name": "Julia 0.6.0",
  "language": "julia",
  "name": "julia-0.6"
}
HarmonicaMuse
  • 6,813
  • 32
  • 50