Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canvas Install Errors #4

Closed
jmorris644 opened this issue Jan 26, 2020 · 18 comments
Closed

Canvas Install Errors #4

jmorris644 opened this issue Jan 26, 2020 · 18 comments
Labels
canvas solved This issue has been solved

Comments

@jmorris644
Copy link

I am getting canvas install errors when the install tries to create some sub directories under node_modules. I am getting permission errors.

I ran the install with sudo. I also tried creating all of the canvas directories ahead of time but still failing.

Joe

@thebigpotatoe
Copy link
Owner

Hmm, interesting. I haven't played with this repo in a while. Maybe canvas has updated.

What platform are you using for this. A raspberry pi?

@jmorris644
Copy link
Author

Yes, on a Pi.

@jmorris644
Copy link
Author

I have also tried a direct install of canvas and with the --build-from-source option as well. I am using sudo but still getting permission errors.

@thebigpotatoe
Copy link
Owner

This sounds like a canvas issue then, not so much this repo. I just popped over to the canvas GitHub page, and I can't see any open issues regards a pi install.

I don't usually built with the pi for these reasons, its just annoying to debug. It certainly seems though from your description that's it's just permission errors so maybe googling around on how to build the canvas package could bring up some more results?

When I get some spare time I want to install this on a pi so I can use it as a remote server. Until then I'm afraid I'm not going to be much help.

@thebigpotatoe
Copy link
Owner

Just having a look around, did you follow this at all?

@jmorris644
Copy link
Author

Yes. I have tried everything that I am able to find via searching. It is definitely Canvas itself.
When I find a solution I will post it here.

@thebigpotatoe
Copy link
Owner

Ah annoying,

Any chance you can post a log of the install, see if there is any relevant info in that?

@jmorris644
Copy link
Author

I read somewhere that you need to be root to install canvas. I tried that and it worked.

Everything in the log was simple permission errors to create sub directories. Even though I was using Sudo.

@jmorris644
Copy link
Author

Also, in your README.md you might want to mention the additional nodes that need to get installed for your flow to work. Took me a little bit to find the Image one.

@thebigpotatoe
Copy link
Owner

Also, in your README.md you might want to mention the additional nodes that need to get installed for your flow to work. Took me a little bit to find the Image one.

Apologies for this, I thought I had for this repo, but ust have been thinking of another. Ill fix that up now.

I read somewhere that you need to be root to install canvas. I tried that and it worked.

Good news. Does this allow you to run the node correctly now?

@jmorris644
Copy link
Author

Good news. Does this allow you to run the node correctly now?

yes

@thebigpotatoe
Copy link
Owner

Awesome, glad its working then. I will close and pin this for others. Thanks for the info.

@efmopa
Copy link

efmopa commented Jun 30, 2020

Además, en su archivo README.md es posible que desee mencionar los nodos adicionales que deben instalarse para que su flujo funcione. Me llevó un poco encontrar la imagen.

please, where is the readme.md file?

@manolisstam
Copy link

trying to install on pi4, not working!
npm ERR! canvas@2.6.1 install: node-pre-gyp install --fallback-to-build

@thebigpotatoe
Copy link
Owner

Have a look at the other issues for canvas install errors.

#4 (comment)

@manolisstam
Copy link

Have a look at the other issues for canvas install errors.

#4 (comment)

thank you so much for your answer,
tried root npm but nothing good. on ubuntu there is no problem but in pi4.... i could not make it

@thebigpotatoe
Copy link
Owner

I have been meaning to look into this as I have migrated all of my operations to embedded recently (mostly pi 4).

If it works on linux but not the Pi, my guess is its the ARM architecture that's the issue.

Seems there are a few issues related to ARM over on the canvas repo which might suggest this is the error as well:

Automattic/node-canvas#1662

When I first built this node, I really tried to get rid of canvas to make it more portable, but unfortunately Face-API.js uses its functionality with no way around it.

In the mean time if you manage to find a solution feel free to post it back here, or make a pull :)

@timdonovanuk
Copy link

timdonovanuk commented Apr 19, 2021

Hello, me again :) Thought I'd take a look at this.

19 Apr 20:39:23 - [info] Installing module: node-red-contrib-face-recognition, version: 1.3.3
19 Apr 20:39:33 - [warn] Installation of module node-red-contrib-face-recognition failed:
19 Apr 20:39:33 - [warn] ------------------------------------------
19 Apr 20:39:33 - [warn] npm WARN deprecated node-pre-gyp@0.15.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://github.com/Automattic/node-canvas/releases/download/v2.7.0/canvas-v2.7.0-node-v64-linux-musl-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for canvas@2.7.0 and node@10.24.1 (node-v64 ABI, musl) (falling back to source compile with node-gyp) 
/bin/sh: pkg-config: not found
gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error 
gyp ERR! stack Error: `gyp` failed with exit code: 1

I'm running the latest node-red docker image (official) and just being root isn't enough. There is no canvas (or issues building it) on alpine (the distro the node-red container runs on).

To fix issues open a terminal into the node-red container and run:

apk add --no-cache \
    python \
    g++ \
    build-base \
    cairo-dev \
    jpeg-dev \
    pango-dev \
    musl-dev \
    giflib-dev \
    pixman-dev \
    pangomm-dev \
    libjpeg-turbo-dev \
    freetype-dev \
    && npm install canvas@2.6.0

You can then install node-red-contrib-face-recognition into node-red:

19 Apr 20:44:30 - [info] Installing module: node-red-contrib-face-recognition, version: 1.3.3
19 Apr 20:44:51 - [info] Installed module: node-red-contrib-face-recognition
19 Apr 20:44:51 - [info] [Face-api.js] - TensorFlow.js for Node.js was not found, running without it
19 Apr 20:44:51 - [info] [Face-api.js] - Loading Models
19 Apr 20:44:51 - [info] [Face-a-pi.js] - Created descriptors directory at /data/node_modules/node-red-contrib-face-recognition/descriptors
============================
Hi there 👋. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.
============================
19 Apr 20:44:51 - [info] Added node types:
19 Apr 20:44:51 - [info]  - node-red-contrib-face-recognition:face-api-input
19 Apr 20:44:51 - [info]  - node-red-contrib-face-recognition:face-api-compute
19 Apr 20:44:53 - [info] [Face-api.js] - Models Loaded

Hurray! Yet to confirm the nodes actually work of course..but...baby steps!

Edit:

Terrifying!

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
canvas solved This issue has been solved
Projects
None yet
Development

No branches or pull requests

5 participants