nischi / MMM-Face-Reco-DNN

Face recognition with opencv and deep neural network
MIT License
91 stars 46 forks source link

Failed to install v.2.0.0 #138

Closed grssll closed 9 months ago

grssll commented 10 months ago

Fresh install on Bullseye 64 bit failed. ''' verbose stack Error: command failed 305 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27) 305 verbose stack at ChildProcess.emit (node:events:513:28) 305 verbose stack at maybeClose (node:internal/child_process:1098:16) 305 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:304:5) 306 verbose pkgid mmm-face-reco-dnn@2.0.0 307 verbose cwd /home/grssl/MagicMirror/modules/MMM-Face-Reco-DNN 308 verbose Linux 6.1.21-v8+ 309 verbose node v19.9.0 310 verbose npm v9.6.3 311 error code 1 312 error path /home/grssl/MagicMirror/modules/MMM-Face-Reco-DNN 313 error command failed 314 error command sh -c pipenv install --site-packages 315 verbose exit 1 316 timing npm Completed in 71476ms 317 verbose code 1 '''

grssll commented 10 months ago

An error occurred while installing v4l2-python3==0.3.2 --hash=sha256:34737ac0ef5bd3167d29379276e0881f6e0539db9e3e881a5df7cbec6c264391 --hash=sha256:b7ae81ce7e2908498bd7e9bb978d5ed9ab70c12ba79c45ddda65d0a302422f9f! Will try again. Installing initially failed dependencies...

Package installation failed... npm ERR! code 1 npm ERR! path /home/pi/MagicMirror/modules/MMM-Face-Reco-DNN npm ERR! command failed npm ERR! command sh -c pipenv install --site-packages

npm ERR! A complete log of this run can be found in: /home/pi/.npm/_logs/2023-10-25T10_06_23_908Z-debug-0.log

grssll commented 10 months ago

Hi @nischi I will try again from the scratch. BTW which OS you are on? Thanks

nischi commented 10 months ago

@grssll but also on your side the error tell me you do not use my branch. As you can see here, i changed the install command.

https://github.com/nischi/MMM-Face-Reco-DNN/compare/master...bugfix/install-issues

it is pipenv install --skip-lock instead of pipenv install --site-packages.

But in your error message they tell

npm ERR! command sh -c pipenv install --site-packages

grssll commented 10 months ago

@nischi Sorry, silly me. I've used master instead of bugfix.

grssll commented 10 months ago

This is what I did: cd ~/MagicMirror/modules/ git clone -b bugfix/install-issues https://github.com/nischi/MMM-Face-Reco-DNN.git cd MMM-Face-Reco-DNN npm ci

mmm-face-reco-dnn@2.0.0 postinstall pipenv install --skip-lock Installing dependencies from Pipfile...

Waited for 30min. Pi worked hard with the fan on full but stuck on above.

nischi commented 10 months ago

@grssll Which Pi do you have? i tried it with my Pi 4 8GB today and it took 15 minutes and complete successfully. What do you mean with stuck? is the still working on it or is he hanging? Because yes, it take a while

grssll commented 10 months ago

@nischi, Pi4 4gb. OS Bookworm wont install at all. OS Bullseye see photo below. This is as far as it goes and freezes. mmm

nischi commented 10 months ago

@grssll Did you do a fresh install? Because you have not the actual python version.

Not sure if this an issue. I do have after a clean installation of bullseye and an upgrade.

python 3.11 pip 23.0.1 pipenv 2022.12.19 setuptools 66.1.1

so a few major versions ahead of you. Is it possible that you can try to upgrade everything and try again or is it breaking something else maybe?

Sorry to ask you that, but i have no clue what it could be else.

grssll commented 10 months ago

Hi @nischi , When you have time can you test it on default 64bit Bullseye OS with python 3.9.2 ? Thank you

mikecheng2626 commented 10 months ago

Do you have the command for logitech webcam? I'm not using a picamera. I think that's the only thing I'm having trouble.

nischi commented 10 months ago

@grssll I will give a try, sure.

@mikecheng2626 I'm using the picamera2 library. Which says that they are compatible with the most webcams, also not picam. But an official supported device list is not existing. What kind of trouble do you have?

mikecheng2626 commented 10 months ago

It says I don't have picamera lol... cuz I'm using a C270 webcam right now

mikecheng2626 commented 10 months ago

Just did it this morning. Is this good? 1

nischi commented 9 months ago

@mikecheng2626 this looks correct yes. you do not need to activate it to install again. but you have no errors. But you told me above that it says "you have no picam" where do you got this error? While installation?

grssll commented 9 months ago

@mikecheng2626 Could you please explain step by step how did you get the module installed. I cant get past "installing dependecies" in my pi. Thanks

nischi commented 9 months ago

@grssll It is not that easy to downgrade from 3.11. If i do a fresh install from raspberry pi os i get python 3.11 as default. Can you try to update and try to run the install script again?

grssll commented 9 months ago

@nischi I have installed fresh Bullseye 32 and 64 bit from Pi imager and they all come wtih python 3.9. How is it possible that yours comes with 3.11? Is yours Bookworm OS? Cheers

nischi commented 9 months ago

@grssll

oh dear, you are right, i do have bookworm. I choosed simply the raspberry pi os 64 bit. thought that is bullseye. i'm very sorry. but i will try with bullseye now

image

nischi commented 9 months ago

@grssll it run through with bullseye and 3.9, but it fails with some compile issues. i will try now 3.10 and 3.11.

grssll commented 9 months ago

@nischi I'm doing Bookworm install now.

grssll commented 9 months ago

@grssll it run through with bullseye and 3.9, but it fails with some compile issues. i will try now 3.10 and 3.11.

Are you using master or bugfix? Thanks

grssll commented 9 months ago
> mmm-face-reco-dnn@2.0.0 postinstall
> pipenv install --skip-lock

Creating a virtualenv for this project...
Pipfile: /home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/Pipfile
Using /usr/bin/python3 (3.11.2) to create virtualenv...
⠏ Creating virtual environment...created virtual environment CPython3.11.2.final.0-64 in 397ms
  creator CPython3Posix(dest=/home/pi/.local/share/virtualenvs/MMM-Face-Reco-DNN-CBH8IAb2, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/pi/.local/share/virtualenv)
    added seed packages: pip==23.0.1, setuptools==66.1.1, wheel==0.38.4
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /home/pi/.local/share/virtualenvs/MMM-Face-Reco-DNN-CBH8IAb2
Installing dependencies from Pipfile...
An error occurred while installing face-recognition! Will try again.
An error occurred while installing numpy! Will try again.
An error occurred while installing opencv-python-headless! Will try again.
An error occurred while installing dlib! Will try again.
An error occurred while installing libpcap! Will try again.
An error occurred while installing picamera2! Will try again.
Installing initially failed dependencies...
Failed to install some dependency or packages.  The following have failed installation and attempted retry: [Requirement(_name='face-recognition', vcs=None, req=NamedRequirement(name='face-recognition', version='', req=Requirement.parse('face-recognition'), extras=[], editable=False, _parsed_line=<Line (editable=False, name=face-recognition, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=face-recognition)>), markers=None, _specifiers='', index=None, editable=False, hashes=frozenset(), extras=(), abstract_dep=None, _line_instance=<Line (editable=False, name=face-recognition, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=face-recognition)>, _ireq=None), Requirement(_name='numpy', vcs=None, req=NamedRequirement(name='numpy', version='', req=Requirement.parse('numpy'), extras=[], editable=False, _parsed_line=<Line (editable=False, name=numpy, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=numpy)>), markers=None, _specifiers='', index=None, editable=False, hashes=frozenset(), extras=(), abstract_dep=None, _line_instance=<Line (editable=False, name=numpy, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=numpy)>, _ireq=None), Requirement(_name='opencv-python-headless', vcs=None, req=NamedRequirement(name='opencv-python-headless', version='', req=Requirement.parse('opencv-python-headless'), extras=[], editable=False, _parsed_line=<Line (editable=False, name=opencv-python-headless, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=opencv-python-headless)>), markers=None, _specifiers='', index=None, editable=False, hashes=frozenset(), extras=(), abstract_dep=None, _line_instance=<Line (editable=False, name=opencv-python-headless, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=opencv-python-headless)>, _ireq=None), Requirement(_name='dlib', vcs=None, req=NamedRequirement(name='dlib', version='', req=Requirement.parse('dlib'), extras=[], editable=False, _parsed_line=<Line (editable=False, name=dlib, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=dlib)>), markers=None, _specifiers='', index=None, editable=False, hashes=frozenset(), extras=(), abstract_dep=None, _line_instance=<Line (editable=False, name=dlib, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=dlib)>, _ireq=None), Requirement(_name='libpcap', vcs=None, req=NamedRequirement(name='libpcap', version='', req=Requirement.parse('libpcap'), extras=[], editable=False, _parsed_line=<Line (editable=False, name=libpcap, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=libpcap)>), markers=None, _specifiers='', index=None, editable=False, hashes=frozenset(), extras=(), abstract_dep=None, _line_instance=<Line (editable=False, name=libpcap, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=libpcap)>, _ireq=None), Requirement(_name='picamera2', vcs=None, req=NamedRequirement(name='picamera2', version='', req=Requirement.parse('picamera2'), extras=[], editable=False, _parsed_line=<Line (editable=False, name=picamera2, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=picamera2)>), markers=None, _specifiers='', index=None, editable=False, hashes=frozenset(), extras=(), abstract_dep=None, _line_instance=<Line (editable=False, name=picamera2, path=None, uri=None, extras=(), markers=None, vcs=None, specifier=None, pyproject=None, pyproject_requires=None, pyproject_backend=None, ireq=picamera2)>, _ireq=None)]
npm ERR! code 1
npm ERR! path /home/pi/MagicMirror/modules/MMM-Face-Reco-DNN
npm ERR! command failed
npm ERR! command sh -c pipenv install --skip-lock

npm ERR! A complete log of this run can be found in: /home/pi/.npm/_logs/2023-10-30T08_13_11_439Z-debug-0.log
grssll commented 9 months ago

2023-10-30T08_13_11_439Z-debug-0.log

nischi commented 9 months ago

@grssll it run through with bullseye and 3.9, but it fails with some compile issues. i will try now 3.10 and 3.11.

Are you using master or bugfix? Thanks

I'm using bugfix

nischi commented 9 months ago

@grssll It seems pipenv has some issues to install this dependencies. If i do it complete without pipenv, it works fine. Not sure which package is not working properly. But i tried now everything without pipenv and now it installed smooth on bullseye with python 3.9. I changed the readme with the install instructions. Now i need to test it also with Bookworm and with a real camera.

sdetweil commented 9 months ago

changed the readme with the install instructions and chance you could make a script to do that instead of users having to figure it out too...

npm has a preinstall and postinstall step you can provide scripts to

nischi commented 9 months ago

@sdetweil I know, that's what i removed, because it didn't work with pipenv. Maybe i need to create a own install script. But for the meantime it is removed, till i get the module working properly.

sdetweil commented 9 months ago

ok, git it..

grssll commented 9 months ago

Bullseye 64bit went smooth. Will see how camera works. Bookworm 64bit fails on ''install python dependecies''

nischi commented 9 months ago

How does it fail? I had also some issues because this virtual environment stuff from python (not pipenv). And i extended the readme a little bit to create first a virtual environment and this worked then for me well

grssll commented 9 months ago

How does it fail? I had also some issues because this virtual environment stuff from python (not pipenv). And i extended the readme a little bit to create first a virtual environment and this worked then for me well

New docs works for the install but then when I'm trying to encode:

pi@raspberrypi:~/MagicMirror/modules/MMM-Face-Reco-DNN/tools $ npm run encode

> mmm-face-reco-dnn@2.0.0 encode
> python tools/encode.py -i dataset -e model/encodings.pickle

Traceback (most recent call last):
  File "/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/tools/encode.py", line 2, in <module>
    import face_recognition
ModuleNotFoundError: No module named 'face_recognition'
mikecheng2626 commented 9 months ago

@mikecheng2626 Could you please explain step by step how did you get the module installed. I cant get past "installing dependecies" in my pi. Thanks

I just followed your commands: cd ~/MagicMirror/modules/ git clone -b bugfix/install-issues https://github.com/nischi/MMM-Face-Reco-DNN.git cd MMM-Face-Reco-DNN npm ci

1st time I did it, it mentioned error and said there was no picamera detected

2nd time I did it again, it didn't say that anymore

nischi commented 9 months ago

@grssll i changed the install script again a little bit. You need to activate your virtual envornment of course. Sorry i missed this. But i found another issue that picamera from the virtual environment a library use which is not existing in pip. i will figure this out

nischi commented 9 months ago

@grssll I update again the install script and it works now for me with a virtual environment. I only need to test it with a real picamera and if this is working i think i can release the new version. If you wanna and have time, you can test it as well.

Thanks a lot for your support, it helped a lot. I hope it will work now for everybody.

camillemarius commented 9 months ago

@nischi It worked flawlessly for me on a newly installed 64-bit version of Bookworm on a Raspberry Pi 4GB with a real picamera. Remember to configure the PythonPath in the module-config. Thank you all!

grssll commented 9 months ago

@nischi Tried on both legacy and new 64bit. All went well. Camera module v2 works. Ordered to test module v3. Thanks for all the work you did for the community. Can I buy you a couple coffee's as appreciation? Thanks

marivan38 commented 9 months ago

Hi all just a quick question at one point it was asking for the face_recognition when trying to encode and I manually installed it.. is that now part of the install script? I am planning on wiping and starting from scratch again and I don't use a virtual environment and it seemed to work well with the 64bit bookworm OS.

Thanks in advanced

nischi commented 9 months ago

@grssll Thank you very much for your testing. Happy to hear that it worked. I will try with my camera today as well, but if you say it works it should work. Btw: i do have a pi camera v3. So i will test it :) Thank you for your offer, but it's fine, thank you very much :)

@marivan28 with the next version i release it will not have an install-script anymore. because with pipenv it was not working properly. so you need to install it manually. But i will have a short install description in the readme. For me in bookworm os it forced me to use an virtual envornment, or i disable the whole mechanism. But also this will be part of the install script.