jkitchin / ox-ipynb

org-mode exporter to Jupyter notebooks
175 stars 40 forks source link

jupyter doesn't like metadata provided by ox-ipynb, prevents notebooks from loading #42

Closed vxe closed 3 years ago

vxe commented 3 years ago

Get the below error when trying to open an exported notebook

image

Adding the metatdata section from a working notebook gets it to open

ox-ipynb

  "metadata": [
    [
      "org"
    ],
    null,
    null
  ],

working notebook

  "metadata": {
    "kernelspec": {
      "display_name": "Python 3 (ipykernel)",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.9.7"
    }
  },

env

─➛ jupyter --version                                                                                                                                                                                                    11:31PM 28-10-2021
Selected Jupyter core packages...
IPython          : 7.28.0
ipykernel        : 6.4.1
ipywidgets       : 7.6.5
jupyter_client   : 7.0.6
jupyter_core     : 4.8.1
jupyter_server   : not installed
jupyterlab       : not installed
nbclient         : 0.5.4
nbconvert        : 6.2.0
nbformat         : 5.1.3
notebook         : 6.4.4
qtconsole        : not installed
traitlets        : 5.1.0

emacs  --version
GNU Emacs 27.2
jkitchin commented 3 years ago

something did not work right on the export, the metadata from ox-ipynb is incomplete. can you post a MWE org file that does this? I am not able to reproduce it.

vxe commented 3 years ago

sure: metadata.org.tar.gz

additional org mode version: Org mode version 9.4.6 (9.4.6-10-gee652a-elpaplus

jkitchin commented 3 years ago

ox-ipynb does not work on Python cells. you should change them to ipython or jupyter-python cells.

Alternatively it might work to add this to your init

(setq ox-ipynb-kernelspecs 
      (append  ox-ipynb-kernelspecs '((python . (language_info . ((codemirror_mode . ((name . python)
                               (version . 3)))
                   (file_extension . ".py")
                   (mimetype . "text/x-python")
                   (name . "python")
                   (nbconvert_exporter . "python")
                   (pygments_lexer . "python3")
                   (version . "3.5.2")))))))
vxe commented 3 years ago

yeah works with ipython, cells

for future reference, i had to run this to get ipython blocks to evaluate

 pip3 install jupyter_console jupyter_client