# LFortran: When is the next release? Can I get a "WebAssembly" app?

**URL:** <https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941>\
**Category:** LFortran\
**Created:** [December 6, 2023, 10:17pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941 "2023-12-06T22:17:52Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielc](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/danielc/32/3774_2.png) [@danielc](https://fortran-lang.discourse.group/u/danielc)\
**Post date:** [December 6, 2023, 10:17pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/1 "2023-12-06T22:17:52Z")

</div>

Early next year I plan to do a mini “intro to Fortran” course for the grad students in my group. I would love to use LFortran for this. I just have two questions:

(1) The [web app](https://dev.lfortran.org/) on the LFortran website supports arrays. The LFortran that I installed with Conda does not. Do I just need to wait for the next release? If so, when is that likely to happen?

(2) I like the Jupyter notebook that came with LFortran, but I like the web app on the LFortran website better. That one lets me show `program` and `module`. Is there a way that I can get a web app like that one?

Thanks.

---

<div class="post-metadata">

**Author:** ![Pap](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/pap/32/1305_2.png) [@Pap](https://fortran-lang.discourse.group/u/Pap)\
**Post date:** [December 6, 2023, 10:49pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/2 "2023-12-06T22:49:05Z")

</div>

> [@danielc](#):
>
> (1) The [web app](https://dev.lfortran.org/) on the LFortran website supports arrays. The LFortran that I installed with Conda does not. Do I just need to wait for the next release? If so, when is that likely to happen?

Arrays are supported. Can you give a short example that doesn’t seem to work? Also, what version did you install?

---

<div class="post-metadata">

**Author:** ![danielc](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/danielc/32/3774_2.png) [@danielc](https://fortran-lang.discourse.group/u/danielc)\
**Post date:** [December 6, 2023, 11:15pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/3 "2023-12-06T23:15:35Z")

</div>

> [@Pap](#):
>
> Arrays are supported. Can you give a short example that doesn’t seem to work? Also, what version did you install?

This is interesting… When I set out to write a short sample I discovered that it is a bug in the Jupyter notebook kernel, but not LFortran itself.

Ok. So I start a Jupyter notebook and I type in the following:

```fortran
real :: x ! Ok.
x = 5.0 ! Ok.
real :: y ! Ok. I can declare more variables.
y = 2.5 ! Ok.
real :: a(10) ! ERROR

```

The error reads

“ **Kernel Restarting:**  
The kernel for Test\_LFortran.ipynb appears to have died. It will restart automatically.”

The error in the terminal reads:

_ **ERROR: received bad message: No such comm registered: b2f636d2-67fc-4cb3-a724-13ecaed50955** _  
_ **Message type: comm\_msg** _

Incidentally, I discovered I didn’t have clang installed and I needed it. I have no idea how the Jupyter notebook was able to run without clang installed. But when I tried to compile a program with `lfortran example.f90`, I got an error that I didn’t have Clang. I installed Clang, and then the program (with an array) compiled and ran correctly.

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [December 6, 2023, 11:59pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/4 "2023-12-06T23:59:41Z")

</div>

> [@danielc](#):
>
> Early next year I plan to do a mini “intro to Fortran” course for the grad students in my group. I would love to use LFortran for this.

I think this has to be done carefully, not to alienate students that potentially already have experience with other programming languages or tools.

When Julia was launched initially in 2012, I remember reading their “manifest”: [Why We Created Julia](https://julialang.org/blog/2012/02/why-we-created-julia/). As good as it sounded, I rewrote one of my Fortran programs in Julia, only to discover it was a factor of 15-20 times slower. (I’m sure that today, a capable Julia programmer would get my program running on GPU in no time.) In any case I wasn’t convinced, and later I read stories that things were prone to breakage, and I think one of the MIT lecturers used the analogy of Julia being the “wild west”. In the end I decided it was not worth my time. The stable version, 1.0.0, arrived in 2018.

What I’m trying to say is you shouldn’t overpromise.

On the other hand I think WebAssembly could become a fantastic platform for a certain class of scientific and engineering applications, including some written in Fortran. There is some overlap between Fortran and the “official” [WebAssembly Use Cases](https://webassembly.org/docs/use-cases/). The obstacle as I see it for myself (and I suppose other Fortran programmers too) is how to do the “Web” part, i.e. bind the Fortran program (compiled to WebAssembly) to the page elements, be it a simple terminal, or a GUI of sorts.

---

<div class="post-metadata">

**Author:** ![danielc](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/danielc/32/3774_2.png) [@danielc](https://fortran-lang.discourse.group/u/danielc)\
**Post date:** [December 7, 2023, 12:13am UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/5 "2023-12-07T00:13:49Z")

</div>

> [@ivanpribec](#):
>
> I think this has to be done carefully, not to alienate students that potentially already have experience with other programming languages or tools.  
> …  
> What I’m trying to say is you shouldn’t overpromise.

Ok. So you’re thinking in terms of a student thinking “_Oh, this is just as easy as Python/Jupyter notebooks_” only to discover that LFortran isn’t even beta yet?

I was planning to just say that “the Jupyter notebook that we’re using is from a project that’s in development and it doesn’t support all the features of Fortran, but it has just enough features for today’s tutorial”.

But perhaps I should just use GFortran.

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [December 7, 2023, 12:27am UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/6 "2023-12-07T00:27:20Z")

</div>

I guess it depends what type of class of students it is.

I once taught a tutorial on Python and Jupyter, which started with me giving the the students a sheet of exercises they could do in the REPL (starting from simple arithmetic expressions, creatings lists, printing, and just getting used to the Jupyter UI). One of the students approached me in the break, terrified, that I expect them to just start using the REPL without any proper lecture beforehand. (This was a class of food process engineers.)

> [@danielc](#):
>
> I was planning to just say that “the Jupyter notebook that we’re using is from a project that’s in development and it doesn’t support all the features of Fortran, but it has just enough features for today’s tutorial”.

As long as you test the elements you need before-hand that sounds reasonable to me.

Although the times I’ve been able to trigger internal compiler errors, was always when I didn’t actually know the syntax. So in this sense a fresh class of students might as well be LFortran’s best friend 🙂

---

<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:** [December 7, 2023, 3:21pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/7 "2023-12-07T15:21:49Z")

</div>

The Jupyter kernel has some bugs that we will fix later. First we are focusing on compilation to binaries, locally using LLVM. You can use Conda package for that. Our status is still in alpha, meaning it is expected to break. You can follow our progress at [https://lfortran.org/](https://lfortran.org/), we are at 4/10 towards beta. Beta meaning it will be expected to work on your code. That being said, depending on which features you use, you might very well find the current alpha version of LFortran very usable already today. It does compile all of [dftatom](https://github.com/certik/dftatom) for example and that code uses a lot of Fortran and a lot of arrays and for numerical computing that might be enough.

---

<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:** [December 7, 2023, 3:47pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/8 "2023-12-07T15:47:35Z")

</div>

Regarding what @ivanpribec said about alienating new users and students: I agree. I would recommend using the most mature open source compiler, which is GFortran. And then you can say if you are adventurous, you can try LFortran, and every bug you discover should be celebrated like a Christmas present and reported with joy.

Regarding our plans, here they are, in terms of priority:

- Get LFortran running locally to compile every project to a binary and work correctly
- Get the interactive version (Jupyter kernel) working for all of Fortran
- Get the online WASM version ([https://dev.lfortran.org/](https://dev.lfortran.org/)) working for all Fortran features
- Create a new WASM based kernel that runs fully in the browser and works with JupyterLite ([GitHub - jupyterlite/jupyterlite: Wasm powered Jupyter running in the browser 💡](https://github.com/jupyterlite/jupyterlite)), that will allow you to use Fortran in the browser inside Jupyter (lite) without needing to host a server, just a static page is enough. For teaching students this will be the most robust, fastest and easiest solution. If anybody is interested in developing a prototype of this, let me know.

---

<div class="post-metadata">

**Author:** ![danielc](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/danielc/32/3774_2.png) [@danielc](https://fortran-lang.discourse.group/u/danielc)\
**Post date:** [December 7, 2023, 6:11pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/9 "2023-12-07T18:11:46Z")

</div>

> [@certik](#):
>
> The Jupyter kernel has some bugs that we will fix later. First we are focusing on compilation to binaries, locally using LLVM.

How about that WebAssembly page? Can I get one of those? I actually like the WebAssembly page better for my needs and can verify that it supports arrays.

---

<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:** [December 7, 2023, 7:23pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/10 "2023-12-07T19:23:35Z")

</div>

> [@danielc](#):
>
> How about that WebAssembly page?

Are you talking about [https://dev.lfortran.org/](https://dev.lfortran.org/) ? Yes, this page doesn’t use the Jupyter kernel feature, it runs LFortran fully in WASM and uses our WASM backend (not LLVM) to compile your code to WASM and run it. I have to warn you that our WASM backend is not as advanced as our LLVM backend, so you will discover more limitations.

> [@danielc](#):
>
> Can I get one of those? I actually like the WebAssembly page better for my needs and can verify that it supports arrays.

Yes, you can either use the link above, or even host/modify your own version, the source code is here:

[GitHub - lfortran/lcompilers\_frontend: The sources of the web LFortran GUI interface](https://github.com/lfortran/lcompilers_frontend)

---

<div class="post-metadata">

**Author:** ![danielc](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/danielc/32/3774_2.png) [@danielc](https://fortran-lang.discourse.group/u/danielc)\
**Post date:** [December 8, 2023, 4:05am UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/11 "2023-12-08T04:05:14Z")

</div>

> [@certik](#):
>
> Yes, you can either use the link above, or even host/modify your own version, the source code is here:
> 
> [GitHub - lfortran/lcompilers\_frontend: The sources of the web LFortran GUI interface](https://github.com/lfortran/lcompilers_frontend)

Thanks! I got it working. I had some trouble, actually, so I just want to let you know about it:

```plaintext
% ./build.py
+ curl "https://lfortran.github.io/wasm_builds/release/c82debe8b/lfortran.js" -o public/lfortran.js
...
+ curl "https://lfortran.github.io/wasm_builds/release/c82debe8b/lfortran.wasm" -o public/lfortran.wasm
...
+ curl "https://lfortran.github.io/wasm_builds/release/c82debe8b/lfortran.data" -o public/lfortran.data
...
+ npm run build

> lcompilers_frontend@0.1.0 build
> next build

/tmp/build-0cf654b0.sh: 1: next: not found
Command failed.

```

I don’t know why that happened, but I tried again as root, and that seemed to help. Next error was that I don’t have `npm`, so I installed it and tried again. Then I got an error that I don’t understand:

```plaintext
% sudo ./build.py     
+ curl "https://lfortran.github.io/wasm_builds/release/c82debe8b/lfortran.js" -o public/lfortran.js
...
+ curl "https://lfortran.github.io/wasm_builds/release/c82debe8b/lfortran.wasm" -o public/lfortran.wasm
...
+ curl "https://lfortran.github.io/wasm_builds/release/c82debe8b/lfortran.data" -o public/lfortran.data
...
+ npm run build

> lcompilers_frontend@0.1.0 build
> next build

sh: 1: next: not found
Command failed.

```

I have no idea what that means. I googled for the error and someone on StackOverflow had suggested running `sudo npm install`, so I did that. I have no idea what I did, but that seemed to move things forward a bit:

```plaintext
> lcompilers_frontend@0.1.0 build
> next build

Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
info - Checking validity of types  
error - ESLint: Failed to load plugin '@next/next' declared in '.eslintrc.json » eslint-config-next/core-web-vitals » /home/daniel/Volatile/Weave/lcompilers_frontend/node_modules/eslint-config-next/index.js': Unexpected token '.' Referenced from: /home/daniel/Volatile/Weave/lcompilers_frontend/node_modules/eslint-config-next/index.js
Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
info - Creating an optimized production build  
info - Compiled successfully
info - Collecting page data  
info - Generating static pages (3/3)
info - Finalizing page optimization  

Page Size First Load JS
┌ ○ / (1851 ms) 39.1 kB 197 kB
├ /_app 0 B 158 kB
└ ○ /404 193 B 158 kB
+ First Load JS shared by all 158 kB
  ├ chunks/framework-4556c45dd113b893.js 45.2 kB
  ├ chunks/main-fc7d2f0e2098927e.js 28.7 kB
  ├ chunks/pages/_app-67a23d0d9717a0da.js 82 kB
  ├ chunks/webpack-6b5bb26bc3b9b58d.js 1.84 kB
  └ css/84c162364c63a3e3.css 67.3 kB

○ (Static) automatically rendered as static HTML (uses no initial props)

```

Notice that there is an “error” line up there. I don’t know what ESLint is, but I assume it must be a linter for EcmaScript. I ignored the error and tried to run `npm run dev` and it ran.

---

<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:** [December 8, 2023, 3:39pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/12 "2023-12-08T15:39:37Z")

</div>

@danielc great, I am glad you got it working. It’s deployed automatically by the CI: [lcompilers\_frontend/.github/workflows/deploy.yml at 7ca67f7906a6a68db6884fa11304c6425c112393 · lfortran/lcompilers\_frontend · GitHub](https://github.com/lfortran/lcompilers_frontend/blob/7ca67f7906a6a68db6884fa11304c6425c112393/.github/workflows/deploy.yml), so you can always consult that to get working instructions.

In order to get smoother build experience, follow the README, which uses Conda to setup an environment that should just work. If not, go ahead and report a bug, or send us a PR with a fix.

---

<div class="post-metadata">

**Author:** ![danielc](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/danielc/32/3774_2.png) [@danielc](https://fortran-lang.discourse.group/u/danielc)\
**Post date:** [December 8, 2023, 5:51pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/13 "2023-12-08T17:51:48Z")

</div>

> [@certik](#):
>
> In order to get smoother build experience, follow the README, which uses Conda to setup an environment that should just work. If not, go ahead and report a bug, or send us a PR with a fix.

Wait… that’s not what I did?

I was literally following the steps in the README, right at the top, under the heading “Getting Started”:

```plaintext
conda env create -f environment.yml
conda activate npm
npm install
./build.py
npm run dev
# ... open http://localhost:3000 ...

```

Those are the steps in the README, no?

---

<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:** [December 8, 2023, 6:19pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/14 "2023-12-08T18:19:26Z")

</div>

Yes, if you did the `conda activate` parts, then it’s correct. I didn’t see those in your post. Also you should not need sudo.

Go ahead and open up an issue with the errors that you are getting. Either our instructions are incorrect or there are some bugs in the build system on some platforms.

---

<div class="post-metadata">

**Author:** ![danielc](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/danielc/32/3774_2.png) [@danielc](https://fortran-lang.discourse.group/u/danielc)\
**Post date:** [December 8, 2023, 9:55pm UTC](https://fortran-lang.discourse.group/t/lfortran-when-is-the-next-release-can-i-get-a-webassembly-app/6941/15 "2023-12-08T21:55:05Z")

</div>

> [@certik](#):
>
> Also you should not need sudo.

Yeah. That wasn’t great either. But the `./build.py` step and the `npm ...` steps would not work without sudo.

> [@certik](#):
>
> Go ahead and open up an issue with the errors that you are getting. Either our instructions are incorrect or there are some bugs in the build system on some platforms.

Sure. I’ll do that when I get home so I can copy-paste the output.
