Nextcloud, Memories and Tensorflow issues

Problem

I use Nextcloud with the Memories app on NixOS. I have libtensorflow in my environment.systemPackages but still get the following notice on the Recognize settings page:

Could not load libtensorflow in Node.js. You can try to manually install libtensorflow or run in WASM mode.

I also get this error when running nextcloud-occ recognize:classify:

Classifier process output: Error: libtensorflow.so.2: cannot open shared object file: No such file or directory
    at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/mnt/data/nextcloud/store-apps/recognize/node_modules/@tensorflow/tfjs-node-gpu/dist/index.js:72:16)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Any idea what’s going on and how to fix it?

System Details

  • nextcloud 27.1.5
  • memories 5.0.3
  • nodejs 18.18.2
  • tensorflow 2.13.0

Recognize downloads the libtensorflow that it needs. The only two packages that I have have in my environment.systemPackages are ffmpeg and nodejs_18. On the recognize admin settings page I have the node.js path set to /run/current-system/sw/bin/node. Be sure to run the nextcloud-occ recognize:download-models. You can also try running nextcloud-occ maintenance:repair. I feel like that fixed a few things after a recent update.

I am running nextcloud 28 and Recognize 6.0.1.

Thanks for the swift reply.

Yep, I’ve got those there too.

Got this.

I ran that a while back. The admin page says this:

The machine learning models have been downloaded successfully.

I tried it anyway. Didn’t make a difference.

Gave it a go. Everything looked fine until this:

 - Install recognize dependencies
     - WARNING: Failed to automatically install dependencies for recognize. Check the recognize admin panel for potential problems.
 - Force-reset all Text sessions before Yjs migration
 - Initialize migration of background images from dashboard to theming app
     - ERROR: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 7 no connection to the server
 - Add background job to check for backup codes
     - ERROR: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 7 no connection to the server
 - Populating added database structures for workflows
     - ERROR: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 7 no connection to the server

So there’s something wrong with the DB connection. I presume it’s unrelated but it’s blocking any progress here. Gotta fix that.

EDIT

Fixed the DB issue (got rid of idle_session_timeout = 3000 in my psql config) and then noticed a different message in the UI mentioning that libtensorflow was correctly loaded but GPU mode wasn’t working. Since I don’t have an nvidia card, I presume GPU mode is not supported. I just flipped that toggle and now everything is green!

Unfortunately I’m not really sure what the issue and/or fix was. Presumably something in nextcloud-occ maintenance:repair. Anyway, thanks for helping me get there!

Hi.

I have recognize installed via pkgs.fetchNextcloudApp
and I have issue with models:

# nextcloud-occ recognize:download-models
Failed to download models
Unable to open "/nix/store/82wpw01yl3nkacq6yxr0dh84q4jmajfc-nextcloud-app-recognize-6.1.1/lib/Service/../../models.tar.gz" using mode "w+": 
fopen(/nix/store/82wpw01yl3nkacq6yxr0dh84q4jmajfc-nextcloud-app-recognize-6.1.1/lib/Service/../../models.tar.gz): Failed to open stream: Read-only file system

It’s because store is readonly. So do you have recognize installed from nextcloud store?

Yes, all my nextcloud apps are installed from the store. I have snapshots and backups of the whole /var/lib/nextcloud directory and the database if I ever need to reinstall.