Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

Hello,

Trouble running Cadabra 2 and generating output with the system described below:

OS: WSL 2 [Windows Subsystem for Linux 2] Ubuntu 18.04 on Windows 10 x64

Python 3.7.7. Installation type: Anaconda 3

Cadabra2 download and installed using conda as per instructions

conda list cadabra packages in environment at /home/audrius/anaconda3: Name Version Build Channel cadabra2-jupyter-kernel 2.2.9 h6bb024c_0 kpeeters

conda list sympy packages in environment at /home/audrius/anaconda3: Name Version Build Channel sympy 1.5.1 py37_0

conda list jupyter packages in environment at /home/audrius/anaconda3: Name Version Build Channel cadabra2-jupyter-kernel 2.2.9 h6bb024c_0 kpeeters jupyter 1.0.0 py37_7 jupyter_client 6.1.2 py_0 jupyter_console 6.1.0 py_0 jupyter_core 4.6.3 py37_0 jupyterlab 1.2.6 pyhf63ae98_0 jupyterlab_server 1.1.0 py_0

Is there another conda package or packages that I should check?

Using the MS VS Code IDE, I start the Jupyter server, select the "Cadabra" kernel option. I then run the cell containing the example code from "Using Cadabra for tensor computations in General Relativity" by L. Brewin, "1. Hello metric connection", but no output is generated, just a new cell is created. Also, the Cadabra kernel state stays "Idle".

I've attached a screenshot below:

VS Code IDE. Cadabra kernel

in Installation trouble by

That's a combination I had not tried yet... ;-) Have you tried whether running it using Jupyter's own notebook server works? (so starting with 'jupyter notebook' and then using the web browser notebook interface? I suspect the answer is that that does not work either, but I'd like to have it confirmed before we dig any further.

1 Answer

+1 vote

"Have you tried whether running it using Jupyter's own notebook server works?"

No, I had not done so.

While WSL 2 is a fully functional Linux OS, not an emulator, it is command-line only - there is no GUI desktop and no browser. With a addition of an X-server on the Windows 10 side, such as VcXsrv, one can display matplotlib output, in a separate window, generated in VS Code running on WSL side.Which is more than sufficient for scientific computing using numpy/sympy/numba/etc.

[update in following comment]

by (220 points)
edited by

If you are trying anything with Cadabra + Jupyter, please look at https://cadabra.science/jupyter.html , as there is now a new Jupyter kernel which no longer requires Xeus (only Python plus the cadabra2 python module). May make life easier.

Please take WSL-specific discussions which do not relate to VSCode to https://cadabra.science/qa/1811/installation-on-windows-subsystem-for-linux-wsl ; in short, I have verified that Cadabra (cli, jupyter and notebook interface) work with WSL2, but there are still a few rough edges.

I am using WSL2. Unfortunately I don't know the difference between MS and Code.

To be more specific about the symptoms, what I find is that jupyter does give the New>Cadabra2 option when creating a new project, but then the kernel gets stuck whenever I evaluate something.

You most likely need to set the PYTHONPATH before you start jupyter notebook:

export PYTHONPATH=${PYTHONPATH}:/usr/lib/x86_64-linux-gnu/python3.6/site-packages

That's for Ubuntu 18.04; for others you may need to adjust the python version in the above path. The problem is not that the kernel hangs, but that it cannot start the kernel at all, because it cannot find required package which is located at the path above.

I confirm: the magical command works like a charm on Ubuntu 18.04 with Python 3.6!!! Can I stick this in the bashrc file and never think about this again?

Yes, you can.

...