Atom Hydrogen using Conda envrionment

Hi I’m Using Hydrogen and want to select multiple virtual environments.

From what I’ve found and tried:

  1. Create virtual environment via: venv or conda
  2. Activate virtual environment
  3. Register virtual environment via: python -m ipykernel install --user --name YourEnvName
  4. From activated virtual environment (terminal), run atom via: atom (if atom PATH is included)

What I want to know is, is there any possible method to skip step 4?
Something like including “conda activate YourEnvName” just before activating the kernel.
Since it is a tedious job to activate environment every time manually.

I tried looking the source files of Hydrogen, but I failed to understand (cuz I’m not used to .js)
(If I just skip 4 and run just atom (double clicking icon, default path), dll load error happens because PATH is not 100% consistent with the virtual environment. https://github.com/nteract/hydrogen/issues/1405,
https://stackoverflow.com/a/52394575)

I tried modifying the “kernel.js” of virtual environment to include “conda activate YourEnvName” but that made the environment to disappear from selectable kernel list when running Hydrogen.

#Hydrogen #Anaconda #environment #PATH #venv #kernel

Windows/Linux/Mac? I am in Ubuntu.
Have you considered the option of building automation scripts to navigate the Atom UI? You can develop quite complex workflows in this way. In fact I built a custom Atom package to launch automation scripts. I added “Automation” as launcher name to my top menu bar and the external UI automation script is launched through process-palette.

Thanks d_I
I’m using Windows.

for now, I just made a windows batch script (shell script) and using it as a shortcut.
Cuz I have to run atom with the virtual environment activated, I’m not sure if process-palette can reconfigure the path variables atom is running on.

This is the batch script I’m using right now as a short-term solution.

call activate MyEnvName
cd ProjectPath
atom .
PAUSE

I tried the same batch script using process-palette you recommended, but I think it opens a separate process terminal and has no effect on the current atom process running. Cuz I tried running hydrogen after running the equivalent process palette, and it raised the same error when I activate hydrogen from base.

Now I can walk you through an automation process I use but you will have to put Atom on hold while you learn.

With Windows for automation you have the option of using
AutoHotKey
Actiona

My preference is Actiona since it works across Linux/Windows.
But AutoHotKey might be better if you are Windows only.
Actiona it is very dated and requires scripts to be written in codebox using actionscript2. But other widgets are easy to create using a GUI,
The script is launched without GUI by cmd: actexec myscript.ascr

Get the feel of the utility of choice. Both work.
Then write a script which targets your open Atom instance.
Walk through the workflow which works.
Then you can designate a hot key to automate the process you want.

I then built an Atom process-palette custom process which launches my automation script. The automation script then target Atom session and emulates UI actions such as finding menu items, hitting keys and so on.

You can sit back with a cup of coffee and watch Atom going through its steps.
Much better than following YouTube presentations.

Oh I see. So AutoHotKey&Actiona are both automation tools for some OS.

In this case though,
I’ve tried running a new instance of atom from virtual environment,
while I have my atom script from base open,
but it doesn’t open a new window/process since an instance of atom was already open.

So even if I automate the batch script using

process-palette -> call AutoHotKey/Actiona
AutoHotKey/Actiona -> run my batch script

I am still in my base environment, without access to my virtual environment, which leads to Hydrogen error.
For now, I’m just closing all atom instances and start atom via my windows batch script. I’m just double-clicking the script and it opens the atom editor and I’m somewhat satisfied at the moment.

Thanks for the recommendation. I’ll use them for other stuff to automate :slight_smile:
Looks pretty awesome.
(Or maybe I could integrate kill atom and restart inside the process-pallette hmm…)