atom-python-run icon indicating copy to clipboard operation
atom-python-run copied to clipboard

Not finding Anaconda Python Interpreter

Open OscarSouth opened this issue 7 years ago • 8 comments

I only have my Anaconda Python Interpreter in my PATH variable and if I run the test script through python in the terminal then it runs from the right interpreter, but when running through this extension it's not finding the correct interpreter and thus not being able to access the pandas module (or any others that I've installed through Anaconda).

image

I had a look through the source code to see if I can find something obvious to switch out and can't find an obvious solution.

There any way that I can switch out the interpreter and get the program to execute through the desired one?

Thanks, Oscar

OscarSouth avatar Apr 01 '18 20:04 OscarSouth

Thanks for the links to the additional documentation. I'd thoroughly gone through the Readme.md, explored the settings screen for the extension and looked through the source code, but couldn't find an obvious solution. I hadn't spotted the well documented WIKI page though, which I've now read and which was very informative.

However, I still can't see how to solve this issue. There is no 'problem' as such, other than the wrong interpreter is being used. However I can't see how modifying the settings can help, since in terminal I just type python {file}.py and the correct interpreter is used. It seems like that is already the default setting for atom-python-run and I have the correct python interpreter in my PATH variable, so I'm not really sure what to change in order to change the behavior.

Thanks again for the quick response, Oscar

OscarSouth avatar Apr 02 '18 13:04 OscarSouth

Thinking laterally - Perhaps this is happening because my anaconda Python interpreter is being added to path by my machines primary .bashrc file (during each active terminal session). I'm note sure exactly how this extension works (I'm not knowledgeable with js) but if it was bypassing the .bashrc file, then I can understand how it would be finding the wrong (the 'default') python interpreter. I'll have a think and see if I can solve it on my machine when I get a chance.

OscarSouth avatar Apr 02 '18 19:04 OscarSouth

TBH I've personally never used Anconda before. So I can't really say for sure. It also depends on your distro and it's package manager. I would install through the proper package manager instead of a manual install so you don't have to add it to your .bashrc file.

I don't see why this should be a problem since if it is in your .bashrc and you added it to your PATH and you can call it from the terminal. I find it strange. That's why I linked to the logs.

The logs will tell you exactly how the command is called. The source terminal.js handles the abstraction of determining what command to construct and call for you. For example, on any operating system it constructs a general command of {default-terminal} --execution-option [repl] [args...] which allows you to use any interpreter you'd like.

Manipulating commands is discussed in the sub-section of the Wiki in a fair amount of detail.

I can't help you if I don't know how it's being executed on your system. The logs will give me a general idea on how it's being handled.

ghost avatar Apr 03 '18 18:04 ghost

Ok cool, thanks.

I've got a crazy few days but I will get some logs over asap.

Oscar

OscarSouth avatar Apr 03 '18 19:04 OscarSouth

@riper384 -- Readme -- #83

Atom F5, ImportError: No module named numpy #83

Hello, I have problem with atom-python-run. After starting execution of a script:

import math
import numpy

tab = numpy.array([1,2,3]);
print (tab)

It ends with a error..

Traceback (most recent call last): File "/home/rafal/gitlab/sztuczna-inteligencja/lab08/zad01.py", line 2, in import numpy ModuleNotFoundError: No module named 'numpy'

i have installed anaconda3 and my PATH is set on every modules, when i raun script from console it is working..

ghost avatar Apr 24 '18 17:04 ghost

I came back to this today on a fresh install and it ran as expected..

screenshot from 2018-04-30 13-49-06

Only differences I can mention are that I've installed Ubuntu 18.04 since the last tests. I'm using Miniconda here rather than Anaconda, but I wouldn't have thought that would have made a difference.

OscarSouth avatar Apr 30 '18 12:04 OscarSouth

Ran into this problem again, this time I added the anaconda python interpreter location to my .profile, logged in and out and it fixed the problem.

OscarSouth avatar May 26 '18 13:05 OscarSouth