How to fix FreeCAD 'No module named WebGui' on Ubuntu 18.04

On Ubuntu 18.04 there’s currently a known bug where FreeCAD starts but does not show any widgets at startup but this error message instead:

error_message.txt
No module named WebGui

One way I’ve found of fixing this issue is to install FreeCAD not from the Ubuntu repositories but from the freecad-stable PPA:

add_freecad_ppa.sh
sudo add-apt-repository ppa:freecad-maintainers/freecad-stable
sudo apt-get update

Then you can install freecad again:

install_freecad.sh
sudo apt install freecad

If you’ve installed previous versions of OpenCASCADE from the freecad PPAs, you might get an error message similar to this one:

freecad_dependency_error.txt
Die folgenden Pakete haben unerfüllte Abhängigkeiten:
 freecad : Hängt ab von: libocct-data-exchange-7.2 soll aber nicht installiert werden
           Hängt ab von: libocct-foundation-7.2 soll aber nicht installiert werden
           Hängt ab von: libocct-modeling-algorithms-7.2 soll aber nicht installiert werden
           Hängt ab von: libocct-modeling-data-7.2 soll aber nicht installiert werden
           Hängt ab von: libocct-ocaf-7.2 soll aber nicht installiert werden
           Hängt ab von: libocct-visualization-7.2 soll aber nicht installiert werden
E: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.

In that case, you need to force apt to install OpenCASCADE 7.2 along with freecad and deinstall OpenCASCADE 7.1

install_freecad_with_opencascade.sh
sudo apt install freecad libocct-data-exchange-7.2 libocct-foundation-7.2 libocct-modeling-algorithms-7.2 libocct-modeling-data-7.2 libocct-ocaf-7.2 libocct-visualization-7.2

Check out similar posts by category: CAD, Linux