[SOLVED]How to use the hydrogen package


#1

Hi all,
First post here. Haven’t used Atom much. I want to use it interactively with Python and saw that the hydrogen package seems to do what I want. I’m a bit confused as to how to use it.
I’ve followed the instructions here to install it. The first time I installed it through Atom itself, but then read that

installing from within Atom will only work if you start Atom from the command line!

so I disabled the package and deleted it and then installed it with apm. Now it doesn’t even appear in the “Packages” menu.

In the package page, under “Usage” it says:

Make sure to start Atom from the command line (with atom < directory or file >) for this package to work!

I don’t really understand this. It also seems a bit awkward in combination with the quote above, about installing it from within Atom or with apm.
Further down, under “Jank”, it says:

In order to have access to your $PATH to find where IPython and other binaries are, Atom has to be launched from the command line with atom . If you launch Atom as an app, this package won’t work.

Again this is a bit confusing. I have IPython installed in /usr/bin. Should I launch Atom like this?
atom /usr/bin

So, should I install the package again from within Atom so that it shows up in the “Packge” menu? Anyway, how can I enable it to run Python code interactively?
I’m on Debian Jessie XFCE with Atom 1.8.0

Thanks


#2

A lot of these questions should probably be brought up with the maintainer of the hydrogen package. The Atom FAQ has information on how to contact the maintainers of any Atom community package or theme.

Additionally, it seems like some things in their documentation may be out of date. This in particular:

In order to have access to your $PATH to find where IPython and other binaries are, Atom has to be launched from the command line with atom . If you launch Atom as an app, this package won’t work.

This was a problem with Atom on macOS machines on older versions of Atom. This has since been corrected for macOS in more recent versions and, depending on how your system is configured, may never have been a problem on Linux machines like yours.


#3

@alexandros You should be able to install hydrogen through the package installation page in Atom. I did it this way and it worked fine.

The part about starting atom from the command line within a particular directory is partly to do with making sure that Atom inherits all of the proper environment settings (e.g., PATH) for the particular project you are working on, in addition to @leedohm’s comments.

For example, if you are using python and you have installed the jupyter components (and maybe additional libraries) into a certain project directory where you are using virtualenv, you would want to start atom from within that directory.

You could probably just install everything globally (e.g., not using virtualenv, or using npm -g) and not have to worry about it if you don’t mind the clutter.


#4

Thanks for pointing that out @freebroccolo :grinning:


#5

Thanks for your replies guys. Well, I just re-installed Hydrogen from within Atom. What I do is launch Atom from the terminal like this:
atom test.py
from the directory of the file “test.py”. When I go to Packages -> Hydrogen and click on “Run”, I get this:
No kernel for language Python found
If I hit Alt+Shift+Enter (as the package indicates for “Run”), nothing happens. What I can’t understand is how to use this package. It might be something obvious, but it’s not obvious at all to me.


#6

@alexandros It’s hard to know for sure what the problem is but I suspect that it is something with the way you have IPython set up.

Did you install IPython through pip or through the OS package manager? In general, my experience has been that python packages do not tend to work reliably if they are not installed through pip. Sometimes it is because they are too out of date and sometimes they are just configured incorrectly.

Here are some instructions that should set up an example project that works with Hydrogen. I’ve only tried it on macOS but it should work on most Linux distros as long as you have pip installed.

mkdir -p ~/dev/hydrogen
cd ~/dev/hydrogen
mkdir src
echo 'print "Hello World!"' > src/hello.py
pyvenv venv
source venv/bin/activate
pip3 install --upgrade pip
pip3 install jupyter
atom .

Finally, open src/hello.py from the tree view and execute the Hydrogen: Run command and it should work.


#7

The thing is that the repositories I have in apt-get don’t have pip or pip3. Typing:
apt-cache search pip3
gives nothing. I can find a python-pip package that I have installed but I don’t know if it’s what I should have.
I also don’t have pyvenv. apt-cache search gives a python-env3. Is that good?

I do have IPython installed via apt-get.

Thanks for the tips.


#8

@alexandros I believe pip3 should be included when you install python3 through apt. My example should work with python2 but you will need to install virtualenv separately (through pip) and use it in place of the pyvenv command.


#9

@freebroccolo eventually I had python3-pip installed and pip did work. I had to use pyvenv-3.4 though for your instructions to work. Finally it did work! Thanks for your help!
It doesn’t seem to work with Python2 though, even by installing virtualenv and replacing pyvenv with it, but I’ll see how to fix this.
Another issue is that I can run code only through the Package -> Hydrogen menu. I need to figure out how to use shortcuts. I will move this to the package bugs page.
Thanks for the help from both of you guys.


#10

Hi,
Coming back here only for the record, since the problem was finally solved (running Python 2 with the Hydrogen package) with help from the package’s page.
The issue is now closed, and if anyone want’s to read about it, it’s here.
My problem was that I’m on Debian Jessie and apt-get provides IPython 2.3.0 which Hydrogen couldn’t find so it had to be set manually.

Thanks all for your help.