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.
7,132
questions
0
votes
0
answers
7
views
How to reset ipywidgets with multithreading?
Using Google Colab, I'm trying to create an interactive widget that will let me selection a position in an audio file, and then simultaneously play it back AND plot the waveform at the same time. I'm ...
0
votes
0
answers
12
views
Error loading kernelspec ‘python3’ when running Jupyter Lab on Ubuntu 20.04
I am trying to run Jupyter Notebook on Ubuntu 20.04, but I am unable to select a kernel. When I run jupyter kernelspec list, I get the following error message: Error loading kernelspec 'python3'. I ...
0
votes
1
answer
22
views
Pass Ipython / Jupyter variables to Powershell commands
When on Linux (bash) to list the contents of a directory in Jupyter I can simply do:
path = './foo/bar'
%ls {path}
I could not find a way achieve the same when running Jupyter on Windows (powershell)....
0
votes
0
answers
30
views
How can I send receive messages from ipython kernel?
I am working on a custom front end for an application and would like to use the ipython kernel. I am having trouble reliably receiving messages.
ipykernel==6.21.3
jupyter-client==8.0.3
With this ...
0
votes
1
answer
20
views
IPython display can be updated only once
I want to update the same display multiple times.
But it seems that it can be updated only once.
from IPython.display import display
from time import sleep
dis = display('1', display_id=True)
sleep(1)...
0
votes
0
answers
24
views
IPython autocompletion does not work for nested dynamic attributes
In this example, IPython cannot autocomplete nested dynamic attributes:
class Klass:
def __getattr__(self, attr):
if attr == 'other':
return Klass()
else:
...
0
votes
1
answer
63
views
Exporting HTML with ipywidget that includes IPython.display of IPython.core.display.HTML
I am trying to export a Jupyter notebook as a static website.
So far I had been using jupyter nbconvert --execute --to html without any problem.
However, I would like to include ipywidgets. The widget ...
0
votes
0
answers
9
views
Using the correct session ID in IPython's history when manually writing an entry at startup
I've added some entries to an IPython startup script to log the time a session is opened and which user of a shared environment (based on an environment variables). We've potentially got multiple ...
0
votes
1
answer
60
views
Sphinx generated documentation is not showing messages of logger (python code block)
I have a piece of python code that returns an INFO message using the logging package (logging.info(f"Parameter already present.")). But when I run that code in a python code block (using the ...
0
votes
0
answers
27
views
How to get a terminal in VSCode that shares all the imports and variables from a Jupyter notebook
I am testing Jupyter notebooks in VSCode for the first time. It works fine, I can create a code cell, type something like:
import os
os.listdir()
And it will list the files on the current directory ...
2
votes
1
answer
67
views
all(map) and any(map) output boolean in Python, but truthy map object in IPython
I'm using python 3.10.1, interactively through ipython (7.31.0, calling the same python 3.10.1) for exploration, and then directly through python once my scripts are ready.
I had a bug in my code ...
0
votes
0
answers
27
views
How do I open, edit, save and create files using IPython shell in terminal?
So I am trying to switch from using Jupyter notebook in the browser to using IPython shell in terminal as I prefer it. I am on Ubuntu 22.0.4 OS and when I activate IPython, I can write code and a ...
0
votes
0
answers
34
views
Vscode jupyter notebook requires ipykernel
When I try to "debug" cell of jupyter notebook opened in vscode, I get following message:
Ipykernel setup required for this feature
When I click on current kernel button (red boxed below), ...
0
votes
0
answers
9
views
Detect when the Python interpreter enters IPython?
I have code that uses a rich live display. Sometimes I IPython.embed in that code, but the display keeps updating. I would like to stop the display before the embed and restart if the embed exists. ...
0
votes
0
answers
18
views
IPython kernel running in a Docker container, that is remote to JupyterLab
Q: How do you recommend integrating a dockerized remote kernel in JupyterLab?
Scenario
There are two systems
system J, hosting JupyterLab
system D, an independent, network-connected machine for ...
1
vote
0
answers
23
views
IJulia: Install into system instead of local directory?
julia> using Pkg
julia> Pkg.add("IJulia")
Installing known registries into `~/.julia`
...
By default:
Installs known registries into ~/.julia
Install kernel into ~/.local/share/...
0
votes
0
answers
25
views
Is it possible to configure voila to shutdown when the tab is closed?
Context
I try to execute voila dashboards in a nox isolated environment to facilitate development iterations and sharing. the problem is once the nox session is launching voila, it never finishes as ...
0
votes
1
answer
27
views
In JupyterLab ipywidgets Output widget in context manger shows pyplot figure without explicit calling
If I run this example in two JupyterLab cells:
Cell[1]:
%matplotlib widget
import ipywidgets as widgets
import matplotlib.pyplot as plt
import numpy as np
output = widgets.Output()
x = np.linspace(0, ...
0
votes
0
answers
23
views
HTML tables within tab widgets are not converted correctly into HTML
I am having problem with nbconvert where resulting HTML tables do not render correctly if the tables are within tab widget. My notebook is as follows:
from IPython.display import HTML, Markdown, ...
-2
votes
0
answers
30
views
Running tkinter blocks the terminal
I have a tkinter GUI which plots different figures in different tabs. I am running the code through an interactive python terminal, however, when running the code it blocks the terminal from any ...
0
votes
1
answer
96
views
Long-running cell in Vscode Jupyter: Reconnecting to the kernel
Whenever I run a Jupyter cell in Vscode that takes a long time to complete, it does not ever seem to complete running the cell.
At the bottom of Vscode, I will see the notification
Reconnecting to ...
0
votes
0
answers
42
views
python3 input() function: 'utf-8' codec can't decode bytes when given Hangul (한굴) - invalid continuation byte
My python program expects user input in Hangul and the following error is given:
123 print("Please type Korean word")
\--\> 124 typed_word = input("\> ")
124 ...
0
votes
0
answers
25
views
Jupyter-lab accesses a different Python/terminal version than the terminal itself. Why and how to fix it?
I'm using macOS Ventura 13.2. In the console, I get...
> which python
/opt/homebrew/bin/python3
> which jupyter-lab
/Library/Frameworks/Python.framework/Versions/3.11/bin/jupyter-la
...but ...
0
votes
0
answers
16
views
Create a drop down to update the plot based on the cable_id
I have a cable_id column with different value and I am plotting mean values of several test that are performed on cable. Each cable has a unique cable_id. I am using the following code to plot the ...
0
votes
0
answers
23
views
How to reimport module variable that's read from a separate file?
I am wondering how to update a module import even when the contents of that module are not explicitly changed. I'm working in Spyder. For example, I have a simplified file directory:
test/
├── main.py
...
0
votes
0
answers
37
views
Need to assign the result of a command line that runs another .py file to a Variable in Python, but modify the command as needed within the code
I need to assign the result of the following command line to a variable:
!python script.py --img_file ../data/img.png
The catch is that I need to run this within a for loop and change the path ".....
0
votes
0
answers
20
views
IPython: Render HTML text in Colab if a condition is met
I want to be able to render some HTML text in Colab if a condition is met but it does not work. I have imported HTML from IPython.display and this works...
HTML('<h1>Hello, World</h1>')
...
0
votes
0
answers
50
views
Extracting table data from an image and export it to Excel
I was wondering if there's a different or better way of doing this as I couldn't find much example from the web.
I used Azure Form Recognizer to extract content from a table in an image, and I want ...
1
vote
0
answers
20
views
How to modify which properties show up in the JupyterLab help pop up?
For most classes and functions the help pop-up in JupyterLab shows the signature and the docstring, as in this picture:
However, for some classes, there are additional fields added, which distracts ...
3
votes
0
answers
32
views
IPython command completion with up arrow
I recently upgraded IPython and the up arrow behaviour changed. Previously, I could get the entire command from my history. Now, it's greyed out and I have to press right to complete it before I can ...
0
votes
0
answers
21
views
Python debugging, deepcopy and missing information from Tracebacks
I'm working on a particularly messy bit of code which I had written some years ago.
I had, at the time, lazily used copy.deepcopy() to create a copy of something that needed to be independently ...
0
votes
2
answers
65
views
VSCode Interactive Window "Run selection/line in Interactive Window" stopped working
I face the same problem as VS Code "Run selection/line in Python interactive window" not working at all, yet using Bisect to disable and detect the reasons through extensions didn't help. ...
0
votes
1
answer
59
views
How to install Folium in vscode on ipynb files on MacOS?
I have my VS code setup with Python and I also can run Jupyter Notebook Kernel inside of VS Code as well. Now when I Try to pip install folium on the same it give me ModuleNotFoundError.
How can I ...
0
votes
1
answer
73
views
IOPub data rate exceeded in Jupyter notebook
When I read a txt into jupyter notebook, it told me that the data rate exceeded, and I try some code, but it did not work.
with open("wiki.txt", "r") as f:
data = f.read()
...
1
vote
0
answers
90
views
VS Code Jupyter notebook dark theme for interactive elements
I'm using a dark theme for entire VS Code and I set "jupyter.themeMatplotlibPlots": true to also make the matplotlib plots dark. This setup works great as long as I don't use any interactive ...
1
vote
1
answer
34
views
How can I correctly display text in Tex format?
I am trying to display python sympy expression in the Jupyterhub Notebook in the VS Code.
When I do it in the Google Colab, it looks fine, but in the VS Code it remains in Tex format
I tried to use ...
2
votes
5
answers
1k
views
Spyder unable to load extension pydevd_plugin_pandas_types
Unsing Spyder I receive the following error when starting the IDE:
Python 3.7.15 (default, Nov 24 2022, 21:12:53)
Type "copyright", "credits" or "license" for more ...
0
votes
0
answers
15
views
python.exe - Machin Type Mismatch The image file directory\geckodriver.exe is valid but is for machine type other than the current machine [duplicate]
I tried to use firefox webdriver using geckodriver in python 3 using ipython.
I have windows 10.
Here is my code:
import time
from selenium import webdriver
from random import randint as r
driver=...
0
votes
1
answer
24
views
How do I adjust the number of spaces ipython uses for indentation in the terminal?
I use ipython in a terminal (NOT in a notebook), and by default it autoindents with 4 spaces.
How do I change the number of automatically-inserted spaces?
0
votes
1
answer
30
views
How do I combine Sympy expressions with strings without having the formatting get messed up?
I'm using Sympy to do several symbolic computations in a Jupyter Notebook and I want to be able to get outputs of the form "x = [sympy expression] = [sympy expression]". If I just do ...
0
votes
0
answers
11
views
Why does killing IPython leave the terminal in "raw" mode?
I've noticed that when I embed IPython in a Python script with IPython.embed() and then script crashes for some reason while IPython is embedded (in my case, another library called from the script ...
0
votes
1
answer
34
views
Get partial output from nbconvert.preprocessors.ExecutePreprocessor
Is there a way to get partial output from nbconvert.preprocessors.ExecutePreprocessor? Currently, I use the ExecutePreprocessor to execute my Jupyter notebook programmatically, and it returns the ...
0
votes
1
answer
29
views
How do I build something similar to a jupyter notebook code cell with rich outputs
How do I construct a script such that given a code block, it will return and display rich output like that of a cell of a Jupyter notebook? For example, is there a way to get the output section of the ...
0
votes
1
answer
17
views
How can I type wider range of LaTeX characters in the IPython REPL
This question is specific about the IPython REPL, not the Jupyter notebook.
Currently according to the docs on forward latex completion:
Only valid Python identifiers will complete
Which means that, ...
0
votes
0
answers
30
views
Running Ipython in cmd with colored background causes inconsistant background color
When changing the cmd background and font color using the "color" function and running the IPython terminal the black background is used for some of the lines, most notably the entire prompt ...
1
vote
0
answers
42
views
Method to free/reset RAM in Python
I am struggling to find a way to actually free the RAM in Python.
By monitoring its usage with a htop I try to free the RAM space but the usual del or gc.collect() do not work.
This was in a context ...
0
votes
0
answers
473
views
Why is Jupyter Notebook failing to load JavaScript (thinking, I am using JupyterLab)?
What I'm trying to do
I'm writing a Python (version==3.8.X) script for interactive visualization of molecules, which is working perfectly fine in VS Code but not in classical Jupyter Notebooks anymore ...
0
votes
0
answers
56
views
Jupyter notebook kernel error when added python flask app as a service using pywin32 on windows
I have created flask app that can run jupyter notebook server.
When we click on app from the UI, a new subprocess is created using subprocess.Popen() to construct a Jupyter notebook server.
I created ...
0
votes
0
answers
15
views
widgets.SelectMultiple KeyError: '' vlaue " when passing widgets.SelectMultiple as a parameter in ipywidgets
so I am working with ipywidgets and I have a function that I use to change the values of a list in a select multiple widget.
w_location is a select widget.selectmultiple and in the first function i ...
1
vote
0
answers
53
views
Fibonacci function can not recurse - NameError: name 'fib' is not defined
When using an embeddded interpreter
>>> import IPython
>>> IPython.embed()
In [1]: def fib(n):
...: if n <= 1:
...: return n
...: else:
...: ...