7,210 questions
2
votes
1
answer
106
views
How to clear output from all cells?
With iPython, is there any way to clear output from all cells? I am looking for a command that can do it in one shot.
I see that clear_out like below can do the cleaning work, but it works for one ...
0
votes
1
answer
61
views
Jupyter notebook shell command/line magic failure does not cause cell failure
I'm using a Jupyter notebook as a tutorial for a command-line tool. However, I noticed that regardless of whether I use a shell command (!) or line magic (%), an error does not cause the cell to fail, ...
0
votes
1
answer
56
views
How to execute a command sent to the IPython terminal in VSCode?
I'm using VSCode with a keybinding that sends a command to the terminal, where IPython is running (not Jupyter Notebook, just plain IPython in the terminal).
I want to select a line of code (e.g. ...
0
votes
0
answers
75
views
numpy TypeError with importing GPflow in ipython
I installed GPflow and just tried to import it with ipython. But, I got an error like below.
---------------------------------------------------------------------------
TypeError ...
1
vote
1
answer
89
views
Jupyter notebook IPython not defined (IPython v 8.30.3 installed)
I'm trying to run a jupyter notebook featuring interactive ipywidgets using a new laptop with a new installation of jupyter/ anaconda, but consistently get the error 'Javascript Error: IPython is not ...
1
vote
1
answer
252
views
Cannot install/run IPykernel in VS Code
I'm new to VS Code and Python. When I tried to use interactive window I failed to install IPykernel. I am using Mac system and have already installed Jupyter and Python in VS Code. I am using conda ...
1
vote
1
answer
77
views
AssertionError: IPython must be installed to use initjs()! Run `pip install ipython` and then restart shap
I installed IPython with pip install ipython and I was able to install it. However PyCharm gives this error:
C:\Users\HP\PycharmProjects\CE475Exercises\CE475Project.py:150:
FutureWarning:
Passing ...
-1
votes
2
answers
211
views
Why doesn't exec() create objects in local/global scope?
I'm trying to find an IPython counterpart to Spyder's runfile. According to this page, "exec() will execute the input code in the current scope" by default. Therefore, I expect the ...
0
votes
0
answers
28
views
Use trace module from Spyder console
I was looking for how to echo commands to the console as a Python script is executing. Google pointed me to the trace module, but what I found online shows that it must be specified when invoking ...
0
votes
0
answers
42
views
How to interrupt a while loop using a button click with Jupyter Notebook
I have a dashboard that gets node count, etc. from slurm and displays that as a button grid, and is refreshed every n seconds. I want the ability to click on any of the buttons and have something ...
4
votes
5
answers
336
views
How to use Jupyter notebooks or IPython for development without polluting the venv?
Best practice for Python is to use venv to isolate to the imports you really need. I use python -m venv.
For development, it's very convenient to use IPython and notebooks for exploring code ...
0
votes
0
answers
107
views
%store -r returns "TypeError: 'PickleShareDB' object is not subscriptable"
I have a string variable I've defined in one Jupyter notebook that I'd like to use in another Jupyter notebook. I know from here that %store is an approach, but when I use %store -r <variable> ...
0
votes
0
answers
79
views
python/Jupyter-lab: How to use built-in JSON visualization functionality for a dataclass
IPython/Jupyter has built-in functionality to visualise JSON structures as an interactive tree where you can expand and collapse nodes. I like using it for lists and dictionaries, but now I want to ...
1
vote
0
answers
92
views
PDF export error when using Markdown cells in Jupyter Notebook
I have encountered an issue when trying to export jupyter notebooks that contains any form of text in "Markdown cells". The export is succesful IF the notebook only contains "code cells&...
-1
votes
1
answer
40
views
Launching ipython in vscode
I am currently transitioning from using Jupyter notebooks to .py files, and I want to to able to execute certain lines of code in my program interactively
I know that if I
(1) select the block of code ...
0
votes
1
answer
67
views
%reset in script only if run through iPython?
I'm developing some code in Spyder on local machine.
This code need to be run on a remote server through python directly.
While developing in Spyder, I used to put a %reset -f at the very beginning in ...
3
votes
0
answers
35
views
Why does the exit() function work in iPython console but not from a file in Spyder?
I have the following code in a .py file that is run in Spyder as a test:
print('Hello World')
exit()
when this code is copied into the iPython console it works fine but when I run the file using run ...
1
vote
0
answers
79
views
Unexpected Tkinter GUI behavior when run in Spyder (iPython) console, but not in terminal
I'm getting a strange problem. I recently converted a project from Mac to Windows and noticed some strange tkinter GUI issues that occur only on my Windows 11 platform, despite not changing python ...
0
votes
0
answers
106
views
Unable to load module when wheel installed in jupyter
I have developed a python module with C++ and nanobind. I am using the stable ABI and compiling the wheel for python 3.12
I am building a wheel using cibuildwheel cibuildwheel --output-dir wheelhouse
...
-1
votes
1
answer
2k
views
IPython.display does not show any image at all but <IPython.core.display.Image object>
I am trying to show LangChain graph in my python module code. Not Jupiter notebook. However, the following code snippet:
from IPython.display import Image, display
from langgraph.graph import ...
0
votes
0
answers
93
views
Rendering streamed Markdown chunks in IPython/Jupyter
The context is that I'm streaming LLM tokens from a model, and they're in Markdown, so I want to repeatedly append to the rendered Markdown.
This is roughly the code I'm using with bare text:
async ...
2
votes
1
answer
2k
views
VS Code, ipython and uv
a few months ago, I switched from Spyder to VS Code. One of the main reasons was the integration of Jupyter notebooks (as a plugin) and presumably better debugging functionality. Also it seemed to me, ...
1
vote
0
answers
50
views
IPython on terminal doesn't show functions signature on parentheses opening
Using IPython on my linux terminal (Debian), I would like to see the function signature (arguments and docstring) when I press ( after the function name, in a popup.
Notes:
function_name? works.
I'm ...
0
votes
1
answer
19
views
Where is the IPython's database located in the filesystem where %store data is persisted?
The storemagic documentation says that:
Stores variables, aliases and macros in IPython’s database.
but it does not say where is this IPython's database located. Where is it?
1
vote
0
answers
26
views
TypeError: kernel.execute is not a function
Run the following code in the jupyter cell to interact with python and jquery.The code is as follows:
labels = []
from IPython.display import HTML,display
display(HTML("""
<div ...
0
votes
0
answers
24
views
When I try to start qtconsole from a jupyter ipython notebook I get an error
recently, I am having problems starting a qtconsole from an jupyter ipython notebook. The problem seems to be caused because I have ipyparallel in installed. I get the following error code:
...
-3
votes
1
answer
83
views
What are variables generated as "_1", "_2", "_3"... "_1i"...."_" when printing dir()?
I am running Python with IPython. Out of nowhere the following variables are being created when I print dir().
Here are some of the variables with following code:
for i in dir():
if "_" ...
0
votes
1
answer
72
views
Ipywidgets Controller not working properly, fields empty
I want to use my Xbox controller in Jupyter environment. I initialized controller, there widget said press any button, then, widget started displaying all of my controls. as on Screenshot.
However ...
1
vote
3
answers
348
views
How to run async code in IPython startup files?
I have set IPYTHONDIR=.ipython, and created a startup file at .ipython/profile_default/startup/01_hello.py. Now, when I run ipython, it executes the contents of that file as if they had been entered ...
9
votes
0
answers
119
views
What does IPython expect after an underscore in a numeric literal?
I know that _s can be used as digit separator within numeric literals, between (groups of) digits, for instance 1_000 means 1000 and 0_0 means 00 or just 0. Today I accidentally typed a letter after ...
0
votes
0
answers
23
views
Ipywidgets : How to get the list of comm opened in a jupyter notebook?
I created, in a Jupyter Notebook, a GUI where many ipywidgets are created, displayed or not, closed depending of user choices, file opened, ... But I am not sure that I do not let some comms (https://...
0
votes
0
answers
30
views
VSCode support fully integrated IPython terminal
I've had little success in figuring out how to get IPython terminal integrate with VSCode. There are many posts here and there but they are either outdated or irrelevant.
This has been discussed in ...
0
votes
0
answers
45
views
Cell execution time with ipython-autotime
I am using ipython-autotime with jupyterlab notebook, I am not able to see cell execution time when there is an error in code of cell to be run.
I tried printing pre_run_cell and post_run_cell events ...
0
votes
1
answer
117
views
Getting error message whilst trying to install IPython
I cannot install ipython in cmd:
when I enter pip install ipython, it gives this error:
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\Users\QR-Center\...
1
vote
0
answers
52
views
LaTeX expressions do not display properly in widgets.Label when the Label value is updated as a result of a widgets.observe event
In Jupyter notebook (using with a python or sagemath kernel), when updating the value of a widgets.Label with a string that includes LateX code does not display properly when the update occurs in an ...
0
votes
0
answers
60
views
IPython in VS Code : garbage collector apparently knows about variable before instantiation
I was trying to write a Python object tracker using gc.get_objects() to be used inside an existing and rather complex IPython notebook in VS Code to track potential memory "leaks" or ...
1
vote
0
answers
100
views
IPython / ipdb auto-complete not working for arguments to p and pp commands
I'm using python 3.12.1, IPython 8.28.0, ipdb 0.13.13 and jedi 0.19.1 on ubuntu, started like this:
ipython --no-banner --pdb my_source_code.py
I have PYTHONBREAKPOINT set to ipdb.set_trace and when ...
0
votes
0
answers
74
views
Inadequate highlighting in code's output cells in an IPython notebook in VSCode
I am using VSCode to edit and run my IPython notebooks.
Upon using them, I wanted to preserve the coloring of some magic commands like !grep when I used them. Thanks to this question here on SE, I ...
0
votes
1
answer
216
views
Providing an IPython Interpreter During Development in a Hatch Project
I have a project using Hatch as a build system for pyproject. My pyproject.toml looks like this:
[project]
name = "demo"
description = "Demo Project"
version = "0.0.1"
...
1
vote
1
answer
153
views
ignore ipdb warning, running stale stale code until the program is rerun
Suddenly I am seeing warnings from the IPython debugger ipdb that my code is stale, however editing / saving code while debugging is a common use case so this warning is not helpful.
*** WARNING: file ...
1
vote
0
answers
29
views
What is the right abstraction to create an RPC mechanism between pyodide kernel running in a worker and jupyterlite running in the main thread?
I'm creating a Tampermonkey experimentation framework and I want to be able to call window.GM functions in the main thread from pyodide-kernel running in a worker. To reach this goal, I want to create ...
0
votes
0
answers
66
views
How to fx? ipython encounters "Unhandled exception in event loop" when I move the anaconda prompt
Usually when I first move the anaconda prompt to the the right half of the screen by pressing Windows key + Right arrow,
then I run ipython,
everything goes well.
but earlier this week, I tried to run ...
0
votes
0
answers
291
views
Spyder 6 IPython console throws "An error ocurred while starting the kernel" when switching python interpreter
I have a fresh installation of Spyder 6.0.0 (Flatpak version) on Linux Mint 21.3 Cinnamon. I created a virtual environment with venv. When I change the interpreter via "Preferences > Python ...
0
votes
1
answer
62
views
Save the output of a jupyter notebook code as a "xyz.out" file (using MEEP)
I'm following this tutorial for a EM field solver ( https://mpb.readthedocs.io/en/latest/Python_Data_Analysis_Tutorial/ )
I'm running it on python, using jupyter notebook since its easier to debug and ...
0
votes
1
answer
116
views
IPython how to display display object
IPython display module HTML class, h is display object. and according to official website rich object, it could display by using display.display(). However both statement give object information ...
1
vote
1
answer
334
views
Formatting HTML Tables in Jupyter Notebook
I have a Jupyter notebook python cell where I'm trying to display some output in an HTML formatted table. I can't seem to be able to remove the border lines around internal cells.
Here's the HTML that ...
0
votes
1
answer
54
views
Change global variable from another module in Spyder
I have a module which only contains variables to be used as settings
#Settings.py
settings = {'a' : 0, 'b': True}
These variables are called around in the code in a similar manner :
from Settings ...
0
votes
1
answer
54
views
Debugging VSCode .ipynb cell that implicitly invokes IPython.display raises AttributeError
My class C overrides __getattr__.
In my .ipynb cell, I do c = C() ; c
If I run this cell, it works. But if I debug it, I now hit an AttributeError exception.
How to deal with this?
PS ...
0
votes
1
answer
71
views
Is `CPU times` of `%time` the total of User CPU time and System CPU time in IPython?
Running the code with the magic command %time in IPython got CPU times and Wall time as shown below:
In [1]: %time sum(range(1000000))
CPU times: total: 31.2 ms
Wall time: 26.7 ms
Out[1]: 499999500000
...
0
votes
1
answer
403
views
Why is my IPYNB file opened as IPY File (raw JSON) in Jupyter Notebook?
When I open an IPYNB file (downloaded from internet) in Jupyter Notebook then it displays as a raw JSON file instead of the usual interactive notebook view.
it is too confusing and frustrating.
Anyone ...