I used to have a simple bash script that I was using to activate a conda env and then run atom. Then, I could run python code using hydrogen which could automatically see the packages inside myenv.
The previous bash scrip was sth like this:
#!/bin/bash
source activate myenv &&
atom
Since conda > 4.4 that 'source activate' does not exist anymore, I had to revise the script to:
#!/bin/bash
source /home/ubuntu/miniconda3/etc/profile.d/conda.sh &&
conda activate myenv &&
atom
However, hydrogen does not detect myenv anymore and runs the code from the base env which results into error due to packages missing from the base env.
When I replace atom with spyder, the above script works fine and spyder kernel does see myenv.
Any idea how I can get this fixed?
Update 1:
I did some more debugging. It seems that my ipykernel is not assigned to the kernel installed within the activated environment but assigned to the default ipykernel.
When I try jupyter kernelspec list
in my activate env, I get:
python3 /home/ubuntu/.local/share/jupyter/kernels/python3
But on another system, I get
/home/ubuntu/miniconda3/envs/myenv/share/jupyter/kernels/python3
which seems to be the right kernel.
Any idea on how to fix this?
Update 2:
It seems that this resolves the issue in Update 1. Then, I was able to use the accepted answer to load atom within the desired env and have hydrogen run from the ipykernel in that env.