matiasdelellis / facerecognition

Nextcloud app that implement a basic facial recognition system.
GNU Affero General Public License v3.0
500 stars 45 forks source link

Internal Server Error in admin panel / {"Exception":"Error","Message":"Class \"CnnFaceDetection\" not found" #704

Closed marcopolousa closed 1 month ago

marcopolousa commented 8 months ago

Admin page should load normally, but instead, it generates an internal server error.

Ubuntu 22.04 installation with Nextcloud 27.1.2 php 8,2 installed via: sudo add-apt-repository ppa:ondrej/php nginx and postgres;l pdlib version 1.1.0 installed with

cd ~ git clone https://github.com/goodspb/pdlib.git cd pdlib phpize PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --enable-debug make sudo make install

dlib installed with

cd ~ apt install -y cmake git clone https://github.com/davisking/dlib.git cd dlib/dlib mkdir build cd build cmake -DBUILD_SHARED_LIBS=ON .. apt install -y libopenblas-dev liblapack-dev libavdevice-dev libavfilter-dev libavformat-dev libavcodec-dev libswresample-dev libswscale-dev libavutil-dev make sudo make install

pdlib and dlib are functioning correctly based on test script found at https://github.com/matiasdelellis/pdlib-min-test-suite

Models 1-4 are installed, and all models have been chosen as default, but error message is the same. Memory and other options have been made using 'occ' command line tool. Personal option page for Face Recognition is working correctly, and "Analyze my images" option is selected. Admin page for Face Recognition results in error message:

_Internal Server Error

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log. Technical details

Remote Address: 102.129.152.203 Request ID: YzNb5zMdNODleUlu6pc2_

Unable to configure the temporary area for image processing due to admin page not being accessible, resulting in this error:

sudo -u www-data php /var/www/html/nextcloud/occ face:background_job

_1/8 - Executing task CheckRequirementsTask (Check all requirements) Seems that still don't configured the image area used for temporary files. Please read the documentation about this: https://github.com/matiasdelellis/facerecognition/wiki/Settings#temporary-files and then configure it in the admin panel to continue

Fill an issue here if that doesn't help: https://github.com/matiasdelellis/facerecognition/issues Task CheckRequirementsTask signalled we should not continue, bailing out set up face recognition settings

sudo -u www-data php /var/www/html/nextcloud/occ app:install facerecognition --force sudo -u www-data php /var/www/html/nextcloud/occ app:enable facerecognition --force sudo -u www-data php /var/www/html/nextcloud/occ face:setup -M 7.5G sudo -u www-data php /var/www/html/nextcloud/occ face:setup --model 1 sudo -u www-data php /var/www/html/nextcloud/occ face:setup --model 2 sudo -u www-data php /var/www/html/nextcloud/occ face:setup --model 3 sudo -u www-data php /var/www/html/nextcloud/occ face:setup --model 4 sudo -u www-data php /var/www/html/nextcloud/occ config:app:set facerecognition sensitivity --value 0.4 sudo -u www-data php /var/www/html/nextcloud/occ config:app:set facerecognition max_image_area --value 786432 sudo -u www-data php /var/www/html/nextcloud/occ config:app:set facerecognition handle_external_files --value true sudo -u www-data php /var/www/html/nextcloud/occ config:app:set facerecognition handle_shared_files --value false sudo -u www-data php /var/www/html/nextcloud/occ config:app:set facerecognition min_image_size --value 128

Nextcloud logs show:

"File":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Class "CnnFaceDetection" not found","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/facerecognition/lib/Settings/Admin.php","line":81,"function":"open","class":"OCA\FaceRecognition\Model\DlibCnnModel\DlibCnnModel","type":"->"},{"file":"/var/www/html/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":129,"function":"getForm","class":"OCA\FaceRecognition\Settings

ExionDev commented 8 months ago

Im having the same issue

riveragluis commented 8 months ago

Same issue. Any solution or walk around?

lelehier commented 8 months ago

same here :(

Erreur32 commented 8 months ago

Same issue

pdlib and dlib are functioning correctly based on test script found at https://github.com/matiasdelellis/pdlib-min-test-suite

Is working also.

javiersteg commented 7 months ago

Same issue. pdlib test works fine: Exception: Class "CnnFaceDetection" not found in file '/var/www/nextcloud/apps/facerecognition/lib/Model/DlibCnnModel/DlibCnnModel.php' line 179

Using -m 3 on the occ tool to change the method. Class "FaceLandmarkDetection" not found in file '/var/www/nextcloud/apps/facerecognition/lib/Model/DlibHogModel/DlibHogModel.php'

I'm not sure if putting thoose errors helps.

ezmanboy commented 7 months ago

same here :(

kidfruit commented 7 months ago

same issue

ubuntu 22.04 php8.1 nextcloud 27.1.4 facerecognition 0.9.31

kidfruit commented 7 months ago

same issue

ubuntu 22.04 php8.1 nextcloud 27.1.4 facerecognition 0.9.31

I solve this in my server.

Custom install in ubuntu22.04, after installed pdlib, we must add extension=pdlib.so to php.ini I checked /etc/php/8.1/mod-available, there is pdlib.ini, and has linked to /etc/php/8.1/cli/conf.d and /etc/php/8.1/fpm/conf.d, but in /etc/php/8.1/apache2/conf.d it's not there, so I create a link ln -s /etc/php/8.1/mods-available/pdlib.ini /etc/php/8.1/apache2/conf.d/20-pdlib.ini

It works.

brccabral commented 6 months ago

same here, pdlib.ini did not work

Technical details

    Remote Address: 127.0.0.1
    Request ID: ldl72a6wO9TvSgSSKXwX
    Type: Exception
    Code: 0
    Message: Class "CnnFaceDetection" not found in file '/mnt/HDExtra/nextcloud-server/nextcloud/apps/facerecognition/lib/Model/DlibCnnModel/DlibCnnModel.php' line 197
    File: /mnt/HDExtra/nextcloud-server/nextcloud/lib/private/AppFramework/Http/Dispatcher.php
    Line: 169

Trace

#0 /mnt/HDExtra/nextcloud-server/nextcloud/lib/private/AppFramework/App.php(184): OC\AppFramework\Http\Dispatcher->dispatch()
#1 /mnt/HDExtra/nextcloud-server/nextcloud/lib/private/Route/Router.php(315): OC\AppFramework\App::main()
#2 /mnt/HDExtra/nextcloud-server/nextcloud/lib/base.php(1069): OC\Route\Router->match()
#3 /mnt/HDExtra/nextcloud-server/nextcloud/index.php(39): OC::handleRequest()
#4 {main}

Previous

#0 /mnt/HDExtra/nextcloud-server/nextcloud/apps/facerecognition/lib/Settings/Admin.php(81): OCA\FaceRecognition\Model\DlibCnnModel\DlibCnnModel->open()
#1 /mnt/HDExtra/nextcloud-server/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php(129): OCA\FaceRecognition\Settings\Admin->getForm()
#2 /mnt/HDExtra/nextcloud-server/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php(86): OCA\Settings\Controller\AdminSettingsController->formatSettings()
#3 /mnt/HDExtra/nextcloud-server/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php(149): OCA\Settings\Controller\AdminSettingsController->getSettings()
#4 /mnt/HDExtra/nextcloud-server/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php(71): OCA\Settings\Controller\AdminSettingsController->getIndexResponse()
#5 /mnt/HDExtra/nextcloud-server/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(230): OCA\Settings\Controller\AdminSettingsController->index()
#6 /mnt/HDExtra/nextcloud-server/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(137): OC\AppFramework\Http\Dispatcher->executeController()
#7 /mnt/HDExtra/nextcloud-server/nextcloud/lib/private/AppFramework/App.php(184): OC\AppFramework\Http\Dispatcher->dispatch()
#8 /mnt/HDExtra/nextcloud-server/nextcloud/lib/private/Route/Router.php(315): OC\AppFramework\App::main()
#9 /mnt/HDExtra/nextcloud-server/nextcloud/lib/base.php(1069): OC\Route\Router->match()
#10 /mnt/HDExtra/nextcloud-server/nextcloud/index.php(39): OC::handleRequest()
#11 {main}
brccabral commented 6 months ago

I was able to make it work. After adding the pdlib.ini I also restarted the php8.1-fpm service

sudo systemctl start php8.1-fpm

My Nginx has to point to the correct socket location

    upstream php-handler {
        server unix:/run/php/php8.1-fpm.sock;
    }

Now it works.

matiasdelellis commented 6 months ago

Hi everyone, Excuse me. I'm very busy. 😞

From what I see in your messages, pdlib is not configured correctly.

Do you all use Ubuntu? Remember that you must enable pdlib both in the cli and in the server you are using.

https://github.com/matiasdelellis/facerecognition/wiki/PDlib-Installation#pdlib-configuration

axeljerabek commented 5 months ago

Not Ubuntu, Debian 12 Bookworm here. This seems to have popped up when I upgraded to php8.3 It dies with a segmentation fault.

axeljerabek commented 5 months ago

It is not php8.3. Also all the older versions do not work for me anymore. Just before anyone tries to install older ones.

Tux61 commented 2 months ago

I've had the same problem (debian 12, php8.2) I had added "pdlib.so" to the php.ini file in the "cli" and "apache2" directories, but I still got the same message.

Then I thought of php.ini in the fpm directory ! And bingo, the problem's been solved !

CebirSoftware commented 2 months ago

Try to call sudo phpenmod pdlib Then restart apache/nginx/php-fpm

Tux61 commented 2 months ago

Thank you very much for the reply, but as indicated in my message the problem has been solved by adding "pdlib.so" to the php.ini file in the /etc/php8.2/fpm directory. Very happy !

matiasdelellis commented 1 month ago

I understand that everyone fixed it. In general they are problems with enabling pdlib. 🙈

axeljerabek commented 2 weeks ago

Unfortunately, this error is still present for me. I have two nextcloud installations (now V 29.0.2) and Facerecognition 0.9.51. One nextcloud shows the administration panel for Facerecognition, the other nextcloud instance is responding with an internal error:

{"reqId":"zrImrfkcYSahG7syLbs6","level":3,"time":"2024-06-19T07:16:34+00:00","remoteAddr":"192.168.178.21","user":"axel","app":"index","method":"GET","url":"/settings/admin/facerecognition","message":"Class \"CnnFaceDetection\" not found in file '/var/www/nextcloud/apps/facerecognition/lib/Model/DlibCnnModel/DlibCnnModel.php' line 174","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36","version":"29.0.2.2","exception":{"Exception":"Exception","Message":"Class \"CnnFaceDetection\" not found in file '/var/www/nextcloud/apps/facerecognition/lib/Model/DlibCnnModel/DlibCnnModel.php' line 174","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1050,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":49,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":170,"Previous":{"Exception":"Error","Message":"Class \"CnnFaceDetection\" not found","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/facerecognition/lib/Model/DlibCnnHogModel/DlibCnnHogModel.php","line":104,"function":"open","class":"OCA\FaceRecognition\Model\DlibCnnModel\DlibCnnModel","type":"->"},{"file":"/var/www/nextcloud/apps/facerecognition/lib/Settings/Admin.php","line":84,"function":"open","class":"OCA\FaceRecognition\Model\DlibCnnHogModel\DlibCnnHogModel","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":140,"function":"getForm","class":"OCA\FaceRecognition\Settings\Admin","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php","line":93,"function":"formatSettings","class":"OCA\Settings\Controller\AdminSettingsController","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/CommonSettingsTrait.php","line":165,"function":"getSettings","class":"OCA\Settings\Controller\AdminSettingsController","type":"->"},{"file":"/var/www/nextcloud/apps/settings/lib/Controller/AdminSettingsController.php","line":77,"function":"getIndexResponse","class":"OCA\Settings\Controller\AdminSettingsController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"index","class":"OCA\Settings\Controller\AdminSettingsController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":338,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1050,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":49,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/facerecognition/lib/Model/DlibCnnModel/DlibCnnModel.php","Line":174},"message":"Class \"CnnFaceDetection\" not found in file '/var/www/nextcloud/apps/facerecognition/lib/Model/DlibCnnModel/DlibCnnModel.php' line 174","exception":{},"CustomMessage":"Class \"CnnFaceDetection\" not found in file '/var/www/nextcloud/apps/facerecognition/lib/Model/DlibCnnModel/DlibCnnModel.php' line 174"}}

Facerecognition itself works flawless though. It detects faces and groups those. I just cannot access the admin panel and do any adjustments therefore.

Best regards, Axel

matiasdelellis commented 2 weeks ago

Hi @axeljerabek In settings/admin/serverinfo, you can check if the extension is correctly enabled.

What distribution you use? Remember that there are systems where you have to enable the PHP extension for the web server and for the CLI separately.

But is weird that in 0.9.51 I added a patch that should fix it so that at least it doesn't show you that error. 🤔