Can we run Ngsolve on Google Colab?

I run my Ngsolve code on my computer, but it looks very slow.
I wonder if we can run it on Google Colaboratory or something like that?
If so, how could we install it online?
Thank you so much.

Hi Dong,

we are pushing now for NGSolve cloud installations, which is particularly useful for teaching.

Yes, you can install NGSolve also on google colab, like on Ubuntu. Execute in a code cell:

!apt-add-repository universe
!add-apt-repository ppa:ngsolve/ngsolve -y
!apt-get install ngsolve

However, the new webgui is not supported on google colab.

What do you mean with so slow on your notebook ? Are you running out of memory ?
Can you provide some example with timings ?
The common free cloud environments are typically not faster than recent desktop computers or notebooks…


Thank you so much for your reply.

Yes, I’m running out of memory and it was frozen. My computer configuration is not strong enough.

My notebook below took me about 10 minutes of running on my laptop while it took 2 minutes on the computers in my school. Maybe I should get a new computer. So I think using cloud computer is better for me.

I did as you suggested. It run smoothly when installing, but I had a error when importing Ngsolve

ImportError: Python version mismatch: module was compiled for Python 3.6, but the interpreter version is incompatible: 3.7.12 (default, Sep 10 2021, 00:21:48) [GCC 7.5.0]..

Could you please tell me how to solve this error?

Here is my Colab Notebook with that error.

The same error appeared when I tried with this example on Ngsolve Tutorial website.

I have a similar issue with Dong. Following your suggestion, but when I imported Ngsolve, I have encountered the following error.
" No module named ‘ngsolve’ "

Here is my Notebook with this error.

Could you please help me to solve this error?
Your guidance will be valuable.

Hi Fbox,

you. may try NGSolve on colab from the fem-on-colab collection:

Big thank to Francesco Ballarin for providing this collection !

best, Joachim

Thanks for your suggestion.