Encountering No module named 'cdiff
while running select gitlab-ctl patroni
commands
Description
Commands like gitlab-ctl patroni restart
, gitlab-ctl patroni reload
, gitlab-ctl patroni members
fail with error message:
ModuleNotFoundError: No module named 'cdiff'
Environment
-
Impacted offerings:
- GitLab Self-Managed
-
Impacted versions:
- 16.8 to 17.1
-
Impacted services:
- Patroni
Solution
Upgrade to the latest patch release for your desired major and minor versions of GitLab. For example, if you encountered this problem when upgrading to 16.8.6
, upgrade to the latest 16.8.x
version of GitLab.
Workaround
Overwrite the version of ydiff
with version 1.2
using the command:
curl -o /opt/gitlab/embedded/lib/python3.9/site-packages/ydiff.py https://raw.githubusercontent.com/ymattw/ydiff/1.2/ydiff.py
Cause
As a part of configuring Patroni during upgrades, we run pip install patroni
.
Affected versions of Gitlab use ydiff
v1.3, a dependency of patroni. The version of
patroniinstalled is not compatible with
ydiff>=1.3`.
See Pin ydiff version to 1.2 for more information.
Additional information
This problem does not impact all gitlab-ctl patroni
subcommands; things like gitlab-ctl patroni check-leader
will continue to work properly.