Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: No module named 'fastembed' #432

Open
giacomobartoli opened this issue Dec 31, 2024 · 5 comments
Open

[Bug]: No module named 'fastembed' #432

giacomobartoli opened this issue Dec 31, 2024 · 5 comments

Comments

@giacomobartoli
Copy link

giacomobartoli commented Dec 31, 2024

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

@joein
Copy link
Member

joein commented Jan 2, 2025

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

@giacomobartoli
Copy link
Author

@joein you're right, sorry.. my bad.
I think the code was generated and I didn't double checked.

@giacomobartoli
Copy link
Author

I changed the code according to your comment, using TextEmbedding.
The issue remains:

Import "fastembed" could not be resolvedPylancereportMissingImports

@giacomobartoli giacomobartoli reopened this Jan 2, 2025
@karbasia
Copy link

karbasia commented Jan 3, 2025

If you're code is in a file called fastembed.py, then you will have issues. Rename it and it should work fine.

@giacomobartoli
Copy link
Author

the file is called qdrant.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants