# LFortran + Jupyterlite + Fplotlib

**URL:** <https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289>\
**Category:** Uncategorized\
**Created:** [November 10, 2026, 12:23am UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289 "2026-11-10T00:23:02Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fxm](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/fxm/32/5726_2.png) [@fxm](https://fortran-lang.discourse.group/u/fxm)\
**Post date:** [November 10, 2026, 12:23am UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/1 "2026-11-10T00:23:02Z")

</div>

Since [LFortran now works in Jupyterlite](https://fortran-lang.discourse.group/t/lfortran-works-in-jupyterlite/11145) and `fplotlib` is now very usable, I had to take advantage of that. I compiled `fplotlib` alongside other modules, included it in the WASM host environment, and now have 3 notebook drafts(!) using it. Some of it is a bit hastily put together, but I was keen to just go ahead and do it.

Thanks @certik, @hkvzjal, and all others who worked on any of it.

> **[C3 - Climate, Code, Computation](https://climate-dynamics.net/learn/c3/lab/index.html)**
>
> WASM powered Jupyter running in the browser.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [November 10, 2026, 12:49am UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/2 "2026-11-10T00:49:20Z")

</div>

And [Anutosh](https://github.com/anutosh491) !

There is a really annoying bug that the kernel takes several minutes to load for me, and I haven’t had time to fix it yet. But once it loads, it works! I see some spurious warning when plotting, but we’ll iron everything out. If you can isolate all these bugs and create issues, we’ll fix it quickly.

The plots look great! Just like matplotlib.

Can you document somewhere how you put it together? We need to streamline it and make it super simple for anyone to ship their codes + dependencies as jupyterlite wasm static pages. And we need to make everything fast, but we will. Did you compile LFotran in Release mode or Debug mode?

---

<div class="post-metadata">

**Author:** ![fxm](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/fxm/32/5726_2.png) [@fxm](https://fortran-lang.discourse.group/u/fxm)\
**Post date:** [November 10, 2026, 1:29am UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/3 "2026-11-10T01:29:00Z")

</div>

I haven’t changed much, so it’s compiled in Debug mode. I’ll play with it some more and try to isolate/report problems I run into. Basically, I just:

- Created separate folders for the notebooks and the fplotlib source files,
- Added relative paths to the notebooks to `[feature.lite.tasks.lab-build]` in `pixi.toml` in the lfortran root folder (appending ` --contents ../c3/source/wildfire_euler/fortran/wildfire_euler_f90.ipynb`, for example),
- Added compilation instructions for all fplotlib modules in `wasm-build0.sh` in correct order. That’s not ideal or quick, of course.

So it’s a bit fiddly. Ideally, it would be as simple as adding a folder for notebooks and external modules. I think it would lower the barrier significantly if people didn’t have to think about what’s actually happening in the process.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [November 10, 2026, 1:57am UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/4 "2026-11-10T01:57:44Z")

</div>

Can you submit a Draft PR with what you have?

I’ll figure out how to polish it and clean it up. Yes, you definitely need to compile in Release mode, so that it runs faster.

---

<div class="post-metadata">

**Author:** ![hkvzjal](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/hkvzjal/32/3055_2.png) [@hkvzjal](https://fortran-lang.discourse.group/u/hkvzjal)\
**Post date:** [November 10, 2026, 5:53am UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/5 "2026-11-10T05:53:38Z")

</div>

Couldn’t FPM be used in this process to manage the packages? I’m thinking about using the local registry functionality that allows declaring where do packages exist locally with config.toml file and it will take care of building

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [November 10, 2026, 6:13am UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/6 "2026-11-10T06:13:06Z")

</div>

Yes, we have allow using fpm, that’s obvious, since if you want to include an fpm package with lots of dependencies, we want to piggy back on fpm. We can implement any feature we want in fpm to make this easy.

---

<div class="post-metadata">

**Author:** ![fxm](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/fxm/32/5726_2.png) [@fxm](https://fortran-lang.discourse.group/u/fxm)\
**Post date:** [November 10, 2026, 8:44am UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/7 "2026-11-10T08:44:51Z")

</div>

Using fpm in the wasm-build script with the same version of lfortran was my first go-to. I ran into some issues and just wanted to see some results quickly, so I did it rather inelegantly instead.

I can create a PR to show where I changed what.

---

<div class="post-metadata">

**Author:** ![fxm](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/fxm/32/5726_2.png) [@fxm](https://fortran-lang.discourse.group/u/fxm)\
**Post date:** [November 10, 2026, 12:54pm UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/8 "2026-11-10T12:54:05Z")

</div>

I submitted a [draft PR](https://github.com/lfortran/lfortran/pull/17438) for documentation (none of this is a real solution; it’s just brute-forcing it).

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [November 10, 2026, 1:48pm UTC](https://fortran-lang.discourse.group/t/lfortran-jupyterlite-fplotlib/11289/9 "2026-11-10T13:48:30Z")

</div>

Got it — you simply include the precompiled `.mod` files as we do with the other demo files. This is actually good and I am happy it works!

Probably the next step is to now get it working with fpm, and fix all bugs.
