I’ve made the switch to Atom as an IDE since I use R and Python and like the possibilities to run inline code through the Hydrogen package. I generally use venv’s in Python which I think is a bit difficult to manage together with Hydrogen (given that it relies on a python3 kernel that has to be present in advance). Right now I do the following to setup new venv’s and get my Hydrogen kernel to work in accordance:
- Make a new venv
- Activate the virtual environment through the atom-python-virtualenv package
- Pip install ipykernel, ipython and python-language-server
- Overwrite the path to the ipykernel used by Hydrogen to the python3 in my virtualenv
So far so good. Python is running from my venv, pip3 is working properly etc. However, my sys.path is still pointing at the python3 kernel used when I started Atom. I can thus far find no way in which I can reset the path to point towards the venv except manually changing it, which is annoying since it will require me to overwrite all previous paths with new ones everytime I switch environments. I’ve tried restarting the kernel and importlib.reload(site). Thus far, the only thing that works is following above steps, restarting Atom, and selecting the venv again and running code. I feel like there is a difference between Hydrogen’s ‘restart kernel’ option and actually restarting Atom.
Any ideas? Also, if my current approach is super tedious and can be done much easier: happy to completely change direction!