Search code examples
pythonnlpflair

ModuleNotFoundError: No module named 'flair'


I have installed flair library via the following command

!pip install flair

but when i tries to import it, it will generate error like "ModuleNotFoundError: No module named 'flair'"

Code:

import torch
import numpy as np
from flair.data import Sentence
from flair.embeddings import TransformerDocumentEmbeddings

Solution

  • install via the following command make sure you use --user option otherwise you will get a permission error in windows 10.

    !pip install --user flair
    

    after install flair you have to restart kernel in jupyter notebook