MichaelAquilina / python-tools

:wrench: Atom plugin which uses jedi to provide numerous tools useful for developing python code in atom.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python-tools was unable to find your machine's python executable.

fgthct opened this issue · comments

python-tools was unable to find your machine's python executable.

Please try set the path in package settings and then restart atom.

If the issue persists please post an issue on https://github.com/michaelaquilina/python-tools/issues/new

This is my path with python executable

import sys
print(sys.executable)
/usr/bin/python3

But the error persists.
why?

I was able to fix this issue by leaving the python-tools custom executable blank and then using

ln -sf /usr/bin/python3 /usr/bin/python

to create a symbolic link with just python pointing to my python3 executable.

In the source code python-tools.coffee, line 90:

this.provider = require('child_process').spawn(
      'python', [__dirname + '/tools.py'], env: env
    )

The child_process.spawn is given just "python" as the executable name, so if you have a python3 in your env it will not work.

Hmm..… if this is the correct answer, the settings info should be changed. It currently implies that e.g., python2.7 would be a reasonable entry to the path to python entry. Or is that supposed to just be the directory of the executable? Ubuntu still uses python3 as an executable name, so this should be resolved systematically.

Neither /usr/bin/python3 (the result of which python3) nor /usr/bin/ (just the directory) in the python-tools settings "path to python directory" resolves this error. Since one of these should be the correct answer (on my machine) to the error message ("Please try set the path in package settings and then restart atom."), either the use of that field, or the error message telling us to use it, should be changed.

perhaps the best answer for ubuntu users is sudo apt-get install python-is-python3, which does the symlink suggested by jmobley0429 above, but in a way that ubuntu would expect (as it will ultimately impact other system changes).