How to run code with Hydrogen


#1

Hi there. I am completely new to Atom.
I installed it and it felt quite easy to use and set up. I read that the Hydrogen package enables functionality similar to the Jupyter Notebook. So I installed the package.
Unfortunately, I have no Idea how to use it. I read the entire documentation (which isnt too extensive) and searched for everything I could.
So here is my problem:
I created a file called testfile1.py
In that file i put the very simle line
print(‘Hello’)
just to see how it works. I marked the line and pressed Ctrl+Enter. At the top right, a window pops up saying “Hydrogen Kernels updated: Python 3”.
But then nothing happens. I dont see the result of the code that I tried to run anywhere. I tried different lines of codes, tried differen run-combinations, nothing gives me any results.
I am using arch linux, installed Anaconda through the AUR to /opt/anaconda.
Using the terminal and running
jupyter notebook
for example works just fine and opens a Notebook in Firefox (as it should) and running code that imports modules that came along with Anaconda also work fine once i run them with the script package in Atom
(things like
import numpy as np
is letting me work with all the numpy funtions as expected. So I think that it shouldnt be any issues related to the Anaconda packages itself)
I tried to look everywhere I could, but I do not find any solution on why hydrogen would not give me any results.
Is there anything I am missing or did wrong?
I hope someone might be able to help me, thanks already in advance


#2

I am also an Arch Linux user.

When I run code in Hydrogen, the first thing I do is select the code in the module I want to run – can be multiple functions or single line – then press control-return.

This initializes the Hydrogen/Jupyter environment for the code I am working with.

Once I see the Python 3 Idle status in the status line, I then select code from what I had previously selected that I now want to execute and press control-return. Then I see the result. It prints at the end of the line I selected to execute if the amount of output is small such as your test case.


#3

Thanks for your answer, but this is pretty much exactly what the general instructions provide on the packge documentation itself, so that was the very first thing I did and tried.


#4

When I do this, ‘Hello’ appears at the end of the line containing the print statement.

What version of Atom and Hydrogen are you using?


#5

I know thats what it should do, but unfortunately, it doesn’t.
I am using Atom 1.18 and Hydrogen 1.20


#6

Solved it. My nftables default policy for input and output for the inet filter is drop, had to accept localhost in both. Oh my…


#7

oh my indeed… :grinning: