fastembed
fastembed copied to clipboard
[Bug]: No module named 'fastembed'
What happened?
It seems pretty oblivious, but it's not actually.
Using python 3.9 with virtual environment. Requirements txt contains fastembed. Code is pretty simple:
from fastembed import FastEmbed
def embed_search(text: str):
model = FastEmbed(model="jinaai/jina-embeddings-v2-base-de")
embeddings = model.embed(text)
return embeddings
pip install -r requirements.txt --> OK
when I run the file I got:
ModuleNotFoundError: No module named 'fastembed'
I am using a virtual environment:
python3.9 -m venv venv
source venv/bin/activate
I already tried to re-run pip install fastembed
Package is installed correctly:
pip show fastembed
Name: fastembed
Version: 0.5.0
Summary: Fast, light, accurate library built for retrieval embedding generation
Home-page: https://github.com/qdrant/fastembed
Author: Qdrant Team
Author-email: [email protected]
License: Apache License
Location: /Users/giacomobartoli/Desktop/PROGETTI/ctb/ctb/venv/lib/python3.9/site-packages
Requires: huggingface-hub, loguru, mmh3, numpy, onnx, onnxruntime, pillow, py-rust-stemmers, requests, tokenizers, tqdm
Required-by:
What is the expected behaviour?
To run successfully fastembed using a virtual environment
A minimal reproducible example
No response
What Python version are you on? e.g. python --version
Python 3.9
FastEmbed version
latest
What os are you seeing the problem on?
No response
Relevant stack traces and/or logs
No response
Hi @giacomobartoli
there is no FastEmbed class in fastembed, could you point us to the resource where you found it?
The correct import is from fastembed import TextEmbedding
@joein you're right, sorry.. my bad. I think the code was generated and I didn't double checked.
I changed the code according to your comment, using TextEmbedding. The issue remains:
Import "fastembed" could not be resolvedPylancereportMissingImports
If you're code is in a file called fastembed.py, then you will have issues. Rename it and it should work fine.
the file is called qdrant.py
What other packages are installed? The only way I could reproduce this was if either my test file was named fastembed.py or if there is a file named fastembed.py in the same folder as qdrant.py.