Categories
Hardware performance python python performance virtualisation

CPU and FastAPI Performance

When migrating a FastAPI and WordPress website to a different VPS (virtual private server) provider it was noted that response time and requests per second were impacted negatively. Response times were 2 times slower. It was then noted that the cpu performance could be playing a big factor in this difference in performance. In this […]

Categories
python ubuntu

How to build python 3 from source on Ubuntu 22.04?

Install pre-requisites sudo apt install build-essential libssl-dev libffi-dev software-properties-common libbz2-dev libncurses-dev libncursesw5-dev libgdbm-dev liblzma-dev libsqlite3-dev tk-dev libgdbm-compat-dev libreadline-dev Download the python version you want from https://www.python.org/downloads/source/ cd /opt sudo wget https://www.python.org/ftp/python/3.9.16/Python-3.9.16.tar.xz Extract the downloaded source sudo tar -xvf Python-3.9.16.tar.xz Read the info cd Python-3.9.16/ cat README.rst Compile and Install python ./configure make When running make […]

Categories
python

Ubuntu 22.04 + Firefox + Selenium + Geckodriver: Connection refused

The Ubuntu 22.04 + Firefox with Selenium and Geckodriver problem is: selenium.common.exceptions.TimeoutException: Message: Connection refused (os error 111) An older firefox version was installed from source after looking at geckodriver’s supported platforms docs… Environment details: $ firefox –version Mozilla Firefox 89.0.2 $ geckodriver –version geckodriver 0.29.1 (970ef713fe58 2021-04-08 23:34 +0200) selenium 3.14.1 Example script: from […]

Categories
python

Python Performance: Checking a collection contains a value (Membership)

A common task in programming and development is finding items that exist already or recognising duplicates. This is done by checking membership of an element in a collection. Often a list is used as it is mutable (can be changed and items added to it) and it is suited for single items. However there are […]

Categories
python

Python ModuleNotFoundError

One of the classic problems when running a python script that imports another module is not being able to find the module. ModuleNotFoundError: No module named ‘xxx’ There are 2 fundamentals to remember. A python module is – simply – a file A Python package is a folder containing a __init__.py file. A folder of […]