I got the same error and I fix it with this:
installing necesary dependencies:
sudo apt update
sudo apt install -y build-essential libssl-dev libffi-dev zlib1g-dev
libbz2-dev libreadline-dev libsqlite3-dev liblzma-dev
libncursesw5-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
download the source code, using your own python version:
cd /usr/src
sudo wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
uncompress:
sudo tar xzf Python-3.10.0.tgz
cd Python-3.10.0
configure and install python:
sudo ./configure --enable-optimizations
compile and install
sudo make -j $(nproc)
sudo make altinstall
check if everything is ok (is right if you don't get errors or messages):
python3.10 -m lzma
also you can check this way:
python3.10 -c "import lzma; print('lzma module is available')"
thank you friends, love ya