Tfjs: Windows nodejs installation seems to be missing python...

Created on 28 Sep 2018  路  11Comments  路  Source: tensorflow/tfjs

TensorFlow.js version

0.13.2

Browser version

Nodejs 0.1.17

Describe the problem or feature request

As described in docs I tried to install

npm install @tensorflow/tfjs-node
C:\xxxxxx\models>npm install @tensorflow/tfjs-node

> @tensorflow/[email protected] install C:\xxxxxx\models\node_modules\@tensorflow\tfjs-node
> node scripts/install.js

* Downloading libtensorflow
[==============================] 1002429/bps 100% 0.0s
* Building TensorFlow Node.js bindings
C:\xxxxxx\models\node_modules\@tensorflow\tfjs-node\scripts\install.js:154
      throw new Error('node-gyp rebuild failed with: ' + err);
      ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

I was specting some sort of wrapper over the tensorflow binaries not having yo use python at all.
So, if python its needed instructions to install Node are not in shape.

node.js

Most helpful comment

@nkreeger thanks for the support.

Here is my experience. using npm install --global --production windows-build-tools I ended up in a unfinished waiting for ever installation, despite that I run the CMD with administrator privileges.
I have seen that bug also in that repo, mainly because you had python installed and other issues.

WHAT worked for me was installing Visual Studio 2017 and RUN

npm config set msvs_version 2017

I even had 2017 installed on my machine but it did not work until I run the npm command.

All 11 comments

Hi David..
Got the same error..
I was able to install successfully after Installation of Windows build tools
npm install -g windows-build-tools.
You can check that..

Hi @gmanojisaac, thanks for the reply. windows-build-tools installs python plus visual C++ libraries.
Of course I can install python, that's not my problem. My problem is why the npm package don't release .so/dll binaries for every OS to install tensorflow under nodejs. At the end tfjs for node is a wrapper over the Tensorflow binaries, right? If that would be the case I don't see the need of installing python. I'm checking how to fix this ISSUE.

node-gyp and windows requires Python 2.7 - 3.x does not work. Please install 2.7.

Hi @nkreeger thanks for the reply.
I saw it yesterday, I saw that the install.js dowloads the tf binaries and then builds the wrapper using gyp. I think that would be interesting to see the wrapper tied to the binaries. Specially because seems that the install just downloads the latest binaries and the wrapper may need the exact version on the tf binaries. Thanks for the help.

There is also another error after python seems to be a dependency with .NET framework

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\David\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\David\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\xxxxx\models\node_modules\@tensorflow\tfjs-node
gyp ERR! node -v v10.5.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

    at cp.exec (C:\xxxxx\models\node_modules\@tensorflow\tfjs-node\scripts\install.js:154:13)
    at ChildProcess.exithandler (child_process.js:298:5)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:961:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
npm WARN [email protected] No repository field.
npm WARN [email protected] scripts['server'] should probably be scripts['start'].
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

gyp is trying to build this

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe build/binding.sln /nologo /p:Configuration=Release;Platform=x64

however I cant find the .sln file in the repo. It's downloaded?

@nkreeger definitely windows does not work at all.
I tried installation on Windows 10 and windows 7 with python 2.7.15 y node 8.x on different machines

The result is always the same stack trace:

gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej
s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\nodetfjs\node_modules\@tensorflow\tfjs-
node
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Procedure just install a very basic project:
nodetfjs.zip

npm install 
npm install @tensorflow/tfjs-node

Try running this:

npm install --global --production windows-build-tools

Or manually installing MSVC as detailed in the README on node-gyp: https://github.com/nodejs/node-gyp

The .sln file is generated by node-gyp.

@nkreeger thanks for the support.

Here is my experience. using npm install --global --production windows-build-tools I ended up in a unfinished waiting for ever installation, despite that I run the CMD with administrator privileges.
I have seen that bug also in that repo, mainly because you had python installed and other issues.

WHAT worked for me was installing Visual Studio 2017 and RUN

npm config set msvs_version 2017

I even had 2017 installed on my machine but it did not work until I run the npm command.

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisdonahue picture chrisdonahue  路  3Comments

nsthorat picture nsthorat  路  3Comments

rumschuettel picture rumschuettel  路  3Comments

lastnod picture lastnod  路  3Comments

take-kuma picture take-kuma  路  3Comments