Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hydrogen doesn't seem to detect my iPython installation #21

Closed
Ardelean-Calin opened this issue May 22, 2015 · 46 comments
Closed

Hydrogen doesn't seem to detect my iPython installation #21

Ardelean-Calin opened this issue May 22, 2015 · 46 comments

Comments

@Ardelean-Calin
Copy link

I am running an Arch Linux System and I have installed iPython using the default package manager, however Hydrogen doesn't seem to find my installation. I don't understand how the whole "kernel" thing works with iPython, I just want the fancy functionality of Hydrogen. I'm sorry I posted this here but I didn't know where else to put it.
image

As you can see, there's no python kernel: in the bottom left.

@rgbkrk
Copy link
Member

rgbkrk commented May 22, 2015

This may be related to other path and kernel search issues, which might be addressed in #19. I'm assuming arch uses the XDG directories and env variables?

@willwhitney
Copy link
Collaborator

This is a fine place to ask!

Hydrogen doesn't start a kernel until you run something, so if you haven't done a "Hydrogen:run" command yet, the kernel won't show up.

Otherwise, did you start Atom from the command line? If not, it can't see your $PATH.

Let me know if neither of those solves it and we'll try to figure out the problem.

@Ardelean-Calin
Copy link
Author

willwhiteney, yes, I have run it from the command line. When I run hydrogen it shows the following near the line of code, however nothing happens:
image

rgbkrk, I'll check out that link after I document myself what arch uses.

Do I need to build Jupyter, even though I have installed IPython from the arch package manager? If so, what do I need to build more exactly?

@rgbkrk
Copy link
Member

rgbkrk commented May 23, 2015

Jupyter is just the next release. Which version of IPython are you on?

@Ardelean-Calin
Copy link
Author

Python 3.4.3 and IPython 3.1.0. Although I also have Python 2.7.9 and its respective IPython (3.1.0) installed.

@rgbkrk
Copy link
Member

rgbkrk commented May 23, 2015

Can you run

from IPython.utils.path import get_ipython_dir; get_ipython_dir()

in a python or IPython terminal?

@Ardelean-Calin
Copy link
Author

Sure, sorry for the delay:

Out[1]: '/home/calin/.ipython'

That's what I get.

@willwhitney
Copy link
Collaborator

@acpcalin I log a bunch of stuff out to the console to help debug this sort of thing — mind updating to the latest version, then opening the dev console (View -> Developer -> Toggle Developer Tools) and trying to run something? It should spit out launching kernel: followed by the command and arguments it's using to try to start the kernel, along with any errors.

@Ardelean-Calin
Copy link
Author

launching kernel: ipython ["kernel", "--no-secure", "--hb=47608", "--control=50748", "--shell=35255", "--stdin=41349", "--iopub=46541", "--colors=NoColor"]

image

@willwhitney
Copy link
Collaborator

If you leave it waiting for a response, then run that command in your terminal (ipython kernel --no-secure --hb=47608 --control=50748 --shell=35255 --stdin=41349 --iopub=46541 --colors=NoColor) then it should resolve the result, yes?

Does process.env.PATH looks right in the Atom console? It could be that Atom is somehow failing to get the PATH properly.

@Ardelean-Calin
Copy link
Author

Where do I find this entry in the Atom console?
EDIT: nevermind, found it, I needed to execute that command. It says "undefined".
And no, running that command doesn't do it unfortunately.
Maybe it's because I manually built Atom? Maybe I should have installed it from the Arch User Repository with root privileges?

@willwhitney
Copy link
Collaborator

Ooh, that's probably the culprit. Investigating...

@Ardelean-Calin
Copy link
Author

No, sorry. Actually the output is

"/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:~/.atom"

I didn't know that command was case-sensitive, I am sorry.

@willwhitney
Copy link
Collaborator

OK, cool. Now try running cp.spawnSync('ipython', ['--version']).stdout.toString() in the Atom console.

@Ardelean-Calin
Copy link
Author

image

@willwhitney
Copy link
Collaborator

Whoops. Run cp = require('child_process') first, sorry about that.

@Ardelean-Calin
Copy link
Author

No problem.
image

@willwhitney
Copy link
Collaborator

OK, so it's definitely able to find your ipython install.

Try running something with Hydrogen, then while it's failing to give you a result, flip over to the terminal and running ipython kernel --no-secure --hb=47608 --control=50748 --shell=35255 --stdin=41349 --iopub=46541 --colors=NoColor (and substitute for the ports that Hydrogen has printed in the "launching kernel" message if they're different).

@Ardelean-Calin
Copy link
Author

Ok, this is weird. I didn't run that command yet, because the problem seems to be fixed now. I don't know why or how, however. I'll tell you step by step what I have done: First I tried to run Atom as root (sudo atom) and noticed that the root profile didn't have Hydrogen installed, even though I installed it in Atom on my normal, non-root, account. Then I tried installing Hydrogen as root (sudo PYTHON=python2 apm install hydrogen). This way it tried to install somewhere in the .root folder so that it would show up when I ran Atom with sudo. It failed with an error code(I closed the window, unfortunately).
Now, however, Hydrogen works on my normal profile. After I select Hydrogen:Run, it takes 1 second until it detects the IPython kernel and then it works just as expected.
image

@willwhitney
Copy link
Collaborator

Yup, that's bizarre. I'm glad it's working for you now!

Is it possible that this was just a side effect of restarting Atom?

@Ardelean-Calin
Copy link
Author

I don't really know, maybe. Thanks for the help!

@Ardelean-Calin
Copy link
Author

I just realized, sometimes Hydrogen finds the kernel, sometimes it doesn't. Closing and opening Atom several times and trying to run Hydrogen after each time is the solution. I don't know why, but I'm glad it works now.

@willwhitney
Copy link
Collaborator

That's very weird. I wouldn't be surprised if it's an issue of the kernel
failing to get started rather than it not being found.

I just published a version with a little more logging of what the kernel
process is doing, so if it keeps being unreliable, you can check out the
new logs and maybe see what's happening.

On Sun, May 24, 2015 at 3:51 PM acpcalin notifications@github.com wrote:

I just realized, sometimes Hydrogen finds the kernel, sometimes it
doesn't. Closing and opening Atom several times and trying to run Hydrogen
after each time is the solution. I don't know why, but I'm glad it works
now.


Reply to this email directly or view it on GitHub
#21 (comment)
.

@ghost
Copy link

ghost commented Dec 8, 2015

May I jump in? Having the same issue, that the kernel is not displayed in the bottom left. And I'm not able to find anything related to that topic but that entry here.

@slavaGanzin
Copy link
Contributor

@hugeme
ln -s /usr/local/share/kernels/python2 ~/.ipython/kernels
Try this.

It's a bug fixed here: #144
If hydrogen can't to interpret all folders as kernels it fails and return no kernels at all.

@ghost
Copy link

ghost commented Dec 9, 2015

@terraqout Thank you for that suggestion. However, I dont have that path /usr/local/share/kernels/python2.(and after trying that the issue remains)

sudo find / -type d -name 'kernels' gives back:
Users/me/Library/Jupyter/kernels
/usr/local/lib/python2.7/site-packages/notebook/services/kernels
/usr/local/lib/python2.7/site-packages/notebook/static/services/kernels
/Users/me/Library/Jupyter/kernels
/usr/local/lib/python2.7/site-packages/notebook/services/kernels
/usr/local/lib/python2.7/site-packages/notebook/static/services/kernels

and none of them contains python2.
Additionally, I used brew /usr/local/Cellar/python/2.7.11/share/python

Not sure whether that matters but hydrogen is not listed in installed packages within atom. But I can still Hydrogen:run. Additionally sudo atom and Hydrogen:run results #135. atomin command line results in #135 as well now.

@slavaGanzin
Copy link
Contributor

@hugeme Generally I don't know how to install kernels properly on MacOS. So you can look here:
But as I remember this should work: sudo python3 -m IPython kernelspec install-self.

Please copy output of jupyter --paths for investigation purposes.

You have python kernel in a list because it was shamelessly hardcoded. So hydrogen may not founding it.


To fix #135 you should reinstall hydrogen as a regular user and then apm rebuild

@slavaGanzin
Copy link
Contributor

@hugeme And besides, I would appreciate if you experiment with #144 on the same setup before any "fixing".

cd to/your/.atom/packages
rm Hydrogen -rf
git clone git@github.com:willwhitney/hydrogen.git
cd hydrogen
git checkout kernelManagerImpove
apm rebuild

If it would fix your issue, I'll merge it in master.

@ghost
Copy link

ghost commented Dec 9, 2015

@terraqout #135 seems to be fixed, I'll get again In the right upper corner a blue box with "Scopes at Cursor"
Next:
The jupyter --paths are:
config:

`/Users/me/.jupyter
/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter`

data:
/Users/me/Library/Jupyter /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/share/jupyter /usr/local/share/jupyter /usr/share/jupyter
runtime:
/Users/me/Library/Jupyter/runtime

Next:
I run what you have suggested which ends with apm rebuild without any errors. Restarting atom from command line and Hydrogen:runresults in a new error. Red box similar to the At Could not find module root given file: "undefined". Do you have a package.jsonfile? I'll get cannot find module zmq and referring to #135 again

@slavaGanzin
Copy link
Contributor

That's ok — Red box is kernel error, so install zmq as described here: https://github.com/willwhitney/hydrogen#os-x and retry.

thanks for jupyter --paths

@ghost
Copy link

ghost commented Dec 9, 2015

Do you mean that part?:
brew install pkg-config

brew install zeromq
Both are already brewed/installed. Just reinstalled with same error refering to zmq. Just a side note. Ipython is running via Jupiter without any problems using python2

@slavaGanzin
Copy link
Contributor

Jupyter needs zmq for python2, you may have zmq for third.

Try pip2 install zmq or if your python defaults to second version just pip install zmq.

@ghost
Copy link

ghost commented Dec 9, 2015

reinstall zmq via pip but with the same error in atom.

Not sure whether its related, but in the upper comment a question is about the output of:

from IPython.utils.path import get_ipython_dir; get_ipython_dir() when running that via Jupiter I'll get:

/usr/local/lib/python2.7/site-packages/IPython/utils/path.py:258: UserWarning: get_ipython_dir has moved to the IPython.paths module warn("get_ipython_dir has moved to the IPython.paths module")

@slavaGanzin
Copy link
Contributor

So your kernel isn't in default folder

what is placed here: /usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/etc/jupyter

?

@ghost
Copy link

ghost commented Dec 9, 2015

That ends here:

/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7

Headers Resources include
Python bin lib

@slavaGanzin
Copy link
Contributor

Looks like you have the same issue #142

@slavaGanzin
Copy link
Contributor

Drop your zeromq and try to install other way. It should help :)

@ghost
Copy link

ghost commented Dec 10, 2015

Thank you! Thats it! "other way around" solved it!

@slavaGanzin
Copy link
Contributor

@hugeme Can you explain your experience. So we can add this to readme.md?

@ssahaxd
Copy link
Contributor

ssahaxd commented Sep 1, 2017

Solution

Just make sure, Python is installed for all users and it is added to the environment variables.

ss1

python setup Wizard
I was also facing the same problem, after adding it to the environment all my problems were solved.

@BenRussert
Copy link
Member

BenRussert commented Sep 1, 2017

@ssahaxd are you interested in making a contribution about this to our docs installation page? The environment variables issue comes up frequently from windows users.

Edit: or the Troubleshooting page

@ssahaxd
Copy link
Contributor

ssahaxd commented Sep 1, 2017

@BenRussert of course, I would like to contribute.
where the detailed article I should post?
Troubleshooting page looks a great spot.

@BenRussert
Copy link
Member

That's great!

Troubleshooting page looks a great spot.

I agree, especially if you want to go into detail.

@ssahaxd
Copy link
Contributor

ssahaxd commented Sep 2, 2017

@BenRussert
added and created a pull request.

@BenRussert
Copy link
Member

@ssahaxd thanks again!

@rgbkrk
Copy link
Member

rgbkrk commented Sep 2, 2017

That is so crazy that the Windows installer doesn't include Python on the path by default. O___O

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants