Open yitang opened 6 years ago
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
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
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
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.
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.
@vapniks which jupyter version are you using?
@yitang 4.2.1
Same problem here. Anyone looking into this?
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?
https://github.com/ipython/ipykernel/issues/151#issuecomment-267816538 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.
@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?
@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. https://github.com/ipython/ipykernel/issues/151#issuecomment-304085269
So I cant be sure which one fixed it. My approach was not very scientific.
What I can say is that I:
(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.ipython
, jupyter-console
and jupyter-client
and reinstalled. conda update ipykernel
.Also, since you already have a pretty error message: https://github.com/gregsexton/ob-ipython/issues/141#issuecomment-345925372, compared to @yitang https://github.com/gregsexton/ob-ipython/issues/141#issue-275011207 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.
@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...).
@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.
@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.
@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?
@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.
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']