Symptom
$ cqlsh
Warning: unsupported version of Python, required 3.6-3.11 but found 3.12
No appropriate Python interpreter found.
Ubuntu 24.04 ships Python 3.12, but cqlsh
6.2.0 (Cassandra 5.0.x) only supports up to Python 3.11. This post shows a safe, reversible fix that does not touch /usr/bin/python3
.
At a Glance
- Keep system Python 3.12 intact for Ubuntu tools
- Run
cqlsh
under Python 3.11 via pyenv - Make
cqlshlib
importable by Python 3.11 with one symlink (pure-Python) - Reversible in seconds
- Need pyenv first? Use this: Install Python 3.11 on Ubuntu 24.04 (Keep System 3.12) with pyenv
Quick Fix
# 1) Find where cqlshlib lives (from Cassandra/apt package)
sudo find /usr /opt -type d -name cqlshlib 2>/dev/null
# Example: /usr/lib/python3/dist-packages/cqlshlib
# 2) Symlink it into your pyenv 3.11 site-packages
ln -s /usr/lib/python3/dist-packages/cqlshlib \
~/.pyenv/versions/3.11.13/lib/python3.11/site-packages/cqlshlib
# 3) Launch cqlsh (pyenv must be active so python3 == 3.11)
cqlsh
Expected:
Connected to Test Cluster at 127.0.0.1:9042
[cqlsh 6.2.0 | Cassandra 5.0.5 | CQL spec 3.4.7 | Native protocol v5]
Use HELP for help.
Why this works: cqlsh
is a Python script (/usr/bin/env python3
). With pyenv active, python3
is 3.11. The missing piece is cqlshlib
on 3.11’s site-packages
. Since cqlshlib
is pure Python, a symlink is sufficient.