Install FEniCS via WSL for Ubuntu 20.04

Hello everyone,
I use Windows 10 and I want to run FEniCS.
I have installed WSL for Ubuntu 20.04, then I use the following command:

sudo add-apt-repository ppa:fenics-packages/fenics

and the system tells me that

    This PPA provides packages for the FEniCS project.
    To use this PPA, please follow the instructions at http://fenicsproject.org.
    More info: https://launchpad.net/~fenics-packages/+archive/ubuntu/fenics
    Press [ENTER] to continue or Ctrl-c to cancel adding it. 
    Hit:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal InRelease
    Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates InRelease [107 kB]
    Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-backports InRelease [98.3 kB]
    Get:4 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security InRelease [107 kB]
    Ign:5 http://ppa.launchpad.net/fenics-packages/fenics/ubuntu focal InRelease
    Err:6 http://ppa.launchpad.net/fenics-packages/fenics/ubuntu focal Release
      404  Not Found [IP: 91.189.95.83 80]
    Get:7 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 Packages [127 kB]
    Get:8 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main Translation-en [48.1 kB]
    Get:9 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 c-n-f Metadata [3160 B]
    Get:10 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/restricted amd64 Packages [8268 B]
    Get:11 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/restricted Translation-en [2360 B]
    Get:12 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 Packages [70.1 kB]
    Get:13 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe Translation-en [29.8 kB]
    Get:14 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/universe amd64 c-n-f Metadata [2476 B]
    Get:15 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 Packages [75.8 kB]
    Get:16 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main Translation-en [29.6 kB]
    Get:17 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 c-n-f Metadata [2360 B]
    Get:18 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe amd64 Packages [30.0 kB]
    Get:19 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe Translation-en [13.9 kB]
    Get:20 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/universe amd64 c-n-f Metadata [1160 B]
    Reading package lists... Done
    E: The repository 'http://ppa.launchpad.net/fenics-packages/fenics/ubuntu focal Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.

Since

404  Not Found [IP: 91.189.95.83 80]

I wonder what I can do next to install FEniCS.
Is there something wrong with my Internet?

https://fenicsproject.org/download/
https://fenics.readthedocs.io/en/latest/installation.html#debian-ubuntu-packages

Besides, if you’re using Ubuntu 20.04, you don’t need to use the fenics-packages ppa.

Just run
sudo apt-get install fenics

1 Like

Thanks a lot. I will do

sudo apt-get install fenics

How to install the mshr if I install fenics in this way?

mshr is part of fenics

Hi wang,
please follow the following install command:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:fenics-packages/fenics
sudo apt-get update
sudo apt-get install --no-install-recommends fenics

if you are in mainland china, a vpn connection is preferable.

If I may, I’m new to FEniCS and I’ve got the same issues as @OsbertWang .
I’m in Southeast Asia and I don’t have VPN.
Is there a work-around, or should i just disregard the error and continue with the steps.
I’m worried it would mean the installation would be incomplete.

As dparsons already pointed out: On Ubuntu 20.04 you don’t use the PPA, you just use the standard Ubuntu repository. The 404 error is due to the fact, that the PPA does not have a “focal/” subdirectory, not because the server cannot be reached.
If you have Ubuntu 20.04 and you have added the PPA, try

sudo add-apt-repository -r ppa:fenics-packages/fenics

and then install the fenics package from the standard repo like this:

sudo apt install fenics

Hi All,

Just want to make sure that I’ve done all things correct.

Windows 10, WSL, in there when I run

wsl -l -v

then got

Ubuntu Running Version 2

Installation of Fenics was done in accordance with the instruction on the website,

add-apt-repository ppa:fenics-packages/fenics
apt update
apt install fenicsx

Then I got to the Ubuntu command env and python3 eventually:

import dolfinx
print({dolfinx.version})
print({dolfinx.git_commit_hash})

then I see the following:

{‘0.4.1’}
{‘unknown’}

Though in the tutorials I see that the version 0.5.1 should be available, what’s wrong?

Many thanks in advance.

The ubuntu 20.04 support ended with version 0.4.1.
You can see this on: https://launchpad.net/~fenics-packages/+archive/ubuntu/fenics
I do not remember why we ended support, maybe @dparsons remembers the specific reason, as he is the main maintainer of the PPA

It was mainly because dolfinx 0.5 requires C++20 support. Ubuntu 20.04 has gcc-9, which does not support C++20.

1 Like

@dparsons and @dokken both many thanks. So the only way for those users of WSL under Windows 10, it should be to update Ubuntu 20.04 LTS to Standard and 20.10, and this would help them to get support and 0.5.1 dolfinx, right?

I think you need to update to the 22.04 standard, as 20.10 has the same issues as 20.04

I agree with dokken, it’s best to upgrade to the most recent LTS stable release, which at the moment is 22.04 (jammy). Upgrading is usually painless:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

(after updating /etc/apt/sources.list to refer to jammy instead of focal, i.e. 22.04 instead of 20.04). Ubuntu also provides graphical package management tools that will list the new sources and can start the upgrade.

edit: best to run update before upgrade

@dparsons thanks a lot. There should be

sudo apt dist-upgrade

I’ve updated to 22.04 LTS under WSL. It now works. Though still there is one thing needs to be clear.

print({dolfinx.git_commit_hash})

gives me {‘unknown’} still though dolfin version is 0.5.2.

Probably because it was build from the source tarball, not from git source. Why do you need dolfinx.git_commit_hash ?

Because it was written in the tutorials to make sure that all should be good.

Ah, I see. Best to ignore that line in the tutorial :slight_smile:
I’ll update the debian/ubuntu packages so they report something a bit more constructive than “unknown” there.

I get “Cannot add PPA: ‘ppa:~fenics-packages/ubuntu/fenics’.” on WSL Ubuntu while trying to add the repository. I’m behind a proxy. Installing fenics or other packages works well, but fenicsx causes trouble.

Is there a manual entry for the repository like “deb Index of /ubuntu focal multiverse”, so that I can manually add the repository?

Hello everyone!

It’s been a while since I last checked in.
I’ve written a short guide on how to install FEniCSx on a Windows system, and uploaded it onto GitHub.
Since I’m Chinese, I wrote the guide in Chinese.
The guide covers installation procedures for both WSL and Docker for Windows 11. Additionally, I have included instructions on how to use proxy for both ppa and ubuntu. Furthermore, I have also cited a tutorial on how to move WSL to another disk.
I hope this guide can be helpful for anyone who needs assistance with installing FEniCSx on their Windows system.

Here’s the link to the guide: install-fenics-guide-zh-cn