Deepface error. ImportError: cannot import name 'formatargspec' from 'inspect'

20 Views Asked by At
from deepface import DeepFace

# Provide the correct path to your image file
img_path = "happy_face_woman.png"

# Analyze the face in the image
face_analysis = DeepFace.analyze(img_path=img_path)

# Print the analysis results
print(face_analysis)

when i run this code i get this error:

Traceback (most recent call last):
  File "c:\Users\Nicholas Starbuck\Desktop\Computer assistant\bot\Gender detection\emotions\main.py", line 1, in <module>
    from deepface import DeepFace
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\deepface\DeepFace.py", line 14, in <module>   
    import tensorflow as tf
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\__init__.py", line 38, in <module> 
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\__init__.py", line 37, in <module>
    from tensorflow.python.eager import context
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\eager\context.py", line 36, in <module>
    from tensorflow.python.eager import execute
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\eager\execute.py", line 23, in <module>
    from tensorflow.python.framework import tensor_shape
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\framework\tensor_shape.py", line 26, in <module>
    from tensorflow.python.saved_model import nested_structure_coder
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\saved_model\nested_structure_coder.py", line 38, in <module>
    from tensorflow.python.util import nest
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\tensorflow\python\util\nest.py", line 86, in <module>
    import wrapt as _wrapt
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\wrapt\__init__.py", line 10, in <module>      
    from .decorators import (adapter_factory, AdapterFactory, decorator,
  File "C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\site-packages\wrapt\decorators.py", line 34, in <module>    
    from inspect import ismethod, isclass, formatargspec
ImportError: cannot import name 'formatargspec' from 'inspect' (C:\Users\Nicholas Starbuck\AppData\Local\Programs\Python\Python311\Lib\inspect.py)

What is wrong with the code, and how do I fix it?

0

There are 0 best solutions below