Khawar Islam
Khawar Islam

Reputation: 2914

ModuleNotFoundError: No module named 'deepface'

My code works fine in the local system and then I will decide to shift the code into the server. I just create an anaconda environment and install everything but now it gives no module error. Everything is the same even the python version and the file is also present in the folder. I tested on my local system and it is working without any error.

Tracback

Traceback (most recent call last):
  File "Ensemble-Face-Recognition.py", line 21, in <module>
    from deepface import DeepFace
ModuleNotFoundError: No module named 'deepface'

Code in python file

from pandas.core.frame import DataFrame
import lightgbm as lgb

import more_itertools
import pandas as pd
import numpy as np
import itertools
from os import cpu_count
from sklearn.metrics import confusion_matrix, accuracy_score, roc_curve, auc
import matplotlib.pyplot as plt
import json
import os
import gc
from tqdm import tqdm
from deepface import DeepFace
from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace, DeepID
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, accuracy_score, roc_auc_score, roc_curve

Upvotes: 1

Views: 8564

Answers (1)

sefiks
sefiks

Reputation: 1640

You have to activate your environment first and then install the required deepface package. You have to run the program above when that virtual environment activated.

  1. C:\Users\YOUR_USER\Desktop> conda activate YOUR_ENV
  2. (YOUR_ENV) C:\Users\YOUR_USER\Desktop> pip install deepface
  3. (YOUR_ENV) C:\Users\YOUR_USER\Desktop> pip freeze
  4. (YOUR_ENV) C:\Users\YOUR_USER\Desktop> python Ensemble-Face-Recognition.py

Once you activated your environment, then you should see the deepface when you called pip freeze.

Upvotes: 1

Related Questions