M-M-Akash / Face_Recognition_System

Real time face detection and recognition system supports multiple cameras streaming
31 stars 7 forks source link

error ModuleNotFoundError: No module named 'paddle.nn.layer.layers' #1

Closed arad2022 closed 7 months ago

arad2022 commented 9 months ago

Hi. I installed all the libraries that you mentioned but when I ran enroll_new_faces.py and I got below error. Could you please help me?

C:\Users\windows.conda\envs\paddle\lib\site-packages\setuptools\sandbox.py:13: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html import pkg_resources C:\Users\windows.conda\envs\paddle\lib\site-packages\pkg_resources__init.py:2871: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('mpl_toolkits'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) C:\Users\windows.conda\envs\paddle\lib\site-packages\pkg_resources__init__.py:2871: DeprecationWarning: Deprecated call to pkg_resources.declare_namespace('google'). Implementing implicit namespace packages (as specified in PEP 420) is preferred to pkg_resources.declare_namespace. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages declare_namespace(pkg) C:\Users\windows.conda\envs\paddle\lib\site-packages_distutils_hack\init.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") Traceback (most recent call last): File "D:/face recognition/code/Face_Recognition_System-insight/add_new_face.py", line 1, in import paddlehub as hub File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlehub\init.py", line 31, in from paddlehub import datasets File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlehub\datasets\init.py", line 16, in from paddlehub.datasets.chnsenticorp import ChnSentiCorp File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlehub\datasets\chnsenticorp.py", line 19, in from paddlehub.datasets.base_nlp_dataset import TextClassificationDataset File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlehub\datasets\base_nlp_dataset.py", line 21, in import paddlenlp File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlenlp\init.py", line 35, in from . import ( File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlenlp\data\init.py", line 18, in from .data_collator import * File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlenlp\data\data_collator.py", line 26, in from ..transformers import BertTokenizer File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlenlp\transformers\init.py", line 17, in from .model_utils import PretrainedModel, register_base_model File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlenlp\transformers\model_utils.py", line 62, in from ..generation import GenerationConfig, GenerationMixin File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlenlp\generation\init__.py", line 15, in from .logits_process import ( File "C:\Users\windows.conda\envs\paddle\lib\site-packages\paddlenlp\generation\logits_process.py", line 22, in from paddle.nn.layer.layers import in_declarative_mode ModuleNotFoundError: No module named 'paddle.nn.layer.layers'

All the libraries in my created environment

This file may be used to create an environment using:

$ conda create --name --file

platform: win-64

aiohttp=3.9.3=pypi_0 aiosignal=1.3.1=pypi_0 annotated-types=0.6.0=pypi_0 anyio=4.3.0=pypi_0 astor=0.8.1=pypi_0 async-timeout=4.0.3=pypi_0 attrs=23.2.0=pypi_0 babel=2.14.0=pypi_0 bce-python-sdk=0.9.4=pypi_0 blinker=1.7.0=pypi_0 ca-certificates=2023.12.12=haa95532_0 certifi=2024.2.2=pypi_0 charset-normalizer=3.3.2=pypi_0 click=8.1.7=pypi_0 colorama=0.4.6=pypi_0 colorlog=6.8.2=pypi_0 contourpy=1.1.1=pypi_0 cycler=0.12.1=pypi_0 datasets=2.17.1=pypi_0 decorator=5.1.1=pypi_0 dill=0.3.4=pypi_0 easydict=1.12=pypi_0 exceptiongroup=1.2.0=pypi_0 fastapi=0.109.2=pypi_0 filelock=3.13.1=pypi_0 flask=3.0.2=pypi_0 flask-babel=4.0.0=pypi_0 fonttools=4.49.0=pypi_0 frozenlist=1.4.1=pypi_0 fsspec=2023.10.0=pypi_0 future=0.18.3=pypi_0 gitdb=4.0.11=pypi_0 gitpython=3.1.42=pypi_0 h11=0.14.0=pypi_0 huggingface-hub=0.20.3=pypi_0 idna=3.6=pypi_0 importlib-metadata=7.0.1=pypi_0 importlib-resources=6.1.1=pypi_0 insightface-paddle=0.0.0=pypi_0 itsdangerous=2.1.2=pypi_0 jieba=0.42.1=pypi_0 jinja2=3.1.3=pypi_0 joblib=1.3.2=pypi_0 kiwisolver=1.4.5=pypi_0 libffi=3.4.4=hd77b12b_0 markdown-it-py=3.0.0=pypi_0 markupsafe=2.1.5=pypi_0 matplotlib=3.7.5=pypi_0 mdurl=0.1.2=pypi_0 multidict=6.0.5=pypi_0 multiprocess=0.70.12.2=pypi_0 numpy=1.24.4=pypi_0 onnx=1.15.0=pypi_0 opencv-python=4.4.0.46=pypi_0 openssl=3.0.13=h2bbff1b_0 opt-einsum=3.3.0=pypi_0 packaging=23.2=pypi_0 paddle-bfloat=0.1.7=pypi_0 paddle2onnx=1.0.6=pypi_0 paddlefsl=1.1.0=pypi_0 paddlehub=2.1.0=pypi_0 paddlenlp=2.6.1=pypi_0 paddlepaddle=2.4.2=pypi_0 pandas=2.0.3=pypi_0 pillow=10.2.0=pypi_0 pip=23.3.1=py38haa95532_0 prettytable=3.9.0=pypi_0 protobuf=3.20.0=pypi_0 psutil=5.9.8=pypi_0 pyarrow=15.0.0=pypi_0 pyarrow-hotfix=0.6=pypi_0 pycryptodome=3.20.0=pypi_0 pydantic=2.6.1=pypi_0 pydantic-core=2.16.2=pypi_0 pygments=2.17.2=pypi_0 pyparsing=3.1.1=pypi_0 python=3.8.18=h1aa4202_0 python-dateutil=2.8.2=pypi_0 pytz=2024.1=pypi_0 pyyaml=6.0.1=pypi_0 pyzmq=25.1.2=pypi_0 rarfile=4.1=pypi_0 requests=2.31.0=pypi_0 rich=13.7.0=pypi_0 safetensors=0.4.2=pypi_0 scikit-learn=0.23.2=pypi_0 scipy=1.10.1=pypi_0 sentencepiece=0.1.99=pypi_0 seqeval=1.2.2=pypi_0 setuptools=68.2.2=py38haa95532_0 six=1.16.0=pypi_0 smmap=5.0.1=pypi_0 sniffio=1.3.0=pypi_0 sqlite=3.41.2=h2bbff1b_0 starlette=0.36.3=pypi_0 threadpoolctl=3.3.0=pypi_0 tqdm=4.66.2=pypi_0 typer=0.9.0=pypi_0 typing-extensions=4.9.0=pypi_0 tzdata=2024.1=pypi_0 urllib3=2.2.1=pypi_0 uvicorn=0.27.1=pypi_0 vc=14.2=h21ff451_1 visualdl=2.5.3=pypi_0 vs2015_runtime=14.27.29016=h5e58377_2 wcwidth=0.2.13=pypi_0 werkzeug=3.0.1=pypi_0 wheel=0.41.2=py38haa95532_0 xxhash=3.4.1=pypi_0 yarl=1.9.4=pypi_0 zipp=3.17.0=pypi_0

M-M-Akash commented 7 months ago

On your dependencies I don't see any package named 'paddlehub'. This could be the issue as we are using pretrained model from the paddlehub toolskit. You need to first install the paddlehub library. PaddlePaddle Hub is a powerful toolkit for pretrained AI models based on paddle paddle framework. Install it using the following command: Documentation

pip install paddlehub==2.1.0

To verify the installation, run the following code snippet:


import paddlehub

paddlehub.server_check()

After that please confirm that your paddlehub library is working. Let me know if you are still facing the issue.