Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:49
    aidos commented #13446
  • 10:58
    Carreau commented #13484
  • Jan 22 17:35
    rhettinger opened #13484
  • Jan 22 17:35
    ygeyzel synchronize #13483
  • Jan 22 16:24
    alexmojaki commented #13481
  • Jan 22 16:03
    ygeyzel synchronize #13483
  • Jan 22 15:53
    JelleZijlstra commented #13481
  • Jan 22 15:53
    ygeyzel synchronize #13483
  • Jan 22 15:44
    ygeyzel opened #13483
  • Jan 22 15:44
    alexmojaki commented #13481
  • Jan 21 21:29
    jmahlik opened #13482
  • Jan 21 19:57
    Carreau locked #13454
  • Jan 21 17:17
    JelleZijlstra commented #13454
  • Jan 21 17:12
    JelleZijlstra opened #13481
  • Jan 21 13:20
    blink1073 closed #13265
  • Jan 21 11:41
    psarka commented #13265
  • Jan 21 10:28
    GalBr commented #13465
  • Jan 21 06:50
    tirkarthi commented #13450
  • Jan 21 03:01
    RobinFiveWords commented #13265
  • Jan 20 23:26
    8d1h edited #13480
RK
@sonthonaxrk

Hey all,

Quick question: how do I add custom kernels to the registry of kernels Jupyter can use? Is there a hook for that?

So, for instance, when I install xeus-python, how does Jupyter know it's installed?
RK
@sonthonaxrk

https://jupyter-client.readthedocs.io/en/stable/api/kernelspec.html?highlight=install-kernel.html#jupyter_client.kernelspec.KernelSpecManager.install_kernel_spec

Cool found it :)

Sorry should have searched more. I suppose disperate docs is the side effect of splitting everything up into different concerns.

5 replies
ipython, jupyter, jupyter-client, ipykernel, ends up being a lot.
RK
@sonthonaxrk

https://github.com/sonthonaxrk/async_gui_ipython_kernel

I think I've done something kinda cool and opens up some possibilities with IPython.

RK
@sonthonaxrk
Hey I've written a pull request, that I think could be really useful for IPython. ipython/ipykernel#589
That fixes the issue I described in my earlier messages.
However, I'm getting test failures on (ubuntu, 3.6) and (macos, pypy3), but not on (macos, 3.6) or (ubuntu pypy3). I'm really struggling to reproduce them locally.
Is this an issue with the tests or my code?
RK
@sonthonaxrk
Ah, it's just flakey. Rerunning the tests.
Some sort of timeout, maybe the github ci runners share some state.
evidlo
@Evidlo:matrix.org
[m]
A few months ago I work on a plugin for supporting 'cells' in a regular .py file
I was hoping somebody might give input or comment on its usefulness: https://github.com/UIUC-SINE/ipython-cells
onus tepolov
@blastoporeus_twitter
can %run accept a variable as a file name? I can't seem to get it to work. eg) %run '/some/path/file.ipynb' works, but if I have target = 'some/path/file.ipynb' then %run target, it says ERROR:root:File 'target.py' not found.
Min RK
@minrk
@blastoporeus_twitter try %run $target to get variable expansion
1 reply
nbuntrust
@nbuntrust
Is there any way to gain access to the SingleUserNotebookApp data from an ipython extension?
nbuntrust
@nbuntrust
Right now I'm parsing syslog data on the fly to get the IP of the connected user, but of course if SingleUserNotebookApp is writing it into a log, it knows it somewhere that I would think I could access more efficiently... :-)
Nicholas Bollweg
@bollwyvl
they are in different processes. you can talk to the API like any other client, however.
nbuntrust
@nbuntrust
This API is documented somewhere? I guess that's what I'm trying to find
siddharth99
@siddharth99
Hi, I am running into an error with cython code and the jupyter kernel ends up restarting itself.. I don't see where the actual error happens, don't see a core file and not sure how to debug further
[I 13:59:36.224 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports kernel b4f40812-cf7d-4f97-925b-84780f946bc9 restarted
anyone has any suggestions?
1 reply
pritimanbala
@pritimanbala
hii
there
there is a problem that i am running code in the for loop of python and now I cant configure it out that how can I run my loop in the cmd of my pc
wraptile
@wraptile:matrix.org
[m]

Hello, can I embed ipython in an async program? can't seem to find any docs on it. I've tried:

    import nest_asyncio
    nest_asyncio.apply()
    IPython.embed(using='asyncio')

with no luck 😐️

Thomas A Caswell
@tacaswell
On a very new version of everything (CPython, traitlets, and IPython) I'm seeing AttributeError: 'Namespace' object has no attribute '_flags' when starting with ipython --simple-prompt. Has anyone else seen this or have hints of where to start looking?
`
Thomas A Caswell
@tacaswell
Looks like this is a change it CPython :/
Min RK
@minrk
@tacaswell 3.10 or 3.9?
Min RK
@minrk
Ah, I see it. Merged, thanks!
Thomas A Caswell
@tacaswell
Thanks @minrk !
Cassiel-girl
@Cassiel-girl
When I enter ipython, I enter python code and the result is returned. Which function can realize that the input parameter is Python code and the result of function execution is similar to the result of ipython after executing that python code?
Cassiel-girl
@Cassiel-girl
An ipython backend is running on one machine A. This backend receives commands from a user on another machine B, sends them to A for execution, and then returns the results to B. The program running on the other machine B is a pyqt5 GUI that can type strings, but machine B cannot install anything ipython related. What programming interface should the program on machine A call to implement? Or an example of the relevant code.
Min RK
@minrk
That's potentically a big task, but the main core function for evaluating code is exec. What 'results' might be is tricky for exec.
IPython's implementation is mostly here but it has lots of handling of different async situations that you probably don't need. Other things to consider include a persistent namespace or not, etc.
Jerry Johns
@mrjerryjohns

Hello! I'm seeing an issue with my IPython setup on Mac, where attempting to use await with an async command results in the following error:

    648 
    649         if self._local._loop is None:
--> 650             raise RuntimeError('There is no current event loop in thread %r.'
    651                                % threading.current_thread().name)
    652 

RuntimeError: There is no current event loop in thread 'MainThread'.

I've traced it to the fact that the following call always errors out:

import asyncio
asyncio.get_event_loop()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-6-6908e23590ee> in <module>
----> 1 asyncio.get_event_loop()

/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py in get_event_loop(self)
    648 
    649         if self._local._loop is None:
--> 650             raise RuntimeError('There is no current event loop in thread %r.'
    651                                % threading.current_thread().name)
    652 

RuntimeError: There is no current event loop in thread 'MainThread'.
Extensive search of stack-overflow didn't yield any answers unfortunately :(
Min RK
@minrk
@mrjerryjohns what's your IPython version? I wouldn't expect that on recent IPython.
Jerry Johns
@mrjerryjohns

Python 3.9.7, IPython 7.30.0.

Reproducible test case:

Python 3.9.7 (default, Oct 13 2021, 06:45:31) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.30.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: async def ping():
   ...:     pass
   ...: 

In [2]: 

In [2]: await ping()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.9/site-packages/IPython/core/async_helpers.py in __call__(self, coro)
     26         import asyncio
     27 
---> 28         return asyncio.get_event_loop().run_until_complete(coro)
     29 
     30     def __str__(self):

/usr/local/Cellar/python@3.9/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/events.py in get_event_loop(self)
    644 
    645         if self._local._loop is None:
--> 646             raise RuntimeError('There is no current event loop in thread %r.'
    647                                % threading.current_thread().name)
    648 

RuntimeError: There is no current event loop in thread 'MainThread'.

In [2]:
9 replies
Michał Krassowski
@krassowski
What is IPython display equivalent of print(something, file=sys.stderr)? Like tracebacks for extensions get printed out on red background, I would have thought there is a 1-1 utility for displaying rich-formatted warnings/errors other than exceptions - is there one?
Min RK
@minrk
There isn't a stderr-equivalent for display. Just one display channel.
It could be reasonable to define a metadata field for this use case
Maxime Liquet
@maximlt
Hi all! Running publish_display_data(data={'application/javascript': 'console.log(1)'}) in a notebook cell creates an output with an empty div that is displayed (height of 12.23px). Is there a way to hide such output from IPython's API?
5 replies