question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not detect the Python executable based on `npm config ls`

See original GitHub issue

I am on Windows, and I have Python 3 in the command line for general Python programming.

$ python --version
Python 3.5.1 :: Continuum Analytics, Inc.

To enable node-gyp, I use windows-build-tools to install Python 2 and configure npm as desired:

$ npm config ls
scope = ""
user-agent = "npm/4.3.0 node/v6.3.1 win32 x64"

msvs_version = "2015"
python = "C:\\Users\\username\\.windows-build-tools\\python27\\python.exe"

prefix = "C:\\Users\\username\\AppData\\Roaming\\npm"

I still get the following error while running electron-rebuild because electron-rebuild could not find the correct Python 2 based on npm config ls:

$ npm install zerorpc # the package I could not bind to electron
$ npm install electron electron-rebuild

$ ./node_modules/.bin/electron-rebuild
× Rebuild Failed
An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.5.0
gyp info using node@6.3.1 | win32 | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Anaconda3\python.EXE", you can set the PYTHON env variable.
...

Expected result: no errors, and the package could detect the Python 2 executable properly.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
abhideshmukhcommented, Sep 19, 2017

It is not compatible with python 3.x.x . Try to install ^2.7.x (the lest one).

0reactions
autotelcommented, Apr 25, 2018

For people who have the latest version of python, the error message doesn’t help much. It should tell that there is no python, or its version is not compatible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not detect the Python executable based on `npm config ls`
I am on Windows, and I have Python 3 in the command line for general Python programming. $ python --version Python 3.5.1 ::...
Read more >
Running Python on Windows for Node.js dependencies
Run the following command using a cmd npm config set python C:\Users\jorge\AppData\Local\Programs\Python\Python310\python.exe. Change the path to your directory.
Read more >
npm config set python | The Search Engine You Control
npm - "Can't find Python executable "python", you can set the PYTHON env variable." Asked Dec 19, 2015 • 110 votes 15 answers....
Read more >
config | npm Docs
Run npm config ls -l to see a set of configuration parameters that are internal to npm, and are defaults if nothing else...
Read more >
HomeAssistant palette installation error - Node-RED Forum
But it might be worth trying at the command line npm config set python $(which python) and then try again to install the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found