Using anaconda environment in Atom

I've install Anaconda (Python 3.6) and tensorflow (python 3.5). I've managed to get it run both on Spyder and on sublime text 3( by making new build system). Now all the is using Atom( which I'm not used to). So I've trying to "tell" Atom to use python in the following folder:

C:\users\engine\anaconda3\envs\tensorflow\python.exe

without any success, any idea how to do that or what kind of package should I use( I'm using windows so virtualenv) thanks in advance !


Solution 1:

In your Anaconda terminal, activate your Conda environment and then run atom --new-instance

Solution 2:

If you want to run some python script on different python versions using Atom, I think the best solution is to use atom's Hydrogen package and installing a kernel for every conda env you need, to do it you should open Anaconda's prompt and:

  1. Install jupyter on every conda env you want to work with
  2. Activate the first env that you wish to use on Atom
  3. Create an Ipython kernel for that env with python -m ipykernel install --user --name YourEnvName
  4. Repeat this in all the envs you wish to work with

Sadly if you wish to use some atom's packages like flake8 or python-ide you need to launch atom (simply typing atom on ancaconda prompt) from a conda env that has all the requirements (like python-language-server) and then you can switch between kernels with ease.

If anybody knows how to make Atom and it's packages to recognize some env without launching atom from inside that env, please share :D

Solution 3:

I had this same issue, and after some exploring, found that this worked well:

There is a file (I'm on macOS Catalina 10.15.3):

~/.atom/packages/platformio-ide-terminal/lib/platformio-ide-terminal.coffee

Look for the autoRunCommand section:

autoRunCommand:
title: 'Auto Run Command'
description: 'Command to run on terminal initialization.'
type: 'string'
default: ''

If you set the default to:

'export PATH=~/opt/anaconda3/bin:$PATH'

platformio will execute this command every time you start Atom, and it will use the default anaconda python, as specified in the new PATH.

You can then type "conda activate myenvironment" in the platformio terminal and it will work like normal (switch between environments, install packages, etc.). Hope this helps.