Questions tagged [ipython]
IPython is a feature-rich interactive shell for Python, and provides a kernel for frontends such as IPython Notebook and Jupyter Notebook.
ipython
7,224
questions
0
votes
1
answer
29
views
How to invoke a cell magic inside a function?
Consider the following program, which I wrote in two Jupyter Notebook cells.
Cell 1:
import rumbledb as rmbl
%load_ext rumbledb
%env RUMBLEDB_SERVER=http://public.rumbledb.org:9090/jsoniq
Cell 2:
%%...
0
votes
0
answers
18
views
Spyder console: "_" stops taking last result after being assigned to
I find it useful for _ to contain the value fo the last result. However, I sometimes want to use _ to suppress the printing of the return argument of a function call. Unfortunately, once _ has been ...
0
votes
0
answers
30
views
Positioning Jupyter Notebook Output Above Cells Using IPython(Javascript)
I prepared a jupyter widget that searches keywords in ipynb file and run corresponding cells. For better displaying purposes I prefer this widget to be shown above all cells.
To do so, I can easily ...
0
votes
0
answers
42
views
How to visualize random forest plot using graphviz, in characters outside of UTF-8 (Chinese)
I am doing a random forest model on PC orders data, which is mostly in Chinese. I have done the model and accuracy checks. However, I can't seem to generate the image due to a UnicodeEncodeError, ...
0
votes
1
answer
36
views
How do I use Jupyter/IPython magic commands in VSCode?
I saw someone else using magic commands in VSCode, but when I try them, I get a syntax error. How do I get them to work?
Note: The idea for this question came from an earlier question with a similar ...
0
votes
1
answer
34
views
question about ipywidgets and running a different process
what is a better way to run this launching function separately from the ipywidgets process?
from IPython.display import display
from multiprocessing import Process
from ipywidgets import widgets
from ...
0
votes
0
answers
27
views
qasync with IPython hangs on run_until_complete
I would like to have an asynchronous gui with PyQt5. The synchronous version of what I want would look like this:
from PyQt5.QtWidgets import QPushButton, QMainWindow
import asyncio
import time
import ...
-1
votes
0
answers
25
views
Why does ipdb make an unexplained error disappear?
I have a script that imports a module located in the plugins folder. When I run my script, I get the ModuleNotFoundError error (note that I use import) even though the module exists and I can import ...
0
votes
0
answers
38
views
Efficient Python for Data Science Interactive setup with VSCode with Remote Development?
For the past two years I've been iterating my development setup. My use case for Python is data science and machine learning, meaning the Jupyter Notebook was my first choice and my primary need is to ...
0
votes
0
answers
25
views
sympy.init_printing() not working in IPython terminal session
I wanted to do some quick calculations and I was too lazy to open a notebook file, so I just opened an IPython session in the terminal. According to sympy's documentation calling sympy.init_printing() ...
0
votes
1
answer
24
views
python: NON-pipadmin user gets ModuleNotFoundError after pipadmin installs ipython
Not a question, sharing something that worked for me:
Two linux users, both in the same "programmers" linux group.
1st user is pipadmin, and does "pip install ipython" to a local ...
0
votes
2
answers
105
views
How can I programmatically capture the output from the current cell in a function called from Jupyter / ipython?
I am trying to implement an ipython's magic cell function that takes the code from the current cell, runs it, and caches its output (in rich format) to a file. The final objective of my magic function ...
0
votes
1
answer
42
views
ipywidgets: Why does the checkbox have an offset towards the left in when being placed inside of a HBox container
I have the following script
from ipywidgets import Checkbox, Text, HBox, VBox, Layout, HTML
from IPython.display import display
checkbox = Checkbox(layout=Layout(width='8%', align_self='center'))
...
0
votes
0
answers
14
views
IPython cannot be installed [duplicate]
I tried to Install Ipython on an offline computer using the whl file.
I got this error message.
ERROR: Package 'ipython' requires a different Python: 3.9.6 not in '>=3.10'
What do i do?
I cannot ...
0
votes
0
answers
31
views
ModuleNotFoundError: No module named 'librosa' when using Mozilla TTS
I'm currently working on voice recognition and trying to use the Mozilla TTS library:
!git clone https://github.com/mozilla/TTS.git
%cd TTS
!pip install -r requirements.txt
!pip install soundfile
!pip ...
1
vote
0
answers
48
views
How to execute code Cells or notebooks from python code?
i am not a python devloper but i can fugre bits and peices out...
as a multi devloper im faced with code in all formats :: so i often forget a lot!! so i need help to be able to execute code on a ...
0
votes
0
answers
34
views
How to pull a list of YT channels with a range of 1000 to 2000 subscribers
Using youtube API to try and get a list of youtube channels with a range of subscribers but I get an error of "Paramater 'order' value 'subscriberCount' is not an allowed value."
I am ...
0
votes
0
answers
36
views
"runfile" not aware of changes to *.py file until I open it in Spyder editor
I have recently started to become familiar with the Spyder editor as a debugger. For purposes other than for debugging, however, I use my favourite external editor (Vim for me, but probably Emacs for ...
0
votes
0
answers
12
views
Using Ipython.display.Audio to Switch Between Songs
I am trying to create a small game in Colab and I am currently using the following code to start playing a song when the game is started (i.e. when the following cell is executed):
url = "...
1
vote
0
answers
107
views
Can't use ipdb: WARNING: your terminal doesn't support cursor position requests (CPR)
I have ipdb.set_trace() in my python code. When running the python script, I get the ipdb shell, but it throws the warning:
WARNING: your terminal doesn't support cursor position requests (CPR)
...
0
votes
0
answers
28
views
IPython notebook run a cell only once during runtime or even lifetime
So I already make it that wrapped into magic cell, it's working fine on Google Colaboratory. But there is package that depends on google library.
Here is the magic cell definition
#@title Register ...
0
votes
0
answers
29
views
How to use plotnine in Spyder IPython console and Plots tab
I'm using the Spyder IDE and plotnine to create ggplot objects. I am able to successfully create the ggplot objects and store them in a variable (i.e. gg). When I try to use the gg variable in the ...
1
vote
1
answer
77
views
Updating a Plotly FIgureWidget "in situ" in a Dash app
Consider the following toy Python class, which can occasionally fetch additional data from some source, and updates its display:
# minimum_working_example.py
import plotly.graph_objects as go
import ...
0
votes
1
answer
24
views
IPython --profile option works with `jupyter console` but not JupyterLab
I have the following (redacted) my-project/kernel.json in one of the standard Jupyter kernel paths:
{
"argv": [
".../my-project/.local/conda/bin/python",
"-...
1
vote
1
answer
35
views
Pretty printing Python Pandas Dataframe without header nor Index
I'm trying to pretty print a Pandas dataframe without Header nor index, without success
This pretty prints but prints also header and index
import pandas as pd
from IPython.display import display
...
0
votes
1
answer
64
views
quiver wind arrows are too lengthy for scale=1 and does not match the key arrow
All,
The argument scale=1 of the matplotlib quiver (wind plot) function produces lengthy arrows extending beyond the figure limits. On the other hand, using scale=None seems to yield a logical arrow ...
1
vote
2
answers
32
views
What magic command for appending code to existing file in jupyter notebooks
I am creating jupyter notebook tutorial to run streamlit app.
I use %%writefile dashboard_ui.py to write the cell code into the given file.
%%writefile app.py
import streamlit as st
st.title('Hello ...
0
votes
0
answers
9
views
Jupyter Colab Not Updating UI with background task or thread
I'm running a small POC to see if the ipython display can be updated in the background with a task or thread using below sample code.
The UI is updating when the slider or the button was invoked but ...
0
votes
0
answers
117
views
Failed to execute cell. Could not send execute message to runtime: Error: await connected: disconnected
While executing a cell in Google Colab, my aim was to display a selection of random rows from a DataFrame containing columns labeled Id, condensed_summary, and generated_image. Initially, I attempted ...
0
votes
0
answers
42
views
Why does iPython choose an earlier version of Python?
I'm trying to upgrade from Python 3.11 to 3.12 and running into some problems, illustrated by iPython's unwillingness to go with me. I'm doing all this on an Arm Macbook Air with Python installed by ...
0
votes
0
answers
46
views
Is it possible to ignore pyright linting only for magic commands IPython command
It's possible to use the # type: ignore comment to ignore linting on a specific line:
print(syntax error) # type: ignore
However, the same is not possible with magic commands:
%load_ext autoreload # ...
0
votes
0
answers
82
views
Issue while importing clifford lib from ipython (numba issue?)
Importing clifford fails from ipython as follow:
$ ipython
Python 3.11.7 (main, Dec 15 2023, 18:12:31) [GCC 11.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.19.0 -- An ...
1
vote
1
answer
34
views
_repr_html_ not showing when custom __getattr__ implemented
I'm trying to implement _repr_html_ on a python class (docs).
The class is a read-only facade for navigating a JSON-like object using attribute notation (based on example 19-5 from Fluent Python, ...
0
votes
0
answers
20
views
Call IPyhon functions of ipynb in vscode
I try to run javascript code
%%script node
IPython.notebook.get_cell(1).get_text()
I can ran this well in jupyter lab with IPython. But failed in vscode.
Seems the IPython is not installed in nodejs ...
1
vote
1
answer
59
views
IPython Seems to Be Installed But Won't Run
It seems to me that iPython is already installed because when I install it I am getting "Requirement already satisfied"... messages. However, when I go to launch it by typing ipython I get ...
0
votes
0
answers
53
views
Can't connect to Kernel on fresh install of Spyder through Miniconda due to port use conflicts
Every time I open spyder, the console runs into the same error, returning an error message that ends with 'ZMQError: Address in use (addr='tcp://127.0.0.1:57242')', rendering spyder unusable.
This ...
1
vote
0
answers
42
views
Arcgis Pro crashes each time I open a python (ipython) jupyter notebook
I have Arcgis Pro, ENVI and Agisoft Metashape on my laptop, but I've UNinstalled ENVI in case that is causing a problem (tho the problem persist w or w/o ENVI installed). When I try to open a ipython ...
0
votes
0
answers
17
views
ipywidgets - how to avoid flicker in text Output
I'm trying to create a viewer for a time-series of text data (i.e., a user typing) using ipywidgets.
I have something like the following:
code_out = widgets.Output()
# continuous_update=True is ideal ...
0
votes
0
answers
33
views
Porting working python 3.6 prog to python 3.8 causes isinstance to yield False depending on where the type is imported from
My prog is a railway nodes graph ported up to python 3.6 without problems. I am now porting to python 3.8 (i.e. the latest my Ubuntu 18.04.6 LTS supports) and I am experiencing imho weird behaviour of ...
0
votes
0
answers
17
views
Ipython: Slide a slider --> change text in a pdf
In the self-contained IPython/Jupyter code below, you drag a slider and the text in the pdf should change -- the pdf text should be regenerated when you release the mouse button.
I see the slider. I ...
1
vote
0
answers
59
views
Capturing Images using Webcam in Jupyter Notebook
I am trying to use the webcam to capture images that I will use to predict the age and gender using neural networks.
from IPython.display import display, Javascript, HTML
import base64
# HTML template ...
0
votes
0
answers
16
views
How to call `InteractiveShellEmbed`-based custom excepthook via `jupyter-console --existing`
Main question: How can I run an embedded IPython shell with a full-featured prompt (simple_prompt=False) in the namespace of a frame where an exception occurred in the context of a running IPython ...
1
vote
0
answers
49
views
iPython bad interpreter when run on Windows Subsystem for Linux (WSL)
I've installed iPython through pip (pip install ipython) and when I try to start the interactive shell it complains about the bad interpreter. I understand from other questions and answers that it ...
0
votes
0
answers
197
views
"Javascript Error: IPython is not defined" error when trying to run an interract command in jupyter notebook
Right so I am trying to use a software called PyWake.
With the following code blocks I am getting the above error:
# prepare for the model combination tool
from py_wake.utils.model_utils import ...
0
votes
2
answers
100
views
Jupyter ipython clear_output() not working anymore
Working on Jupyter Version: 7.1.2.
This toy example does not work :
import ipywidgets as widgets
from IPython.display import display, clear_output
def page_1():
button = widgets.Button(...
0
votes
0
answers
32
views
Linux-to-Linux IPython kernel connection over ssh failing where Windows-to-Linux works
I've been smoothly running a set-up where I develop using Spyder IDE on a Windows client connected to a remote IPython kernel running on a Linux server. (jupyter qtconsole works just as fine when ...
0
votes
0
answers
27
views
How to connect ipython kernel with custom frontend?
ipython profile create my_kernel --ipython-dir="./ipython_dir"
ipython kernel -f="./confs/c1.json" --matplotlib --ipython-dir="./ipython_dir" --profile="my_kernel&...
0
votes
0
answers
21
views
Dynamically Run Notebook using another python script
I have many Python notebooks I want to run dynamically while showing the output to the current terminal and also saving the output for each cell in the notebook as well.
I want the live outputs from ...
0
votes
1
answer
35
views
Dynamic auto-completion in JupyterLab
Can objects implement any magic function that Jupyter uses for field and getitem auto completion on that object? Or can I register a hook with the Jupyter Python kernel to do it? Would be very useful ...
1
vote
2
answers
59
views
Making an object's pretty-print representation different if it appears at top-level compared to nested
In IPython, it is possible to make an object have a custom pretty-print representation as explained in How to pretty print object representation in IPython :
class MyObject:
def _repr_pretty_(self,...