ModuleNotFoundError: No module named '_lzma'

I am getting below error while trying to import fastai

ModuleNotFoundError: No module named ‘_lzma’

Kindly help.

I switched to using anaconda instead of pyenv and this issue was resolved.

I’m using VS Code.

First I configured VS Code to use an anaconda virtual environment.

$ conda create -n venv_name
$ conda activate venv_name

Then I installed fastbook:

$ pip install -Uqq fastbook

Then these commands worked with no problem.

import fastbook
fastbook.setup_book()