Open HamzaCetin0 opened 4 days ago
I'm having the same issue and just added the library yesterday on 9/14/2024 on windows.
Code: img = cv2.imread(imgPath) result = DeepFace.analyze(img,actions=['emotion'])
Output: AttributeError: module 'deepface.modules.modeling' has no attribute 'build_model'
it is very interesting because the error is general import error and i can see that build_model function is available under deepface.modules.modeling
i suspect your python version, would you please try this with 3.9?
BTW, what is the name of the file you are running? It must not be deepface.py
.
I was able to get past this issue by deleting the deepface folder from my anaconda folder and reinstalling through the anaconda command prompt. I originally did the installation through Jupiter Notebook and had a suspicion that was the cause.
Same error, Ubuntu 22.04, Python 3.10.12, regular venv, no anaconda. Running via VScode notebook
pip list Package Version --------------------------------- -------------------- absl-py 2.1.0 accelerate 0.30.0 addict 2.4.0 aiofiles 23.2.1 aiohttp 3.9.5 aioresponses 0.7.6 aiosignal 1.3.1 albumentations 1.3.1 annotated-types 0.6.0 antlr4-python3-runtime 4.9.3 anyio 4.3.0 appdirs 1.4.4 APScheduler 3.10.1 arrow 1.3.0 asttokens 2.4.1 astunparse 1.6.3 async-timeout 4.0.3 attrs 23.2.0 audioread 3.0.1 auto_gptq 0.7.1 av 12.3.0 awscli 1.33.9 Babel 2.15.0 backoff 2.2.1 beautifulsoup4 4.12.3 binaryornot 0.4.4 bitsandbytes 0.42.0 black 21.4b2 blinker 1.8.2 boto3 1.34.127 botocore 1.34.127 cachetools 5.3.3 certifi 2024.2.2 cffi 1.16.0 chardet 5.2.0 charset-normalizer 3.3.2 chumpy 0.71 click 8.1.7 clip 1.0 clip-interrogator 0.6.0 cloudpickle 3.0.0 cmake 3.29.3 color-matcher 0.5.0 colorama 0.4.4 coloredlogs 15.0.1 colorlog 6.8.2 colour-science 0.4.4 comm 0.2.2 contourpy 1.2.1 cookiecutter 2.6.0 cryptography 42.0.7 cssselect2 0.7.0 cstr 0.1.0 cycler 0.12.1 Cython 3.0.0 dataclasses-json 0.6.7 datasets 2.19.1 ddt 1.7.2 debugpy 1.8.5 decorator 4.4.2 deepdiff 7.0.1 deepface 0.0.93 defusedxml 0.7.1 Deprecated 1.2.14 detectron2 0.6 detectron2-densepose 0.6 diffusers 0.29.2 dill 0.3.8 diskcache 5.6.3 distro 1.9.0 dlib 19.24.6 dnspython 2.6.1 docker 6.1.3 docker-pycreds 0.4.0 docstring_parser 0.16 docutils 0.16 easydict 1.13 einops 0.8.0 email_validator 2.1.1 embreex 2.17.7.post4 entrypoints 0.4 exceptiongroup 1.2.1 executing 2.0.1 fairscale 0.4.13 fastapi 0.110.3 fastapi-cli 0.0.3 ffmpy 0.3.0 filelock 3.14.0 fire 0.6.0 Flask 3.0.3 Flask-Cors 5.0.0 flatbuffers 24.3.25 flet 0.23.2 flet-core 0.23.2 flet-runtime 0.23.2 fonttools 4.51.0 frozenlist 1.4.1 fsspec 2024.3.1 ftfy 6.2.0 future 1.0.0 fvcore 0.1.5.post20221221 gast 0.6.0 gdown 5.2.0 gekko 1.1.1 ghp-import 2.1.0 gitdb 4.0.11 GitPython 3.1.43 google-pasta 0.2.0 GPUtil 1.4.0 gradio 4.42.0 gradio_client 1.3.0 griffe 0.45.0 grpcio 1.63.0 gunicorn 23.0.0 h11 0.14.0 h5py 3.11.0 httpcore 1.0.5 httptools 0.6.1 httpx 0.27.0 huggingface-hub 0.24.5 humanfriendly 10.0 hydra-core 1.3.2 idna 3.7 imageio 2.34.1 imageio-ffmpeg 0.4.9 img2texture 1.0.6 importlib_metadata 7.1.0 importlib_resources 6.4.4 iniconfig 2.0.0 insightface 0.7.3 iopath 0.1.9 ipycanvas 0.13.2 ipyevents 2.0.2 ipykernel 6.29.5 ipython 8.26.0 ipywidgets 8.1.5 itsdangerous 2.2.0 jax 0.4.28 jaxlib 0.4.28 jedi 0.19.1 Jinja2 3.1.4 jmespath 1.0.1 joblib 1.4.2 jsonschema 4.22.0 jsonschema-specifications 2023.12.1 jupyter_client 7.4.9 jupyter_core 5.7.2 jupyterlab_widgets 3.0.13 kaolin 0.16.0 keras 3.5.0 kiwisolver 1.4.5 kornia 0.7.2 kornia_rs 0.1.3 lark-parser 0.12.0 lazy_loader 0.4 libclang 18.1.1 librosa 0.10.2.post1 lightning-utilities 0.11.2 llama-cpp-agent 0.0.17 llama_cpp_python 0.2.26+cu121 llvmlite 0.42.0 lmdb 1.4.1 loguru 0.7.2 lpips 0.1.4 lxml 5.2.2 mapbox-earcut 1.0.1 Markdown 3.6 markdown-it-py 3.0.0 MarkupSafe 2.1.5 marshmallow 3.21.3 matplotlib 3.9.0 matplotlib-inline 0.1.7 matrix-client 0.4.0 mdurl 0.1.2 mediapipe 0.10.14 mergedeep 1.3.4 mkdocs 1.6.0 mkdocs-autorefs 1.0.1 mkdocs-get-deps 0.2.0 mkdocs-material 9.5.23 mkdocs-material-extensions 1.3.1 mkdocstrings 0.25.1 mkdocstrings-python 1.10.2 ml-dtypes 0.4.0 moviepy 1.0.3 mpmath 1.3.0 msgpack 1.0.8 mss 9.0.1 mtcnn 0.1.1 multidict 6.0.5 multiprocess 0.70.16 mypy-extensions 1.0.0 namex 0.0.8 nest-asyncio 1.6.0 networkx 3.3 ninja 1.11.1.1 numba 0.59.1 numpy 1.24.4 nvidia-cublas-cu12 12.1.3.1 nvidia-cuda-cupti-cu12 12.1.105 nvidia-cuda-nvrtc-cu12 12.1.105 nvidia-cuda-runtime-cu12 12.1.105 nvidia-cudnn-cu12 8.9.2.26 nvidia-cufft-cu12 11.0.2.54 nvidia-curand-cu12 10.3.2.106 nvidia-cusolver-cu12 11.4.5.107 nvidia-cusparse-cu12 12.1.0.106 nvidia-nccl-cu12 2.20.5 nvidia-nvjitlink-cu12 12.4.127 nvidia-nvtx-cu12 12.1.105 oauthlib 3.2.2 omegaconf 2.3.0 onnx 1.16.2 onnxruntime 1.19.2 onnxruntime-gpu 1.19.2 open-clip-torch 2.24.0 openai 1.30.1 opencv-contrib-python 4.10.0.84 opencv-contrib-python-headless 4.7.0.72 opencv-python 4.8.0.76 opencv-python-headless 4.7.0.72 opt-einsum 3.3.0 optree 0.12.1 ordered-set 4.1.0 orjson 3.10.3 packaging 23.2 paginate 0.5.6 pandas 2.2.2 parso 0.8.4 pathspec 0.12.1 peft 0.11.0 pendulum 3.0.0 pexpect 4.9.0 piexif 1.1.3 pilgram 1.2.1 Pillow 9.5.0 pip 22.0.2 pixeloe 0.0.10 platformdirs 4.2.2 pluggy 1.5.0 pooch 1.8.1 portalocker 2.8.2 pretty-errors 1.2.25 prettytable 3.10.0 proglog 0.1.10 prometheus_client 0.20.0 prometheus-fastapi-instrumentator 6.0.0 prompt_toolkit 3.0.47 protobuf 4.25.3 psutil 5.9.8 ptyprocess 0.7.0 PuLP 2.8.0 pure_eval 0.2.3 py-cpuinfo 3.3.0 pyarrow 16.1.0 pyarrow-hotfix 0.6 pyasn1 0.6.0 pybase64 1.3.2 pybind11 2.13.5 pycocotools 2.0.7 pycollada 0.8 pycparser 2.22 pydantic 2.7.1 pydantic_core 2.18.2 pydot 3.0.1 pydub 0.25.1 PyGithub 2.3.0 pygltflib 1.16.2 Pygments 2.18.0 PyJWT 2.8.0 PyMatting 1.1.12 pymdown-extensions 10.8.1 PyNaCl 1.5.0 pynvml 11.5.0 pyodbc 5.1.0 pyparsing 3.1.2 pypng 0.20220715.0 pySmartDL 1.3.4 PySocks 1.7.1 pytest 8.2.2 pytest-asyncio 0.21.1 python-dateutil 2.9.0.post0 python-dotenv 1.0.1 python-multipart 0.0.9 python-slugify 8.0.4 pytorch-lightning 2.2.4 pytorch3d 0.7.7 pytz 2024.1 PyWavelets 1.6.0 PyYAML 6.0.1 pyyaml_env_tag 0.1 pyzmq 24.0.1 qrcode 7.4.2 qudida 0.0.4 redis 5.0.6 referencing 0.35.1 regex 2024.5.15 rembg 2.0.56 repath 0.9.0 reportlab 4.2.0 requests 2.31.0 requests-toolbelt 1.0.0 retina-face 0.0.17 rf-clip 1.0 rich 13.5.2 rouge 1.0.1 rpds-py 0.18.1 rsa 4.7.2 Rtree 1.2.0 ruff 0.6.3 s3transfer 0.10.1 safetensors 0.4.3 scikit-build 0.17.6 scikit-image 0.20.0 scikit-learn 1.4.2 scipy 1.13.0 seaborn 0.13.2 segment-anything 1.0 semantic-version 2.10.0 sentencepiece 0.2.0 sentry-sdk 2.13.0 setproctitle 1.3.3 setuptools 69.5.1 shapely 2.0.1 shellingham 1.5.4 simpleeval 0.9.13 six 1.16.0 smmap 5.0.1 smplx 0.1.28 sniffio 1.3.1 sounddevice 0.4.6 soundfile 0.12.1 soupsieve 2.5 soxr 0.3.7 spandrel 0.3.3 stack-data 0.6.3 starlette 0.37.2 supervision 0.21.0 svg.path 6.3 svglib 1.5.1 sympy 1.12 symusic 0.4.7 tabulate 0.9.0 tb-nightly 2.17.0a20240515 tensorboard 2.17.1 tensorboard-data-server 0.7.2 tensorflow 2.17.0 tensorflow-io-gcs-filesystem 0.37.1 tensorrt 10.0.1 tensorrt-cu12 10.0.1 tensorrt-cu12-bindings 10.0.1 tensorrt-cu12-libs 10.0.1 termcolor 2.4.0 text-unidecode 1.3 tf_keras 2.17.0 thop 0.1.1.post2209072238 threadpoolctl 3.5.0 tifffile 2024.5.10 time-machine 2.14.1 timm 1.0.3 tinycss2 1.3.0 tokenizers 0.19.1 toml 0.10.2 tomli 2.0.1 tomlkit 0.12.0 torch 2.3.1 torchaudio 2.3.1 torchmetrics 1.2.1 torchsde 0.2.6 torchvision 0.18.1 tornado 6.4.1 tqdm 4.66.4 traitlets 5.14.3 trampoline 0.1.2 transformers 4.40.2 transparent-background 1.3.1 trimesh 4.3.2 triton 2.3.1 typer 0.12.5 types-python-dateutil 2.9.0.20240316 typing 3.7.4.3 typing_extensions 4.11.0 typing-inspect 0.9.0 tzdata 2024.1 tzlocal 5.2 ujson 5.10.0 ultralytics 8.2.16 urllib3 1.26.20 usd-core 23.5 uvicorn 0.29.0 uvloop 0.19.0 vhacdx 0.0.6 wandb 0.17.8 watchdog 4.0.0 watchfiles 0.21.0 wcwidth 0.2.13 webencodings 0.5.1 websocket-client 1.8.0 websockets 12.0 Werkzeug 3.0.3 wget 3.2 wheel 0.43.0 widgetsnbextension 4.0.13 wrapt 1.16.0 xatlas 0.0.9 xxhash 3.4.1 yacs 0.1.8 yapf 0.40.2 yarl 1.9.4 zipp 3.18.2
I was also facing the same issue, but installing tensorrt (pip install tensorrt
) resolved it for me.
Before You Report a Bug, Please Confirm You Have Done The Following...
DeepFace's version
0.0.93
Python version
3.10
Operating System
Ubuntu 20.04
Dependencies
absl-py==2.1.0 actionlib==1.14.0 ajsonrpc==1.2.0 angles==1.9.13 antlr4-python3-runtime==4.9.3 anyio==4.4.0 asttokens==2.4.1 astunparse==1.6.3 beautifulsoup4==4.12.3 blinker==1.8.2 bondpy==1.8.6 bottle==0.12.25 camera-calibration==1.17.0 camera-calibration-parsers==1.12.0 catkin==0.8.10 certifi==2024.7.4 charset-normalizer==3.3.2 click==8.1.7 colorama==0.4.6 comm==0.2.2 contourpy==1.2.1 controller-manager==0.20.0 controller-manager-msgs==0.20.0 cv-bridge==1.16.2 cycler==0.12.1 Cython==3.0.11 cython-bbox==0.1.5 debugpy==1.8.5 decorator==5.1.1 deepface==0.0.93 diagnostic-analysis==1.11.0 diagnostic-common-diagnostics==1.11.0 diagnostic-updater==1.11.0 dill==0.3.8 dynamic-reconfigure==1.7.3 exceptiongroup==1.2.2 executing==2.0.1 filelock==3.13.1 fire==0.6.0 Flask==3.0.3 Flask-Cors==5.0.0 flatbuffers==24.3.25 fonttools==4.53.1 fsspec==2024.2.0 gast==0.6.0 gazebo_plugins==2.9.2 gazebo_ros==2.9.2 gdown==5.2.0 gencpp==0.7.0 geneus==3.0.0 genlisp==0.4.18 genmsg==0.6.0 gennodejs==2.0.2 genpy==0.6.15 google-pasta==0.2.0 grpcio==1.65.4 gunicorn==23.0.0 h11==0.14.0 h5py==3.11.0 idna==3.7 image-geometry==1.16.2 interactive-markers==1.12.0 ipykernel==6.29.5 ipython==8.26.0 itsdangerous==2.2.0 jedi==0.19.1 Jinja2==3.1.3 joint-state-publisher==1.15.1 joint-state-publisher-gui==1.15.1 jupyter_client==8.6.2 jupyter_core==5.7.2 keras==3.5.0 kiwisolver==1.4.5 lap==0.4.0 laser_geometry==1.6.7 libclang==18.1.1 loguru==0.7.2 Markdown==3.6 markdown-it-py==3.0.0 MarkupSafe==2.1.5 marshmallow==3.21.3 matplotlib==3.9.0 matplotlib-inline==0.1.7 mdurl==0.1.2 message-filters==1.16.0 ml-dtypes==0.4.1 mpmath==1.3.0 mtcnn==0.1.1 namex==0.0.8 nest-asyncio==1.6.0 networkx==3.2.1 numpy==1.26.3 nvidia-cublas-cu12==12.4.2.65 nvidia-cuda-cupti-cu12==12.4.99 nvidia-cuda-nvrtc-cu12==12.4.99 nvidia-cuda-runtime-cu12==12.4.99 nvidia-cudnn-cu12==9.1.0.70 nvidia-cufft-cu12==11.2.0.44 nvidia-curand-cu12==10.3.5.119 nvidia-cusolver-cu12==11.6.0.99 nvidia-cusparse-cu12==12.3.0.142 nvidia-nccl-cu12==2.20.5 nvidia-nvjitlink-cu12==12.4.99 nvidia-nvtx-cu12==12.4.99 omegaconf==2.3.0 opencv-python==4.10.0.84 opt-einsum==3.3.0 optree==0.12.1 packaging==24.1 pandas==2.2.2 parso==0.8.4 pexpect==4.9.0 pillow==10.2.0 platformdirs==4.2.2 platformio==6.1.15 prompt_toolkit==3.0.47 protobuf==4.25.4 psutil==6.0.0 ptyprocess==0.7.0 pure_eval==0.2.3 py-cpuinfo==9.0.0 pyelftools==0.31 Pygments==2.18.0 pyparsing==3.1.2 pyserial==3.5 PySocks==1.7.1 python-dateutil==2.9.0.post0 python-qt-binding==0.4.4 pytz==2024.1 PyYAML==6.0.1 pyzmq==26.1.0 qt-dotgraph==0.4.2 qt-gui==0.4.2 qt-gui-cpp==0.4.2 qt-gui-py-common==0.4.2 requests==2.32.3 resource_retriever==1.12.7 retina-face==0.0.17 rich==13.8.1 rosbag==1.16.0 rosboost-cfg==1.15.8 rosclean==1.15.8 roscreate==1.15.8 rosgraph==1.16.0 roslaunch==1.16.0 roslib==1.15.8 roslint==0.12.0 roslz4==1.16.0 rosmake==1.15.8 rosmaster==1.16.0 rosmsg==1.16.0 rosnode==1.16.0 rosparam==1.16.0 rospy==1.16.0 rosservice==1.16.0 rostest==1.16.0 rostopic==1.16.0 rosunit==1.15.8 roswtf==1.16.0 rqt-console==0.4.12 rqt-image-view==0.4.17 rqt-logger-level==0.4.12 rqt-moveit==0.5.11 rqt-reconfigure==0.5.5 rqt-robot-dashboard==0.5.8 rqt-robot-monitor==0.5.15 rqt-runtime-monitor==0.5.10 rqt-rviz==0.7.0 rqt-tf-tree==0.6.4 rqt_action==0.4.9 rqt_bag==0.5.1 rqt_bag_plugins==0.5.1 rqt_dep==0.4.12 rqt_graph==0.4.14 rqt_gui==0.5.3 rqt_gui_py==0.5.3 rqt_launch==0.4.9 rqt_msg==0.4.10 rqt_nav_view==0.5.7 rqt_plot==0.4.13 rqt_pose_view==0.5.11 rqt_publisher==0.4.10 rqt_py_common==0.5.3 rqt_py_console==0.4.10 rqt_robot_steering==0.5.12 rqt_service_caller==0.4.10 rqt_shell==0.4.11 rqt_srv==0.4.9 rqt_top==0.4.10 rqt_topic==0.4.13 rqt_web==0.4.10 rviz==1.14.25 scipy==1.14.0 seaborn==0.13.2 semantic-version==2.10.0 sensor-msgs==1.13.1 six==1.16.0 smach==2.5.2 smach-ros==2.5.2 smclib==1.8.6 sniffio==1.3.1 soupsieve==2.6 stack-data==0.6.3 starlette==0.37.2 sympy==1.12 tabulate==0.9.0 tensorboard==2.17.0 tensorboard-data-server==0.7.2 tensorflow==2.17.0 tensorflow-io-gcs-filesystem==0.37.1 termcolor==2.4.0 tf==1.13.2 tf-conversions==1.13.2 tf2-geometry-msgs==0.7.7 tf2-kdl==0.7.7 tf2-py==0.7.7 tf2-ros==0.7.7 tf_keras==2.17.0 thop==0.1.1.post2209072238 topic-tools==1.16.0 torch==2.4.0+cu124 torchaudio==2.4.0+cu124 torchvision==0.19.0+cu124 tornado==6.4.1 tqdm==4.66.5 traitlets==5.14.3 triton==3.0.0 typing_extensions==4.9.0 tzdata==2024.1 ultralytics==8.2.73 ultralytics-thop==2.0.0 urllib3==2.2.2 uvicorn==0.29.0 wcwidth==0.2.13 Werkzeug==3.0.3 wrapt==1.16.0 wsproto==1.2.0 xacro==1.14.18
Reproducible example
Relevant Log Output
AttributeError: module 'deepface.modules.modeling' has no attribute 'build_model'
Expected Result
No response
What happened instead?
No response
Additional Info
No response