Installing FEniCSx on Windows 11

I have an HP Pavilion Laptop:
Processor AMD Ryzen 7 5700U with Radeon Graphics 1.80 GHz
64 GB RAM, 64-bit operating system, x64-based processor
Windows 11 Home Version 23H2
My understanding is that I can only install FEniCSx by first installing a Linux simulator WSL2, which I have not yet done.

  1. Will running FEniCSx programs from a Linux simulator slow down calculations as compared to running them from a Linux operating system?
  2. I already have Python and Anaconda installed in my Windows system. Will I need to reinstall them a second time using WSL2? If I have to access FEniCSx environments through WSL2, can I switch back and forth between python environments in Windows and those in WSL2?
  3. Does FEniCSx interact with the operating system only during installation or also when assembling and running programs?
  4. I am used to using Spyder instead of Jupyter for python programming. Will I need to learn how to use Jupyter to be more efficient in FEniCSx?
  5. I would prefer to do the installation without using Docker, primarily because I don’t want to have to learn about Docker if I can do this stuff using the tools I am familiar with, such as conda. Am I making my life much more difficult?
    Thanks for your help.

Not significantly

You would have to reinstall Python and conda on the subsystem if you plan to use it there.

FEniCSx will use the Python and C compiler in the subsystem when running.

No. Spyder, vscode, jupyter etc are IDEs. One should use whatever one is comfortable with.

Not necessarily. The only thing docker can do that conda cannot is to use the nightly branches of dolfinx, ffcx, Basix and ufl, while conda is bound to the releases (0.5,0.6,0.7 etc).

Thanks for your quick response. What do you mean by nightly branches?

The fenics project is developed on git, where we have main branches where new features are Added. These are installed into docker images on a nightly basis. We usually make releases 2 times a year, which will be published on conda and the ubuntu ppa

1 Like

As I read more, it appears to me that I have two choices for running FEniCSx on a Windows machine. The first is to install WSL and download FEniCSx in a Linux environment. The second is to use Docker. Does Docker avoid the need for WSL? If so, then I have a choice of learning how to work in Docker or learning how to work in Linux via WSL. What are the pros and cons of these two approaches? My apologies if this is already documented somewhere.
I am currently looking at “Solving PDEs in Python The FEniCS Tutorial I”

Is this link up to date?

More generally, can someone explain to me why FEniCSx is available on Linux and Macs, but not directly available on Windows operating systems? Does this have to do with properties of the operating systems? If so, what are the critical differences here?

It is not available on Windows due to the usage of PETSc for linear algebra.

There is a medium term goal of having petsc as an optional dependency, meaning that one could build directly on Windows
Make PETSc an optional dependency · Issue #2472 · FEniCS/dolfinx · GitHub

Regarding docker on Windows, see

and

Docker frequently asked questions (FAQ) | Docker Docs.

I have now succeeded in downloading FEniCSx so that I can run the tutorials on my machine. However, my system is not very robust and still has a number of problems, so that I don’t consider this an ideal working environment for learning or developing software. I will describe the issues here, and perhaps there are better ways to surmount these problems. If not, at least others should be aware of them. There is a lot to cover here, so I will not document all of the details, although I can provide most of them if requested. The details of my machine are given at the top of this thread.

The download of wsl2 on my windows machine was easy and occurred without problems. However, wsl2 does not support GUI applications in the form that you get it. I want to use anaconda-navigator and, more importantly, spyder, both of which need a GUI. You need to download some additional software if you want to run Linux GUIs on wsl2, and the hard part is getting all of the dependencies set up properly. Here is the link on the needed software

Here is a link on getting anaconda-navigator set up in Linux.

https://www.addictivetips.com/ubuntu-linux-tips/how-to-install-anaconda-on-ubuntu/

When I followed these instructions, things still weren’t working properly and I was getting diagnostics, which led me to start googling. A lot of people are encountering these problems, and most of them report using trial-and-error solutions. After looking through these, I eventually found enough to clear up my problems so that anaconda-navigator and spyder are running on a Linux GUI. However, the execution is not very robust, and it seems to lock up at times. Furthermore, I don’t know how to link spyder up so that I can execute my programs from a spyder console. Most importantly, I don’t know how to use the spyder debugger. Can anyone help me with these issues?

Would using docker circumvent these problems? The main issue I need to clear up is how to get spyder consoles to execute programs and debug them.

Follow-up. It seems now that spyder opens in wsl2 and responds to the keypad, but not to the mouse. Here is a picture of the command I use to open spyder

Here is my spyder version


Any suggestions?

Straightforwardly, a good learning attitude to start with is to run your code with a Linux machine as FEniCS(x) depends on Linux-only package PETSc.

I would strongly suggest to install FEniCS(x) even on a second-hand Linux machine with one-line bash command ($ conda install ...). Then download an official example code and give it go to see if the whole thing works fine. If you further want to have some visualization and nice GUI, use your Windows PC with ssh tools installed to connect the Linux machine, such as VS Code, Paraview, Xterm, etc.

For windows, it does support Linux with WSL, but just with a minimal configuration, i.e. you may loss many important pacakges, so that you would find it is very difficult to start even with a very simple code as that on Linux.

Thanks for your suggestions. I have installed wsl2 on my laptop and in the Ubuntu environment I have installed fenicsx. I can run examples from a terminal, but I want an editor with a debugger. I have installed spyder in wsl2, but I can’t get it to work, so I have given up and I am working with VS code instead. Even this is challenging. I have installed the python extension, and I would like to get it to run python codes and debug them, but I need to set this up. Can you recommend a website that can help me with this?

Seems like I have this up and running. Learning to use the debugger in VS code will require some patience.

I think I’m ready to close this thread, but it may be worth summarizing what I learned here, in case anyone else wants to go down the same path.

  1. If you have a windows pc, you can only run FEniCSx by installing wsl2, which is the Windows Subsystem for Linux. Unfortunately, wsl2 does not come with GUI capabilities. Thus, if you want to run anaconda-navigator or spyder in wsl2, you will have to download extra software that depends on your specific processor. I was never able to get this to work properly and eventually abandoned the effort. Instead I worked with command line conda to do my installations in wsl2 Ubuntu.
  2. The simplest approach is to use VS code, which can be installed in Windows and used in wsl2 to run python and to debug python code. Once you get VS code installed, you also need to install some extensions to do python programming and debugging. This can be done within the VS code program. All of this takes some time, trial and error and a lot of googling to get it to work. You can also install jupyter extensions in VS code to run the FEniCSx tutorials.

I just figured out how to connect spyder to wsl2. You don’t need to install spyder in linux. You can use the spyder you have running in windows to access and run files in wsl2. See the following reference for instructions
https://docs.spyder-ide.org/current/faq.html?highlight=run%20cell

1 Like

Sigh! The above connection to spyder is buggy and doesn’t work. Seems to have been documented

but never resolved. Will have to go back to VS code and work without spyder