matiasdelellis / facerecognition

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

docker: The library bz2 is not available. #668

Open backupandforkacc opened 1 year ago

backupandforkacc commented 1 year ago

Expected behaviour

Face Recognition app should be installed

Actual behaviour

Installation aborts with error: App "Face Recognition" cannot be installed because the following dependencies are not fulfilled: The library bz2 is not available.

Steps to reproduce

  1. build docker container as shown here
  2. Try to install app from app installation menu (see screenshot)
  3. "App "Face Recognition" cannot be installed because the following dependencies are not fulfilled: The library bz2 is not available. "

grafik

I found an issue with similiar topic, but seems to me that this should be fixed.

Server configuration

Client configuration

Logs

Log from pdlib test.

<First we try to open the models... Done

Processing file: input/Big Bang Theory.jpg Number of faces detected: 3 Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Processing file: input/Big Bang Theory.png Number of faces detected: 7 Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done Face landmarks... Done Face descriptor... Done>

sudo -u apache php occ -vvv face:background_job
backupandforkacc commented 1 year ago

I now tried the dockerfile from here but I still have en error:

 www-data@b717e673fce5:~/html$ php occ face:setup -M 715827883B
System memory: 7.2 GB (7712768000B)
Memory assigned to PHP: 512 MB (536870912B)

Minimum value to assign to image processing.: 682.7 MB (715827882B)
Maximum value to assign to image processing.: 512 MB (536870912B)

Cannot assign more memory than the maximum...

but the php configuration shows a limit of 1024MB. So memory-limit.ini shows memory_limit=1024M and nextcloud.ini just relates to the momory limit of php:

memory_limit=${PHP_MEMORY_LIMIT}
upload_max_filesize=${PHP_UPLOAD_LIMIT}
post_max_size=${PHP_UPLOAD_LIMIT}

file from here:

root@b717e673fce5:/usr/local/etc/php/conf.d# ls
docker-php-ext-apcu.ini    docker-php-ext-gd.ini       docker-php-ext-ldap.ini       docker-php-ext-pdlib.ini      docker-php-ext-sodium.ini   nextcloud.ini
docker-php-ext-bcmath.ini  docker-php-ext-gmp.ini      docker-php-ext-memcached.ini  docker-php-ext-pdo_mysql.ini  docker-php-ext-sysvsem.ini  opcache-recommended.ini
docker-php-ext-bz2.ini     docker-php-ext-imagick.ini  docker-php-ext-opcache.ini    docker-php-ext-pdo_pgsql.ini  docker-php-ext-zip.ini
docker-php-ext-exif.ini    docker-php-ext-intl.ini     docker-php-ext-pcntl.ini      docker-php-ext-redis.ini      memory-limit.ini
root@b717e673fce5:/usr/local/etc/php/conf.d# nano memory-limit.ini
root@b717e673fce5:/usr/local/etc/php/conf.d# nano nextcloud.ini

But php says the limit is 512MB:

root@b717e673fce5:/var/www/html# php -r "echo ini_get('memory_limit').PHP_EOL;"
512M
# php --ini
Configuration File (php.ini) Path: /usr/local/etc/php
Loaded Configuration File:         (none)
Scan for additional .ini files in: /usr/local/etc/php/conf.d
Additional .ini files parsed:      /usr/local/etc/php/conf.d/docker-php-ext-apcu.ini,
/usr/local/etc/php/conf.d/docker-php-ext-bcmath.ini,
/usr/local/etc/php/conf.d/docker-php-ext-bz2.ini,
/usr/local/etc/php/conf.d/docker-php-ext-exif.ini,
/usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
/usr/local/etc/php/conf.d/docker-php-ext-gmp.ini,
/usr/local/etc/php/conf.d/docker-php-ext-imagick.ini,
/usr/local/etc/php/conf.d/docker-php-ext-intl.ini,
/usr/local/etc/php/conf.d/docker-php-ext-ldap.ini,
/usr/local/etc/php/conf.d/docker-php-ext-memcached.ini,
/usr/local/etc/php/conf.d/docker-php-ext-opcache.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdlib.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-redis.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/docker-php-ext-sysvsem.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini,
/usr/local/etc/php/conf.d/docker-php-ram-limit.ini,
/usr/local/etc/php/conf.d/nextcloud.ini,
/usr/local/etc/php/conf.d/opcache-recommended.ini
# ls -lh /usr/local/etc/php
total 91K
drwxr-xr-x 2 root root  25 May 27 09:39 conf.d
-rw-r--r-- 1 root root 72K May 27 10:56 php.ini-development
-rw-r--r-- 1 root root 72K May 27 10:55 php.ini-production

And in php.ini-development, I have a line:

; Maximum amount of memory a script may consume
; https://php.net/memory-limit
memory_limit = 1024M
backupandforkacc commented 1 year ago

ok next step: I added ENV PHP_MEMORY_LIMIT=1GB to the Dockerfile.

Now I can set higher php limits. But then when setting up the model, I get (I execute it as www-data in container):

php occ face:setup -m 1

The model 1 (Default) will be installed

In FileService.php line 392:

  The file //appdata_oc7g2bq3dse1/facerecognition/models//1/mmod_human_face_detector.dat exists or is not writable

face:setup [-M|--memory MEMORY] [-m|--model MODEL]

When I do exactly what is written in the docs:

$ docker exec -it -u www-data nextcloud_fr ./occ face:setup --model 1
OCI runtime exec failed: exec failed: unable to start container process: exec: "./occ": permission denied: unknown

There is no folder models in the app folder:

root@simon-itx:/docker/volumes/ncdata/_data/nextcloud/apps/facerecognition# ls
appinfo  CHANGELOG.md  css  img  ISSUE_TEMPLATE.md  js  l10n  lib  LICENSE  psalm.xml  README.md  templates  TESTING.md
Cebrain commented 10 months ago

Use this new Way to install pdlib and bz2. Worked great for me https://github.com/matiasdelellis/facerecognition/issues/693