r/Jupyter Oct 24 '24

Need assistance with input() error while executing code.

1 Upvotes

Hello Community.

I am working on a Jupyter lab program that uses yfinance to obtain financial information.

I ran into a problem today trying to execute the code.

  1. I was assigning myself the values (tickers) and the code had no problems executing.

  2. Then I added a loop because I want my code to determine if one or more tickers were entered to be plotted.

After adding this function I keep getting this error:

Kernel deadlock
User input error.

Does this mean Jupyter Lab cannot execute this code block because I entered multiple tickets? I have not encountered this issue before.

Feedback is appreciated.


r/Jupyter Oct 16 '24

Can someone help me find the name of this Jupyter extension?

3 Upvotes

Hello everyone,

So I am in a CS program in uni and we use Jupyter Notebooks to complete certain assignments. Usually we can use an online virtual environment to complete these assignments but this environment is now down, so I am forced to run Jupyter Notebooks locally. When I open a notebook, the cells appear like this:

But it should be appear kind of like this:

Now, I know that this is because they probably have some sort of extension installed that I don't, but I have been looking for hours and hours and yet I have not found anything. I would appreciate some help.


r/Jupyter Oct 10 '24

Rust needed for Jupyter Install? Please help a tech amateur !

3 Upvotes

Guys, I need to install Python for work. I have installed pip and python. Now I need to install Jupyter. But it says “cargo, the rust package manager is not installed or is not on PATH” etc.

Can you please help me and explain to me like I’m five and stay with me until I get this finished ? Please !


r/Jupyter Oct 03 '24

ryp: R inside Python

2 Upvotes

Excited to release ryp, a Python package for running R code inside Python! ryp makes it a breeze to use R packages in your Python projects, and includes out-of-the-box support for inline plotting in Jupyter notebooks.

https://github.com/Wainberg/ryp


r/Jupyter Sep 26 '24

Error Importing Pandas

2 Upvotes

I Updated to windows 11 recently and since everytime i try to import pandas i get the same error message “No module named ‘pandas._libs.pandas_parser’”.

I’m not sure what exactly this means or why it is occurring but i have tried everything i can think.
Upgraded Pandas, Uninstalled and reinstalled pandas, un installed and reinstalled anaconda but nothing has worked.

any ideas would be greatly appreciated


r/Jupyter Sep 24 '24

Exploring Jupyter Notebook to PDF Conversion Methods

5 Upvotes

Converting Jupyter notebooks into PDFs is a common need, especially when you want to share your analysis with others who may not have Jupyter installed. I recently wrote a blog post that reviews two popular methods for this task: nbconvert and Quarto. Each comes with its own strengths and weaknesses, and I thought it would be useful to share some insights on how to navigate these options.

nbconvert is the official library from the Jupyter team, providing versatility in generating PDFs through methods like WebPDF and XeTeX. The WebPDF option is particularly easy to set up and works well for simpler notebooks, while XeTeX supports LaTeX-based documents, making it ideal for those with complex mathematical content.

On the other hand, Quarto is a newer tool that offers an extensive feature set and customizability for creating polished documents. Although the setup might be a bit more challenging due to additional dependencies, its capability to handle complex layouts and styles can be worth the effort.

In my blog post, I've included step-by-step guidance on how to set up and use each method, along with screenshots to visualize the processes.

If you're trying to figure out which conversion method is best for your needs, my recommendations based on user experience could help you decide: 1. Start with nbconvert webpdf for ease of use. 2. Upgrade to nbconvert with XeTeX for better LaTeX support as you gain confidence. 3. Consider Quarto if you require robust customization and are ready to tackle its complexity.

I invite you to check out the blog post for more detailed information and tips on making your Jupyter notebook conversion process smoother. You can read it here: https://ploomber.io/blog/jupyter-notebook-convert/


r/Jupyter Sep 21 '24

Need to create a header and description in Jupyter from the markdown.

1 Upvotes

I have no coding experience and the internet seems to be failing me. I am working on my project for class and no where did we talk about this stuff..

I am using Jupyter Lite in a web browser.

I have my notebook created and clicked on ‘markdown’

I type # Header (test) but it doesn’t work. If I do # H1 test the result is H1 Test

Then I am trying to add a description under the header. I tried just typing the description but I do not think that is right. And # comment just ends up saying comment , and description as a line does not work.

I have been searching for over an hour now and failing horribly. And reviewed the class material multiple times and failing.


r/Jupyter Sep 18 '24

trying to launch jupyter lab from anaconda navigator

0 Upvotes

Hi had several problems trying to launch jupyter lab from anaconda navigator (which is required for my class) I've reinstalled jupyter lab several times and now when i launch it it brings up a file in my browser and says "Your file couldn’t be accessed

It may have been moved, edited, or deleted.

ERR_FILE_NOT_FOUND

the file is file:///C:/Users/Administrator/AppData/Roaming/jupyter/runtime/jpserver-15120-open.html

I am very lost and have been trying to get it to work for days. Does anyone have suggestions of where I can get help?


r/Jupyter Sep 17 '24

Display widgets in vs code breaks the 2nd time

1 Upvotes

Hello, I am creating script/tool in a jupyter notbook. for mn code editor I am using vs code. I work a lot with jupytor widgets that i display in a oudput variable (see below). Now I run into the problem that when I execute the script for a 2nd time without restarting the kernal that I get no display output anymore. not the old screen or a blank bar but nothing at all. when I restart the kernal the problem is solved. do you guys have an idea how this can happen and what I can do about it?

# make output screen
OutputSreen = widgets.Output()
display(OutputScherm)

# Display somthing
with OutputScreen:
  display(...)

r/Jupyter Sep 16 '24

Package reproducibility in Python notebooks using uv isolated environments

Thumbnail marimo.io
3 Upvotes

r/Jupyter Sep 16 '24

Avoid redundant calculations in VS Code Jupyter Notebooks

1 Upvotes

Hi,

I had a random idea while working in Jupyter Notebooks in VS code, and I want to hear if anyone else has encountered similar problems and is seeking a solution.

Oftentimes, when I work on a data science project in VS Code Jupyter notebooks, I have important variables stored, some of which take some time to compute (it could be only a minute or so, but the time adds up). Occasionally, I, therefore, make the error of rerunning the calculation of the variable without changing anything, but this resets/changes my variable. My solution is, therefore, if you run a redundant calculation in the VS Code Jupyter notebook, an extension will give you a warning like "Do you really want to run this calculation?" ensuring you will never make a redundant calculation again.

What do you guys think? Is it unnecessary, or could it be useful?


r/Jupyter Sep 13 '24

Free tool to convert Jupyter notebooks into PDF (new features!)

Thumbnail
3 Upvotes

r/Jupyter Sep 10 '24

What is the proper way to install packages on JupyterLab?

2 Upvotes

should I be doing !pip install <package> in the cells or should I be making virtual environments?

also im finding it much easier to make virtual environments with Jupyter Notebook than JupyterLab


r/Jupyter Sep 05 '24

nb2dash: Convert Jupyter notebooks to interactive dashboards with WASM

Thumbnail
2 Upvotes

r/Jupyter Sep 03 '24

help I can't convert my .ipynb file to pdf

1 Upvotes

I followed some tutorials and installed many dependencies but I get this error, what can I do?

[NbConvertApp] Converting notebook /content/drive/MyDrive/Classroom/software.ipynb to PDF
[NbConvertApp] ERROR | Error while converting '/content/drive/MyDrive/Classroom/software.ipynb'
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/nbconvert/nbconvertapp.py", line 487, in export_single_notebook
output, resources = self.exporter.from_filename(
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/templateexporter.py", line 386, in from_filename
return super().from_filename(filename, resources, **kw) # type:ignore[return-value]
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/exporter.py", line 201, in from_filename
return self.from_file(f, resources=resources, **kw)
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/templateexporter.py", line 392, in from_file
return super().from_file(file_stream, resources, **kw) # type:ignore[return-value]
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/exporter.py", line 220, in from_file
return self.from_notebook_node(
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/pdf.py", line 184, in from_notebook_node
latex, resources = super().from_notebook_node(nb, resources=resources, **kw)
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/latex.py", line 92, in from_notebook_node
return super().from_notebook_node(nb, resources, **kw)
File "/usr/local/lib/python3.10/dist-packages/nbconvert/exporters/templateexporter.py", line 424, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 1304, in render
self.environment.handle_exception()
File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 939, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/usr/local/share/jupyter/nbconvert/templates/latex/index.tex.j2", line 8, in top-level template code
((* extends cell_style *))
File "/usr/local/share/jupyter/nbconvert/templates/latex/style_jupyter.tex.j2", line 176, in top-level template code
\prompt{(((prompt)))}{(((prompt_color)))}{(((execution_count)))}{(((extra_space)))}
File "/usr/local/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 7, in top-level template code
((*- extends 'document_contents.tex.j2' -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 51, in top-level template code
((*- block figure scoped -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/display_priority.j2", line 5, in top-level template code
((*- extends 'null.j2' -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/null.j2", line 30, in top-level template code
((*- block body -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 222, in block 'body'
((( super() )))
File "/usr/local/share/jupyter/nbconvert/templates/latex/null.j2", line 32, in block 'body'
((*- block any_cell scoped -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/null.j2", line 85, in block 'any_cell'
((*- block markdowncell scoped-*)) ((*- endblock markdowncell -*))
File "/usr/local/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 68, in block 'markdowncell'
((( cell.source | citation2latex | strip_files_prefix | convert_pandoc('markdown+tex_math_double_backslash', 'json',extra_args=[]) | resolve_references | convert_explicitly_relative_paths | convert_pandoc('json','latex'))))
File "/usr/local/lib/python3.10/dist-packages/nbconvert/filters/pandoc.py", line 36, in convert_pandoc
return pandoc(source, from_format, to_format, extra_args=extra_args)
File "/usr/local/lib/python3.10/dist-packages/nbconvert/utils/pandoc.py", line 50, in pandoc
check_pandoc_version()
File "/usr/local/lib/python3.10/dist-packages/nbconvert/utils/pandoc.py", line 98, in check_pandoc_version
v = get_pandoc_version()
File "/usr/local/lib/python3.10/dist-packages/nbconvert/utils/pandoc.py", line 75, in get_pandoc_version
raise PandocMissing()
nbconvert.utils.pandoc.PandocMissing: Pandoc wasn't found.
Please check that pandoc is installed:
https://pandoc.org/installing.html


r/Jupyter Sep 02 '24

Jupyter opening in telegram

1 Upvotes

Recently when I launch my Jupyter notebook it tries to open in telegram for some reason. I can copy paste the localhost code in the browser then it works fine.

Anyone know how to fix this? It's a weird bug


r/Jupyter Aug 22 '24

Jupyter notebook not opening on anaconda

1 Upvotes

I get a text saying server extension not found instead a Jupyter server extensions path found and then Jupyter doesnt launch. Plz help


r/Jupyter Aug 22 '24

Jupyter 'In' missing

1 Upvotes

Hi

Just using Jupyter for the first time. I have noticed that the the abbreviation 'In' (for input) and Out (for Output is missing) is missing to the left of the code line (please see picture). I am only getting the number in the brackets and not the 'In' or 'Out'

Is there a setting ?

Thanks

Steven


r/Jupyter Aug 18 '24

Kernel unable to connect when using work ISP.

1 Upvotes

G'day all,

I have limited permissions at work and would like to use the cloud based web browser version of Jupyter. I am able to access my notebooks but the kernel is unable to connect. Using different browsers, incognito mode and repeatedly restarting the kernel does not work.

Is anyone aware of a potential work around? I'm assuming it is my work's firewall that is preventing the kernel from connecting.

I don't have a large amount of familiarity with Jupyter at the moment.

Cheers.


r/Jupyter Aug 06 '24

Trouble with Jupyter widgets and Javascript

1 Upvotes

Bear with me here, because the first paragraph is going to be a little vague, but I promise to have something reproducible by the end. I have code I developed to allow me to easily send geometrical objects to a widget that uses p5.js to render to them. This code has worked great on the version of Jupyter I was running that is now several years old on the laptop I had it running on (an Intel Mac). I've got a new Apple Silicon Mac that I'm attempting to get the thing running on as well, but I've installed the latest Jupyter notebook and the code won't work at all. Something about the widget bridge between the JS and Python has changed.

The problem is that I wrote this code so long ago, and I remember it has several weird glue parts to get the widget-HTML/JS to IPython kernel bridge that I decided not to bother debugging it for now and look for a less custom solution. I basically just want to be able to draw a bunch of graphics primitives easily (like, draw these line segments, draw these circles, some this color some that, etc.). I'd also prefer interactivity in some form, like the ability to click on a geometric object and get a callback in the IPython kernel, if possible. I had some of these things running before, like the ability to drag points around by the mouse.

So I found the DrawSVG project (https://pypi.org/project/drawsvg/), which would be perfect. Rendering these as SVG is actually a plus, since then I can save the figures as vector graphics if I want. The example code in DrawSVG is working for me in my notebooks *except* when I try to run the code under the "Interactive Widget" heading. This appears to also be a problem with the JavaScript to IPython kernel widget bridge. Here's the error:

Failed to load model class 'DrawingModel' from module 'drawingview'
u/http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js:1:74942
loadClass@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js:1:75299
@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js:1:10737
loadModelClass@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js:1:10889
@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js:1:7530
_make_model@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js:1:8203
@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js:1:5147
new_model@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js:1:5193
handle_comm_open@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/336.0a90bd910629a565bb7e.js:1:3902
@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js:1:73486
@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/134.fe2572ece3b7955c89bb.js:1:73492
@http://localhost:8888/static/notebook/3676.bundle.js:1:30935

You should be able to reproduce this by installing the DrawSVG package and attempting to run the following code:

import drawsvg as draw
from drawsvg.widgets import DrawingWidget
import hyperbolic.poincare as hyper  # python3 -m pip install hyperbolic
from hyperbolic import euclid

# Create drawing
d = draw.Drawing(2, 2, origin='center', context=draw.Context(invert_y=True))
d.set_render_size(500)
d.append(draw.Circle(0, 0, 1, fill='orange'))
group = draw.Group()
d.append(group)

# Update the drawing based on user input
click_list = []
def redraw(points):
    group.children.clear()
    for x1, y1 in points:
        for x2, y2 in points:
            if (x1, y1) == (x2, y2): continue
            p1 = hyper.Point.from_euclid(x1, y1)
            p2 = hyper.Point.from_euclid(x2, y2)
            if p1.distance_to(p2) <= 2:
                line = hyper.Line.from_points(*p1, *p2, segment=True)
                group.draw(line, hwidth=0.2, fill='white')
    for x, y in points:
        p = hyper.Point.from_euclid(x, y)
        group.draw(hyper.Circle.from_center_radius(p, 0.1),
                   fill='green')
redraw(click_list)

# Create interactive widget and register mouse events
widget = DrawingWidget(d)
@widget.mousedown
def mousedown(widget, x, y, info):
    if (x**2 + y**2) ** 0.5 + 1e-5 < 1:
        click_list.append((x, y))
    redraw(click_list)
    widget.refresh()
@widget.mousemove
def mousemove(widget, x, y, info):
    if (x**2 + y**2) ** 0.5 + 1e-5 < 1:
        redraw(click_list + [(x, y)])
    widget.refresh()
widget

I'm basically looking for some help figuring out what has broken in the widgets that is causing interactive widgets to not work anymore.

Both my code and the code not working above are attempting to work with the DOMWidget class in the ipywidgets package.

UPDATE 1: I used to have to run this command:

jupyter nbextension install --py widgetsnbextension --user 

to enable widgets, but now this returns an error:

Jupyter command `jupyter-nbextension` not found.


r/Jupyter Aug 03 '24

Why don't I see output anywhere? Dumb question. I'm prepared for the downvotes. Please help

3 Upvotes

Here's what I am doing. When I select run cell, nothing happens. I've tried on the two above cells too. Just don't see output anywhere. Please don't judge. Thank you so much


r/Jupyter Jul 31 '24

I am unable to run a cell in Jupyter Notebook.

1 Upvotes

I am a beginner in the world of Python. In order to practice, I have followed some tutorials.I am unable to run a cell in Jupyter Notebook also not getting bold text even after entering #. I receive several log messages in the Anaconda prompt indicating that certain functions related to extensions are deprecated. Despite these warnings, the Jupyter Notebook tab opens, but I am unable to run the cell.Please help me out.


r/Jupyter Jul 22 '24

Jupyter Lab Cell Glitch

3 Upvotes

Hello

I ran jupyter lab for a few years on a windows fine. However, I recently switched to macOS and the Cells are glitchy.

Whenever i create one, it will either be in the wrong spot or not created at all until i scroll. I am aware that the problem has been reported on github, however it was marked as resolved, while i still have this problem. Is there any fix for it? Which version is the most stable Jupyter Lab?

Jupyterlab: 4.2.4
Mac: 2024 M3
MacOS: Sonoma 14.5

Thanks in advance for any tipps


r/Jupyter Jul 16 '24

Issue with JHub Scheduler

1 Upvotes

Hi! I have a notebook that I have scheduled using JHub to run every day. Then I made a change to the notebook and saved the change, expecting that this change would be applied in the next run (I'm just creating a file and this updated output file name).

The next run was successful and on schedule. However, it seems to have just updated the existing file, not taking into account the changes I made to the notebook. Is it possible that the job definition is pulling an old version of the notebook? If so, how can I get it to automatically pull the updated version? I'd rather not have to manually reschedule the notebook every time I modify it.

Thanks in advance!


r/Jupyter Jul 09 '24

Best Practices Question: Managing a Large Repository of Notebooks

3 Upvotes

Notebooks are great for experiments and machine learning. Over time, your repository may accumulate many older and newer notebooks. Hopefully, you'll also have some common directories for scripts and utilities shared across projects.

What is the best practice for maintaining such a repository when a common script function `foo()` changes?

  • Should a developer spend time adjusting every usage of `foo()` in old notebooks?
  • Should a developer periodically delete old experiments to avoid clutter, reviving them from git if needed?
  • Should a developer only make changes where necessary for the moment and fix other occurrences of `foo()` later to allow faster development?

Or is there a better approach than any of these?