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

failed to start ob-ipython #141

Open
yitang opened this issue Nov 17, 2017 · 16 comments
Open

failed to start ob-ipython #141

yitang opened this issue Nov 17, 2017 · 16 comments
Labels

Comments

@yitang
Copy link

yitang commented Nov 17, 2017

Hi, ob-ipython works fine for me on windows, but i just tried it on my ubuntu machine, and i got this error:
please could you have a look?

Yi

�[0;31m---------------------------------------------------------------------------�[0m
�[0;31mOSError�[0m Traceback (most recent call last)
�[0;32m~/git/.emacs.d/.cask/25.3/elpa/ob-ipython-20171111.740/client.py�[0m in �[0;36m�[0;34m()�[0m
�[1;32m 58�[0m �[0margs�[0m �[0;34m=�[0m �[0mparser�[0m�[0;34m.�[0m�[0mparse_args�[0m�[0;34m(�[0m�[0;34m)�[0m�[0;34m�[0m�[0m
�[1;32m 59�[0m �[0;34m�[0m�[0m
�[0;32m---> 60�[0;31m �[0mc�[0m �[0;34m=�[0m �[0mcreate_client�[0m�[0;34m(�[0m�[0margs�[0m�[0;34m.�[0m�[0mconn_file�[0m�[0;34m)�[0m�[0;34m�[0m�[0m
�[0m�[1;32m 61�[0m �[0;34m�[0m�[0m
�[1;32m 62�[0m �[0;32mwith�[0m �[0minterested_lock�[0m�[0;34m:�[0m�[0;34m�[0m�[0m

�[0;32m~/git/.emacs.d/.cask/25.3/elpa/ob-ipython-20171111.740/client.py�[0m in �[0;36mcreate_client�[0;34m(name)�[0m
�[1;32m 41�[0m �[0mcf�[0m �[0;34m=�[0m �[0mfind_connection_file�[0m�[0;34m(�[0m�[0mname�[0m�[0;34m)�[0m�[0;34m�[0m�[0m
�[1;32m 42�[0m �[0;32melse�[0m�[0;34m:�[0m�[0;34m�[0m�[0m
�[0;32m---> 43�[0;31m �[0mcf�[0m �[0;34m=�[0m �[0mfind_connection_file�[0m�[0;34m(�[0m�[0;34m'emacs-'�[0m �[0;34m+�[0m �[0mname�[0m�[0;34m)�[0m�[0;34m�[0m�[0m
�[0m�[1;32m 44�[0m �[0mc�[0m �[0;34m=�[0m �[0mclient�[0m�[0;34m.�[0m�[0mBlockingKernelClient�[0m�[0;34m(�[0m�[0mconnection_file�[0m�[0;34m=�[0m�[0mcf�[0m�[0;34m)�[0m�[0;34m�[0m�[0m
�[1;32m 45�[0m �[0mc�[0m�[0;34m.�[0m�[0mload_connection_file�[0m�[0;34m(�[0m�[0;34m)�[0m�[0;34m�[0m�[0m

�[0;32m~/.local/lib/python3.5/site-packages/jupyter_client/connect.py�[0m in �[0;36mfind_connection_file�[0;34m(filename, path, profile)�[0m
�[1;32m 210�[0m �[0mmatches�[0m �[0;34m=�[0m �[0;34m[�[0m �[0mos�[0m�[0;34m.�[0m�[0mpath�[0m�[0;34m.�[0m�[0mabspath�[0m�[0;34m(�[0m�[0mm�[0m�[0;34m)�[0m �[0;32mfor�[0m �[0mm�[0m �[0;32min�[0m �[0mmatches�[0m �[0;34m]�[0m�[0;34m�[0m�[0m
�[1;32m 211�[0m �[0;32mif�[0m �[0;32mnot�[0m �[0mmatches�[0m�[0;34m:�[0m�[0;34m�[0m�[0m
�[0;32m--> 212�[0;31m �[0;32mraise�[0m �[0mIOError�[0m�[0;34m(�[0m�[0;34m"Could not find %r in %r"�[0m �[0;34m%�[0m �[0;34m(�[0m�[0mfilename�[0m�[0;34m,�[0m �[0mpath�[0m�[0;34m)�[0m�[0;34m)�[0m�[0;34m�[0m�[0m
�[0m�[1;32m 213�[0m �[0;32melif�[0m �[0mlen�[0m�[0;34m(�[0m�[0mmatches�[0m�[0;34m)�[0m �[0;34m==�[0m �[0;36m1�[0m�[0;34m:�[0m�[0;34m�[0m�[0m
�[1;32m 214�[0m �[0;32mreturn�[0m �[0mmatches�[0m�[0;34m[�[0m�[0;36m0�[0m�[0;34m]�[0m�[0;34m�[0m�[0m

�[0;31mOSError�[0m: Could not find 'emacs-none' in ['.', '/run/user/1000/jupyter']

@jchkoch
Copy link

jchkoch commented Nov 21, 2017

Hi, I seem to be getting the same error with ob-ipython using my opensuse leap 42.2 machine:

Traceback (most recent call last):
File "/home/jkoch/.emacs.d/elpa/ob-ipython-20171111.740/client.py", line 60, in
c = create_client(args.conn_file)
File "/home/jkoch/.emacs.d/elpa/ob-ipython-20171111.740/client.py", line 43, in create_client
cf = find_connection_file('emacs-' + name)
File "/home/jkoch/anaconda3/lib/python3.6/site-packages/jupyter_client/connect.py", line 189, in find_connection_file
raise IOError("Could not find %r in %r" % (filename, path))
OSError: Could not find 'emacs-new' in ['.', '/run/user/1000/jupyter']

Thought this might explain the above error in a little more detail. Any feedback on this would be appreciated as it suddenly stopped working from one day to the next and I am a bit perplexed as I haven't changed anything in my config.

Thanks,
James

@hooger
Copy link

hooger commented Nov 30, 2017

Hello,

same here, ob-ipython worked nicely, and now it does not. Yesterday I upgraded my ob-ipython package from Emacs package manager, my hunch is that it may have caused the issue.
As I trace it back it seems, that create_client calls find_connection_file from jupyter/connect.py with empty path argument, so it falls back to jupyter_runtime_dir. For me it is /run/user/1000/jupyter which does not exists.

As a workaround running jupyter-console creates the folder and a connection file, which can be used to connect to (setting the created json file as :session kernel-xxxxx.json), but some fix would be nice.

Thanks in advance,
hooger

@jchkoch
Copy link

jchkoch commented Nov 30, 2017

Thanks @hooger for the workaround. It seems to work for me as well. I'll try to find some time to look more into this.

@vapniks
Copy link

vapniks commented Dec 2, 2017

That workaround didn't work for me. Instead I deleted all occurrences of "--simple-prompt" from ob-ipython.el since this is no longer a valid flag for recent versions of jupyter.

@yitang
Copy link
Author

yitang commented Dec 2, 2017

@vapniks which jupyter version are you using?

@gregsexton gregsexton added the bug label Dec 3, 2017
@vapniks
Copy link

vapniks commented Dec 3, 2017

@yitang 4.2.1

@falematte
Copy link

falematte commented Jan 4, 2018

Same problem here. Anyone looking into this?

@kailukowiak
Copy link

I have a similar problem. I first got a long string of text like the first post. After I added (setq python-shell-interpreter "/Applications/anaconda/bin/python") in my init.el i started getting erros that were more legible. Currently:

Traceback (most recent call last):
  File "/Users/kailukowiak/.emacs.d/elpa/ob-ipython-20180224.153/client.py", line 60, in <module>
    c = create_client(args.conn_file)
  File "/Users/kailukowiak/.emacs.d/elpa/ob-ipython-20180224.153/client.py", line 43, in create_client
    cf = find_connection_file('emacs-' + name)
  File "/Applications/anaconda/lib/python3.6/site-packages/jupyter_client/connect.py", line 212, in find_connection_file
    raise IOError("Could not find %r in %r" % (filename, path))
OSError: Could not find 'emacs-mysession' in ['.', '/Users/kailukowiak/Library/Jupyter/runtime']

is my error.

I've tried exploring the python code in client.py file but I'm unsure if I should direct the file to creat a emacs-mysession file in the anaconda path or something else. Does anybody have any ideas?

@kailukowiak
Copy link

ipython/ipykernel#151 (comment)
I then re installed ipython and jupyter_console/client. This fixed my issue but I need to now figure how to get the code to show underneath the code chunk instead of in a seperate pannel.

@jchkoch
Copy link

jchkoch commented May 30, 2018

@kaiserxc I see you are using the Anaconda python distribution. When you re-installed ipython and jupyter_console/client, what versions do you now have?

@kailukowiak
Copy link

kailukowiak commented May 30, 2018

@jchkoch

$ ipython --version
6.4.0
$ jupyter-console --version
5.2.0
$ jupyter --version
4.4.0

jupyter-client doesn't show up from bash but I got this from ipython:

In [2]: jupyter_client.__version__
Out[2]: '5.2.3'

I am not sure how to check which version I was using before. However, the reinstall seems to have fixed everything.

Unfortunetly I also ran this fix, which is right below the original comment that I linked too. ipython/ipykernel#151 (comment)

So I cant be sure which one fixed it. My approach was not very scientific.

What I can say is that I:

  1. Set the interpreter to a specific version (setq python-shell-interpreter "/Applications/anaconda/bin/python"). I imagine that you could change this to your own python environment if you don't have conda.
  2. Deleted ipython, jupyter-console and jupyter-client and reinstalled.
  3. Updated conda update ipykernel.

Also, since you already have a pretty error message: #141 (comment), compared to @yitang #141 (comment)
I think you don't need to do step 1.

Edit: I am pretty sure I updated jupyter-console/client before, so I think maybe some paths had gotten messed up and the reinstall fixed this but I am not 100% sure.

@jchkoch
Copy link

jchkoch commented May 30, 2018

@kaiserxc Thanks for the quick reply. I tried your approach to fix the error; however, in the end I managed to get it working again with a fresh install of anaconda and ob-ipython (I think my paths were messed up... too much hacking...).

@kailukowiak
Copy link

@jchkoch there is nothing quite as efficient as a restart/re-install.
For people looking at this thread in the future, I would suggest trying my approach first just because it takes less time, but I think ob-ipython works under the correct install and anyone having issues like this should not give up.

@jchkoch
Copy link

jchkoch commented May 31, 2018

@kaiserxc not sure whether you figured out how to display results underneath the code block instead of a separate panel (as you mentioned in your previous comment but referring to this issue (#10) the best way to do this, is with the :results output property on code blocks. Hope this helps.

@kailukowiak
Copy link

@jchkoch I saw that and I got it working. My issue is that I have to choose, in advance, how to set up the SRC chunk. i.e. I would need to include either :results output or :results raw drawer which is annoyingly inefficient compared to a jupyter notebook or even the iPython REPL.

Also, it is difficult to print and show a graph. For example, lets say I create a function that displays a graph and text based on a condition. This would not display in the output easily.

Do you have any solutions?

@jchkoch
Copy link

jchkoch commented May 31, 2018

@kaiserxc For including :results in the set up of each SRC chunk, I would set up some sort of snippet as shown in the README for ob-ipython. That would be more efficient.

It seems that there is no easy way to output both text and a figure at the same time currently. My current workaround is to split the text and figure output into two separate SRC blocks, not ideal but it works for me for the most part.

I think the idea for separating out text and image results is that usually print statements are used primarily for debugging which probably don't need to show up in a document. The issue seems to me to be about where print statements should show up in a document and where not. From my point of view including print statements in the output of a SRC block for then inclusion into a document is much more for scientific documents than for strict programming purposes where print statements are generally used for debugging. That being said I am interested in including both types of output. For this behavior, there does exist a open issue #157 about this. I suggest we move any further discussion of this to issue #157.

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

No branches or pull requests

7 participants