MichaelAquilina / python-tools

:wrench: Atom plugin which uses jedi to provide numerous tools useful for developing python code in atom.
MIT License
100 stars 22 forks source link

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 #293

Open Aung-Bo-Bo007 opened 2 years ago

Aung-Bo-Bo007 commented 2 years ago

Error: spawn python ENOENT

vsenn commented 2 years ago

same issue last few days

vagabond92 commented 2 years ago

I only get this issue when launching from spotlight. If I launch from terminal, everything works fine.

vsenn commented 2 years ago

I only get this issue when launching from spotlight. If I launch from terminal, everything works fine.

LoL. Confirmed. Running Atom from Spotlight or Dock raise the above issue, Terminal atom command not. Thank you a lot for the workaround!

danielholmhansen commented 2 years ago

Workaround does not fix his. I have even tried to put in path, but still no luck

esba1ley commented 2 years ago

Same issue. When I launch from terminal using command line tool, no error. When I launch from Spotlight, Dock, or double-clicking the application icon via Finder.app, I get the "can't find Python executable error" for python-tools.

Interestingly enough, when I check the environment using the Atom DevTools console using process.env, the following differences show up:

on the shell-executed Atom, the following exist that don't from the Finder-executed Atom: ATOM_DISABLE_SHELLING_OUT_FOR_ENVIRONMENT: "true" LANG: "en_US.UTF-8" LaunchInstanceID: (hexadecimal ID of format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) SECURITYSESSSIONID: (hexadecimal ID of format xxxxx) TERM: "xterm-256color" TERM_PROGRAM: "Apple_Terminal" TERM_PROGRAM_VERSION: "444" TERM_SESSION_ID: (hexadecimal ID of format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX)

The following exist on the Finder-launched Atom that do not from the shell-launched Atom: OLDPWD: "/" _: "/usr/bin/awk" _CE_CONDA: "" _CE_M: "" CFBundleIdentifier: "com.github.atom" CF_USER_TEXT_ENCODING: "0x1F6:0x0:0x0"

Other differences: LC_CTYPE: "en_US.UTF-8" from shell-launched, is "" from Finder-launched PATH from shell-launched starts with a colon, from the Finder-launched it does not. PWD: is the directory from which Atom was launched via the shell, is "/" from Finder. SHLVL: "2" from shell-launched, SHLVL: "0" from Finder-launched. XPC_SERVICE_NAME: has a hexID of format XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX appended on the end from the shell-launched, not in the Finder-launched

So environmentally speaking, on MacOS 12.3.1 (Monterey), those are the environment differences seen by Atom depending on whether or not the user launches it from the shell or the Finder. I use miniconda3 to manage my virtual environments, and in both launch types, the CONDA* variables are identical, and are the appropriate environments I want Atom to pick up from a default shell. When I change the conda env at the command line and launch Atom in the same shell, I get the new conda env to which I set that shell... so that works.

Hopefully, this helps with debugging. I found it interesting that the Atom/Electron/Chromium dev tools prompt isn't mentioned in the Atom documentation... it REALLY helps debug environmental things like this.

For now, I launch from the shell using the "atom" command and all is well. It would be nice if we could use the MacOS Finder/Spotlight/Dock provided ways of launching, too...