How to solve ModuleNotFoundError: No module named 'face_recognition'

Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 556, in _run_script
    exec(code, module.__dict__)
  File "/app/face_recognition/webMain.py", line 8, in <module>
    import face_recognition
ModuleNotFoundError: No module named 'face_recognition'

requirement tex

altair==4.2.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
astor==0.8.1
asttokens==2.0.5
attrs==21.4.0
backcall==0.2.0
base58==2.1.1
beautifulsoup4==4.10.0
bleach==4.1.0
blinker==1.4
cachetools==5.0.0
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.12
click==8.0.4
cmake==3.22.3
colorama==0.4.4
cryptography==37.0.4
debugpy==1.5.1
decorator==5.1.1
defusedxml==0.7.1
dlib
docopt==0.6.2
entrypoints==0.4
executing==0.8.3
face-recognition==1.3.0
face-recognition-models==0.3.0
gitdb==4.0.9
GitPython==3.1.27
idna==3.3
importlib-metadata==4.11.3
ipykernel==6.9.2
ipython==8.1.1
ipython-genutils==0.2.0
ipywidgets==7.7.0
jedi==0.18.1
Jinja2==3.0.3
jsonschema==4.4.0
jupyter-client==7.1.2
jupyter-core==4.9.2
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.1.0
MarkupSafe==2.1.1
matplotlib-inline==0.1.3
mistune==0.8.4
nbclient==0.5.13
nbconvert==6.4.4
nbformat==5.2.0
nest-asyncio==1.5.4
notebook==6.4.10
numpy==1.22.3
opencv-python==4.5.5.64
packaging==21.3
pandas==1.4.1
pandocfilters==1.5.0

library file

#WEB library

import streamlit.components.v1 as components

from secrets import choice

import streamlit as st

#from OpenSSL import SSL

#opencv library

import face_recognition

from datetime import datetime

from PIL import Image

import pandas as pd

import numpy as np

import cv2

import os

import time

from datetime import date

from tempfile import NamedTemporaryFile

import shutil

from csv import DictReader, DictWriter

Here is the link of repo

Hi @swieta_06,

Thanks for posting!

It looks like you’ve written face-recognition in your requirements.txt file but facial_recognition in your import statement. I’m also not seeing a package called “facial_recognition” or “facial-recognition” on PyPi – can you clarify what package you’re trying to install?

Caroline :balloon:

I met the same problem becaue of “-” and “". I have already added “gpt-index” in the requirements file, but met the module not found error. The tricky thing is that, the module name is “gpt-index” when pip install gpt-index, but the name is “gpt_index” when import it. I 'm not sure it’s because of “-” and "” in the different names . how to solve this problem? thanks so much.
below is the github code

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.