Installing Pyfa on Ubuntu 22.04

A new version of Ubuntu means a new installation process. Let’s do it! I use Linux Mint 21, a Linux variant whose installation procedure is likely the same as Ubuntu 22.04. The difficult part is to install all relevant python packages that work together; the package ‘wxPython’ is the tough cookie. The method is similar to the method used here: Installing Pyfa on Ubuntu 20.04

The key points are:

  • Use python version 3.9. The newer versions causes error with wxPython.colour() taking floats as inputs.
  • sqlalchemypackage version must be <1.4 for a reason I forgot. I use the version listed in Pyfa requirements.txt: 1.3.23
  • even if anaconda is used, pip was the only way I could get this to work.
  • Installing the packages using the strict package requirements listed in requirements.txt did not work for me. Relaxing the requirements a bit enabled everything to work.
  • Note: global>preferences doesn’t work with error “wx._core.wxAssertionError”. To supress this error, the WXSUPPRESS_SIZER_FLAGS_CHECK environmental variable must be set to 1 when running python.

I used anaconda to create my environment, but I assume any environment creation method is fine. To install and use Anaconda: You can also use the environment creation method outlined in the Pyfa installation for Ubuntu 20.04 linked above.

Now to the process. This uses terminal commands, so open a terminal:

Install required packages. ‘git’ and ‘python’ are required, I’m not sure about libgtk-3-dev; it was needed for Ubuntu 20.04. ‘libwebkit2gtk-4.0-dev’ is required to prevent a wx.html2.WebView.New(self) NotImplementedError when pyfa wants to update. This allows wxPython to compile with wx.html2 support.

sudo apt install git libgtk-3-dev python3-dev libwebkit2gtk-4.0-dev

Now download the Pyfa source code. This will create a directory “Pyfa” with all the Pyfa source files in the active directory in the terminal. This will take a bit to download the files.

git clone

Create the conda environment. I recommend learning about Anaconda to understand the nuance, but basically you need to exit the default “base” environment, create a new one, and activate the pyfa environment.

conda deactivate
conda create -n pyfa python=3.9 pip
conda activate pyfa

Now we install all the packages and hope it works. This may take a long time to build the wheel, whatever that means.

pip install pathlib2 wxPython logbook numpy matplotlib python-dateutil requests sqlalchemy==1.3.23 cryptography markdown2 packaging roman beautifulsoup4 pyyaml python-jose requests-cache 

Now we are ready to use pyfa! Go to the Pyfa directory and run the following command. The WXSUPPRESS_SIZER_FLAGS_CHECK=1 bit enables the use of global>preferences menu.


Hopefully this works; if it doesn’t, see debug tips below. To run Pyfa, you must change to the pyfa environment every time before running ‘python’. To see how to make Pyfa easier to run, also see the procedure for Ubuntu 20.04, linked above. I created an alias to make running pyfa easier with the following command. I added this command to ~/.bashrc so it sets the alias every time the terminal is started. type pyfa in the terminal to run pyfa.

alias pyfa='conda deactivate && conda activate pyfa && WXSUPPRESS_SIZER_FLAGS_CHECK=1 python $HOME/Programs/Games/pyfa/

Updating Pyfa is easy if you used the git clone command. Each time the source code is updated, you should only need to update the directory. Navigate to the Pyfa directory in a terminal and execute the following command. This will update the directory with the updated files. This should work 99.9% of the time but you should note that if the developers add a new package, or update methods that are no longer compatible with the environment, you will have to debug the issue to make it work; see debug tips.

git pull

Debug Tips:
Pay attention to the error. Most often it is an missing package import error, and you just have to pip install that package. Hopefully the package is compatible with the rest of your packages; otherwise you may have to downgrade the missing package version or other packages already installed. If it is a function or method error, pay attention to which python package the offending method is from; then you either need to use an older version of the package or older version of python. You can also check out the links to the tutorials for the previous versions for tips.


Since a few versions ago they also provide an AppImage that takes care of all the dependencies for you. Saves a ton of hassle.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.