GithubHelp home page GithubHelp logo

Comments (36)

mbujosab avatar mbujosab commented on August 30, 2024 1

I was using the version of ox-ipynb.el from the commit of July 11th. I just tried the latest version, and it seems that everything works fine now. Once again, thank you very much for your help and for creating Scimax. It’s great.

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

Good news for me, I was able to get it working again by running M-x jupyter-refresh-kernelspecs. The reason it was failing for me is there was an out of date kernelspec that was trying to load an older version of R that no longer existed.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Maybe it is because I have an old version of Scimax, but I can't find the function M-x jupyter-refresh-kernelspecs.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

When I try to run an R code block, I get the following message:

ess-mode: Customise alist is not specified, nor ess-local-customize-alist is set

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

jupyter-refresh-kernelspecs is an autoloaded interactive byte-compiled Lisp
function in ‘jupyter-kernelspec.el’.

I have jupyter-20231204.529 installed. It also seems to exist in the most recent package.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Dear Professor Kitchin,

I have installed a new version of Scimax (I did a manual installation by cloning the GitHub repository). During the process, I encountered several warning errors and another error when I tried to load 'ox-ipynb'.
(Error (use-package): Cannot load ox-ipynb)

I am not sure what I did wrong.

Error (use-package): Failed to install aggressive-indent: Assertion failed: (or (= (buffer-size tar-data-buffer) (buffer-size)) (eq tar-data-swapped (> (buffer-size tar-data-buffer) (buffer-size))))
Error (use-package): Cannot load aggressive-indent
Error (use-package): Failed to install citeproc: https://elpa.gnu.org/packages/queue-0.2.el: Not found
Error (use-package): Cannot load citeproc
Error (use-package): Failed to install org-ref: https://elpa.gnu.org/packages/queue-0.2.el: Not found
Error (use-package): Cannot load org-ref
Error (use-package): Failed to parse package org-ref-ivy: Wrong type argument: stringp, nil
Error (use-package): Failed to install rainbow-mode: Failed to verify signature: "rainbow-mode-1.0.6.tar.sig"
Error (use-package): Cannot load rainbow-mode
Error (use-package): Failed to install undo-tree: https://elpa.gnu.org/packages/queue-0.2.el: Not found
Error (use-package): Cannot load undo-tree
Error (use-package): scimax-email/:catch: Cannot open load file: No existe el fichero o el directorio, org-ref-export
Error (use-package): Failed to install org-ql: Failed to verify signature: "peg-1.0.1.tar.sig"
Error (use-package): Cannot load org-ql

When I try to run the code in

work misspelled. Type C-; to fix it.
Executing Jupyter-R unknown at position 1313...
Launching ir kernel...
Starting ir kernel process...done
Launching ir kernel...done
Requesting kernel info...
Loading /home/marcos/.emacs.d/elpa/zmq-20230608.1856/emacs-zmq (module)...
zmq-load: Module could not be opened: "/home/marcos/.emacs.d/elpa/zmq-20230608.1856/emacs-zmq.so", "/lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.33' not found (required by /home/marcos/.emacs.d/elpa/zmq-20230608.1856/emacs-zmq.so)" Executing Emacs-Lisp unknown at position 694... Code block produced no output. Executing Jupyter-R unknown at position 1313... Launching ir kernel... Starting ir kernel process...done Launching ir kernel...done Requesting kernel info... Loading /home/marcos/.emacs.d/elpa/zmq-20230608.1856/emacs-zmq (module)... zmq-load: Module could not be opened: "/home/marcos/.emacs.d/elpa/zmq-20230608.1856/emacs-zmq.so", "/lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.33' not found (required by /home/marcos/.emacs.d/elpa/zmq-20230608.1856/emacs-zmq.so)"
Mark set [5 times]

With the new version of scimax It seems that the R-kernel runs (but I have to solve a problem with de 'emacs-zmq.so' module in my PC)

Thank you for all your help and also for your recent series of videos.

Regards,

Marcos Bujosa

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Sorry I missed the file I run:

https://github.com/jkitchin/scimax/blob/master/scimax-jupyter-r.org

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

You probably have to get ox-ipynb from https://github.com/jkitchin/ox-ipynb. I don't think it auto installs from anywhere. The rest of those look like use-package failed to download packages from elpa/melpa. The last error about zmq might mean you have to build that library, eg cd to /home/marcos/.emacs.d/elpa/zmq-20230608.1856, and check the makefile to see if you can build it manually.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Dear Professor Kitchin,

I was using a rather old Linux distribution, which caused most libraries and Emacs itself to be outdated. I decided to install the latest Debian distribution, update Emacs to version 29, and install the latest version of Scimax. Now, Scimax runs R code without any issues, but it does not export it properly to a Jupyter notebook. I receive an error message that says:

"TypeError: pop expected at most 1 argument, got 2."

Additionally, in the old distribution, I didn't use virtual environments in Python. Now, it seems that I can only install certain libraries if I do so in a virtual environment. As a result, notebooks that previously worked with Scimax no longer function because I don't know how to direct Scimax to use the virtual environment's kernel. I have looked at old issues, but I haven't understood how they were resolved.

Thank you for all your help and for writing scimax. It is great! Best regards,

Marcos

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

I pushed some updates to ox-ipynb that will probably fix the export issue (jkitchin/ox-ipynb@32fcdca)

I don't use virtual environments. There is no reason you have to use them, you should always be able to install packages in your main environment. (a lot of packages recommend venvs, and some consider it good practice. It might even be necessary for some people who need incompatible versions in different projects. but if you don't need that, I recommend you not use them). This usually leads to https://xkcd.com/1987/ eventually, but my experience with venvs has been almost the same, it is hard to keep track of what should be getting used.

It is a pretty hard problem to get right I think. some venvs modify the path and are meant to be used in a shell, but that doesn't obviously change the path in emacs (I think it gets this from the shell when you start emacs). Maybe if you setup up pyenv, activate the env you want, and then start emacs it will work like you expect. I am not sure about changing envs though.

You might look into https://github.com/marcwebbie/auto-virtualenv

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Once again, thank you very much for all your help.

The new ox-ipynb update correctly exports the notebook to Jupyter!

However, when exporting the notebook as slides (C-c C-E n s), the browser opens, but the slides are not displayed (although the HTML file is created correctly).

Thank you also for the recommendation about Python environments. I will follow your advice.

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

hm. That is not something I can reproduces, the slideshow works for me at least for this org file: https://github.com/jkitchin/ox-ipynb/blob/master/ipynb-slideshow.org

It also seems to work on an R-notebook for me.

What is the url in the browser?

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

http://127.0.0.1:8000/ConR.slides.html

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

I havne't been able to reproduce this. you might see if the command line works, replace %s with the filename.

jupyter nbconvert "%s" --to slides --post serve

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

This is the message in emacs after C-c C-e n s (this succeeds in the conversion to slides)

[NbConvertApp] Converting notebook /home/marcos/CloudStation/ReposGH/Docencia/EconometriaAplicada-SRC/ConR.ipynb to slides
/usr/lib/python3/dist-packages/nbformat/init.py:92: MissingIDFieldWarning: Code cell is missing an id field, this will become a hard error in future nbformat versions. You may want to use normalize() on your notebooks before validations (available since nbformat 5.1.4). Previous versions of nbformat are fixing this issue transparently, and will stop doing so in the future.
validate(nb)
[NbConvertApp] Writing 576660 bytes to /home/marcos/CloudStation/ReposGH/Docencia/EconometriaAplicada-SRC/ConR.slides.html
[NbConvertApp] Redirecting reveal.js requests to https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.5.0
Serving your slides at http://127.0.0.1:8000/ConR.slides.html
Use Control-C to stop this server

And this is what I get after running: jupyter nbconvert ConR.org --to slides --post serve
in a bash term (It does not succeed in the conversion):

[NbConvertApp] Converting notebook ConR.org to slides
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/nbformat/reader.py", line 18, in parse_json
nb_dict = json.loads(s, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/bin/jupyter-nbconvert", line 33, in
sys.exit(load_entry_point('nbconvert==6.5.3', 'console_scripts', 'jupyter-nbconvert')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 982, in launch_instance
app.start()
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 423, in start
self.convert_notebooks()
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 597, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 560, in convert_single_notebook
output, resources = self.export_single_notebook(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 488, in export_single_notebook
output, resources = self.exporter.from_filename(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 189, in from_filename
return self.from_file(f, resources=resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 207, in from_file
nbformat.read(file_stream, as_version=4), resources=resources, **kw
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbformat/init.py", line 170, in read
return reads(buf, as_version, capture_validation_error, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbformat/init.py", line 88, in reads
nb = reader.reads(s, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbformat/reader.py", line 71, in reads
nb_dict = parse_json(s, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbformat/reader.py", line 21, in parse_json
raise NotJSONError(("Notebook does not appear to be JSON: %r" % s)[:77] + "...") from e
nbformat.reader.NotJSONError: Notebook does not appear to be JSON: '#+TITLE: Notebook de Scimax con R\n#+au...

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

I just realized that the problem also occurs with Python Notebooks. With the old Debian (and Scimax) installation, the browser opened the HTML file correctly after converting to slides. With the new one, it doesn't.

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

This sounds like something I saw recently from multiple versions of ox-ipynb being installed. When I run off of the github version it seems to work. i have made a few minor updates since yesterday that might fix some things. Could you update and try again? thx.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

When exporting to Jupyter notebook I get this from the navigator:

Notebook validation failed: data.cells[2] must be valid exactly by one definition (0 matches found):
""

When exporting to slides I get this in Scimax:

[NbConvertApp] Converting notebook /home/marcos/CloudStation/ReposGH/Docencia/EconometriaAplicada-SRC/Lecc01.ipynb to slides
[NbConvertApp] ERROR | Notebook JSON is invalid: data.cells[2] must be valid exactly by one definition (0 matches found)

Failed validating in notebook['data']['cells']:

On instance:

[NbConvertApp] ERROR | Notebook is invalid after preprocessor <nbconvert.preprocessors.tagremove.TagRemovePreprocessor object at 0x7fcd8086a050>
Traceback (most recent call last):
File "/usr/bin/jupyter-nbconvert", line 33, in
sys.exit(load_entry_point('nbconvert==6.5.3', 'console_scripts', 'jupyter-nbconvert')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 982, in launch_instance
app.start()
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 423, in start
self.convert_notebooks()
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 597, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 560, in convert_single_notebook
output, resources = self.export_single_notebook(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 488, in export_single_notebook
output, resources = self.exporter.from_filename(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 189, in from_filename
return self.from_file(f, resources=resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 206, in from_file
return self.from_notebook_node(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/html.py", line 223, in from_notebook_node
return super().from_notebook_node(nb, resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/templateexporter.py", line 397, in from_notebook_node
nb_copy, resources = super().from_notebook_node(nb, resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 146, in from_notebook_node
nb_copy, resources = self._preprocess(nb_copy, resources)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 337, in _preprocess
self._validate_preprocessor(nbc, preprocessor)
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 307, in _validate_preprocessor
nbformat.validate(nbc, relax_add_props=True)
File "/usr/lib/python3/dist-packages/nbformat/validator.py", line 503, in validate
raise error
nbformat.validator.NotebookValidationError: data.cells[2] must be valid exactly by one definition (0 matches found)

Failed validating in notebook['data']['cells']:

On instance:

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

This is the output from the terminal when I run

jupyter nbconvert "Lecc01.org" --to slides --post serve

[NbConvertApp] Converting notebook Lecc01.org to slides
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/nbformat/reader.py", line 18, in parse_json
nb_dict = json.loads(s, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/bin/jupyter-nbconvert", line 33, in
sys.exit(load_entry_point('nbconvert==6.5.3', 'console_scripts', 'jupyter-nbconvert')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/traitlets/config/application.py", line 982, in launch_instance
app.start()
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 423, in start
self.convert_notebooks()
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 597, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 560, in convert_single_notebook
output, resources = self.export_single_notebook(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/nbconvertapp.py", line 488, in export_single_notebook
output, resources = self.exporter.from_filename(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 189, in from_filename
return self.from_file(f, resources=resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbconvert/exporters/exporter.py", line 207, in from_file
nbformat.read(file_stream, as_version=4), resources=resources, **kw
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbformat/init.py", line 170, in read
return reads(buf, as_version, capture_validation_error, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbformat/init.py", line 88, in reads
nb = reader.reads(s, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbformat/reader.py", line 71, in reads
nb_dict = parse_json(s, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/nbformat/reader.py", line 21, in parse_json
raise NotJSONError(("Notebook does not appear to be JSON: %r" % s)[:77] + "...") from e
nbformat.reader.NotJSONError: Notebook does not appear to be JSON: '#+TITLE: Econometría Aplicada. Lección ...

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

That is not an error I have seen before. Can you send me a small org-file that does this and the ipynb it produced?

I am traveling until next Tue, and can take a look at it when I get back.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Of course...
Example.zip
... and thank you again.

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

When I export your org file to slides, this is what launches. I am not sure why it doesn't work for you.

image

I am using a pretty current version of Python (3.11) and packages. I don't know if that has anything to do with it.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

This is another example...

AnotherExample.zip

??

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

For the AnotherExample I saw these things:

  1. The html page is white (blank) when I try to open it.
  2. If I run jupyter nbconvert LE03.ipynb --to slides --post serve I see this in my browser:
image 3. From the org-file I get the same thing from C-c C-e ns.

That makes me think the problem is on the nbconvert side. I am using nbconvert 7.16.4 I think, and you have 6.5.3.

Can you see if you can open the ipynb in jupyter fine, e.g.

jupyter lab LE03.ipynb

If that opens with no error, then I guess it is an nbconvert issue. if there is an error, maybe the error is deeper in jupyter.

Also make sure that C-c C-e no makes and opens a notebook without error.

Another thing I noticed in the ipynb is the kernel was set to Python3. This happened probably because the first cell is elisp, so the language defaults to Python. You need to add this to your org file to fix it:

#+OX-IPYNB-LANGUAGE: jupyter-R

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Thank you very much again.

I have installed JupyterLab to do the checks you suggested. But now Scimax has stopped exporting the notebooks to Jupyter. When I try, I get the following error message in Emacs:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/notebook/traittypes.py", line 235, in _resolve_classes
klass = self._resolve_string(klass)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/traitlets.py", line 2015, in _resolve_string
return import_item(string)
^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/utils/importstring.py", line 33, in import_item
module = import(package, fromlist=[obj])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'jupyter_server.contents'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/jupyter-notebook", line 33, in
sys.exit(load_entry_point('notebook==6.4.12', 'console_scripts', 'jupyter-notebook')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/config/application.py", line 1073, in launch_instance
app = cls.instance(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/config/configurable.py", line 583, in instance
inst = cls(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/traitlets.py", line 1292, in new
inst.setup_instance(*args, **kwargs)
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/traitlets.py", line 1335, in setup_instance
super(HasTraits, self).setup_instance(*args, **kwargs)
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/traitlets.py", line 1311, in setup_instance
init(self)
File "/usr/lib/python3/dist-packages/notebook/traittypes.py", line 226, in instance_init
self._resolve_classes()
File "/usr/lib/python3/dist-packages/notebook/traittypes.py", line 238, in _resolve_classes
warn(f"{klass} is not importable. Is it installed?", ImportWarning)
TypeError: warn() missing 1 required keyword-only argument: 'stacklevel'

On the other hand, before installing JupyterLab, when I last exported one of the notebooks and got the message "Notebook validation failed," I tried marking one of the blocks as a slide inside the browser, then saved the file from the browser, and went back to Scimax. From Scimax, I tried to create the slides, and it did so without errors.
2ipynbFilesSavedFromScimaxAndFirefox.zip

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Ah!... and it seems that JupyterLab opens all the .ipynb files (but at this moment I can't test trying to generate an .ipynb from Scimax, see that I get the warning message, and then try to open it from JupyterLab).

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/notebook/traittypes.py", line 235, in _resolve_classes

is an error on the Python/Jupyter side. It either means ox-ipynb made a bad notebook, or the jupyter installation is not correct somehow.

there are a series of steps you can test to see where the problem lies. The first step is to try

M-x ox-ipynb-export-to-ipynb-buffer

this will show you the json that gets created. If this works without error then it means ox-ipynb works fine probably.

Next,

M-x ox-ipynb-export-to-ipynb-file

that saves the output to a file. You can check to see if you can open that file in a shell. All ox-ipynb does is call shell command like this "jupyter notebook file.ipynb"

For slides, all that happens is the org file is turned into an ipynb using the commands above, and then a shell command runs like jupyter nbconvert fname.ipynb --to slides --post serve

I think I see what is wrong in your scimax version. There are cells like

"outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": null
        }
      ],

The null should not be there. Can you send me the org-file that generated this ipynb so I can look into how that happened?

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Both the command "M-x ox-ipynb-export-to-ipynb-buffer" and the command "M-x ox-ipynb-export-to-ipynb-file" have worked without errors. Unfortunately, since I installed JupyterLab, the jupyter command doesn't work. When I execute "jupyter notebook file.ipynb," I get an error:

jupyter notebook Lecc03.ipynb
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/notebook/traittypes.py", line 235, in _resolve_classes
klass = self._resolve_string(klass)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/traitlets.py", line 2015, in _resolve_string
return import_item(string)
^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/utils/importstring.py", line 33, in import_item
module = import(package, fromlist=[obj])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'jupyter_server.contents'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/jupyter-notebook", line 33, in
sys.exit(load_entry_point('notebook==6.4.12', 'console_scripts', 'jupyter-notebook')())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/config/application.py", line 1073, in launch_instance
app = cls.instance(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/config/configurable.py", line 583, in instance
inst = cls(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/traitlets.py", line 1292, in new
inst.setup_instance(*args, **kwargs)
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/traitlets.py", line 1335, in setup_instance
super(HasTraits, self).setup_instance(*args, **kwargs)
File "/home/marcos/.local/lib/python3.11/site-packages/traitlets/traitlets.py", line 1311, in setup_instance
init(self)
File "/usr/lib/python3/dist-packages/notebook/traittypes.py", line 226, in instance_init
self._resolve_classes()
File "/usr/lib/python3/dist-packages/notebook/traittypes.py", line 238, in _resolve_classes
warn(f"{klass} is not importable. Is it installed?", ImportWarning)
TypeError: warn() missing 1 required keyword-only argument: 'stacklevel'

ConR.zip

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

something is not right in the jupyter installation, maybe it is version incompatibility.? This in particular ModuleNotFoundError: No module named 'jupyter_server.contents' indicates something is not completely installed.

I guess you get an error just running jupyter notebook?

Here are the settings I have that seem to work.

#+BEGIN_SRC sh
jupyter --version
#+END_SRC

#+RESULTS:
| Selected       | Jupyter |   core | packages... |
| IPython        | :       | 8.26.0 |             |
| ipykernel      | :       | 6.29.5 |             |
| ipywidgets     | :       |    not | installed   |
| jupyter_client | :       |  8.6.2 |             |
| jupyter_core   | :       |  5.7.2 |             |
| jupyter_server | :       | 2.14.2 |             |
| jupyterlab     | :       |    not | installed   |
| nbclient       | :       | 0.10.0 |             |
| nbconvert      | :       | 7.16.4 |             |
| nbformat       | :       | 5.10.4 |             |
| notebook       | :       |    not | installed   |
| qtconsole      | :       |    not | installed   |
| traitlets      | :       | 5.14.3 |             |

#+BEGIN_SRC sh
python --version
#+END_SRC

#+RESULTS:
: Python 3.11.4

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

This is what I get

#+BEGIN_SRC sh
jupyter --version
#+END_SRC

#+RESULTS:
| Selected | Jupyter | core | packages... |
| IPython | : | 8.5.0 | |
| ipykernel | : | 6.17.0 | |
| ipywidgets | : | 6.0.0 | |
| jupyter_client | : | 7.4.9 | |
| jupyter_core | : | 4.12.0 | |
| jupyter_server | : | 2.14.2 | |
| jupyterlab | : | 4.2.3 | |
| nbclient | : | 0.7.2 | |
| nbconvert | : | 6.5.3 | |
| nbformat | : | 5.5.0 | |
| notebook | : | 6.4.12 | |
| qtconsole | : | not | installed |
| traitlets | : | 5.14.3 | |

#+BEGIN_SRC sh
python3 --version
#+END_SRC

#+RESULTS:
: Python 3.11.2

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

With this

pip3 install --user notebook==6.5.6 --break-system-packages

taken from this
https://stackoverflow.com/questions/77549493/modulenotfounderror-no-module-named-jupyter-server-contents
now jupyter notebook runs.

So now:

  • Both the command "M-x ox-ipynb-export-to-ipynb-buffer" and the command "M-x ox-ipynb-export-to-ipynb-file" have worked without errors.
  • When I run "jupyter notebook file.ipynb" I get the same message than when I export the .org file to .ipynb using Scimax
  • When I run "jupyter nbconvert fname.ipynb --to slides --post serve" I get the same error than when I try to get the slides from Scimax
  • When I save the .ipynb file from firefox it, somehow, corrects the file... I can open it again (jupyter notebook file.ipynb) without any message about validation

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

I tried adding some logic in 352303a6 that might help. I think the problem is you are getting text: null entries, but that should not be possible I think (yet you see them, and I can't reproduce them). I guess that saving it must fix the issue, but I don't understand how you get it open in the first place if the error happens.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

I am traveling until next Sunday. I will explore a little more next week. Thank you again for your help. Marcos.

from scimax.

mbujosab avatar mbujosab commented on August 30, 2024

Hello again,

The problem arises when including as a header in a code block ":results silent :exports code".

In that case, the .ipynb file is generated, but when opened, Jupyter indicates that the notebook is invalid, and then it is not possible to generate the slides from the .ipynb file.

I am attaching two minimal examples. The difference between them is that in one, the header ":results silent :exports code" is specified, and in the other, it is not.

I am also attaching the .ipynb files generated in both cases.

(When the invalid file is opened in the browser and saved to the disk from the browser, the saved .ipynb file is somehow corrected. However, the one initially generated from scimax is invalid).

TwoExampleFiles.zip

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

Does that happen with the latest version of ox-ipynb? I am not able to reproduce these outputs on my end.

The problem is definitely this in the one that doesn't work:

"text": null

but that should not be possible with the new version I think.

from scimax.

jkitchin avatar jkitchin commented on August 30, 2024

Thanks for working through all the issues with me. I am glad we got it fixed!

from scimax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.