Message Boards Message Boards

How to convert Mathematica notebook to Jupyter notebooks and vice versa?

Posted 2 years ago

Hi,
Is there a way to convert Mathematica notebooks to jupyter notebooks and vice versa? If you are writing lecture notes using jupyter notebooks is a better option. However, in doing calculations Mathematica notebook is superior. If there is a simple conversion between two of them it would be very useful.

POSTED BY: virtual mind
12 Replies
Posted 2 years ago

This should be a feature since it is what the ML community uses!

Converting a WL notebook to a Jupyter notebook and running the Jupyter server (with the free developer Wolfram Engine kernel) is currently the only way to truly share the WL notebook with people in the ML community without making them signup and learn Mathematica.

Please petition WRI to add export and import from WL <-> Jupyter notebooks.

POSTED BY: Ethan Black
Posted 2 years ago

Unfortunately, this is not possible, you have to learn Mathematics because it is better in my opinion. Besides that for my writings I use https://sunnypapers.com/paper-samples/lord-of-the-flies/ because there are funny topics like Lord of the flies here)) This amuses me, especially because from here you can get a lot of information that will look pretty good for my project.

POSTED BY: Pablo Santiago
Posted 2 years ago

Anton- Thanks for the reply!

What about the other way around? Mathematica to Jupyter?

I'll go one step further and ask if you can do the conversion without Mathematica?

I have a bunch of old Mathematica notebooks that I'm now trying to use in Jupyter + Wolfram Engine. I no longer have Mathematica, so I can use the notebook tools.

POSTED BY: Troy H

Easy!

  1. Convert Mathematica notebook to Markdown file using M2MD.

    • Needs Mathematica.
  2. Convert Markdown file to Jupyter notebook using jupytext.


I have requested recently to be able to run M2MD without Mathematica -- see the issues of that GitHub repository. (I.e. using WolframEngine and/or wolframscript.)

POSTED BY: Anton Antonov
Posted 2 years ago

And if I don't have Mathematica?

POSTED BY: Troy H
Posted 4 months ago

Hi Anton,

Is it possible to convert this Python code to Mathematica? Unfortunately, I don't know Python.

All the best, Alex

POSTED BY: Alex Teymouri

Yes, fairly easy using recent Large Language Models (LLMs):

  • Mathematica / WL is very well documented
  • Python has a very good "foot print" on the Web

See the attached screenshot.

enter image description here

POSTED BY: Anton Antonov
Posted 2 years ago

I'm going to second this question....I have some old Mathematica notebooks that I want to revisit using Jupyter Notebooks + Wolframe Engine. It would be helpful if I didn't have to rewrite the Mathematica notebooks.

POSTED BY: Troy H

Easy!

  1. Download the Jupyter notebook as Markdown file.
    • Alternatively, use jupytext to convert ".ipynb" files into ".md" files.
  2. Use the Markdown-to-Mathematica converter.
POSTED BY: Anton Antonov
Posted 2 years ago

Markdown language is easy to use for writing notes. Even though mathematical notebooks offer lots of features in the format of the text I guess it is behind the simplicity of the markdown language. Besides, more importantly, not everyone in our group has a license for Mathematica. Hence some of us are using the wolfram kernel via jupyter notebooks. It would be better if the conversion was possible.

POSTED BY: virtual mind
Posted 2 years ago

Curious why you think Jupyter is a better option for writing lecture notes.

POSTED BY: Rohit Namjoshi

No. At least not in an easy way. The Mathematica notebook is much more advanced.

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract