jupyter-ai
jupyter-ai copied to clipboard
Plots created by %%ai not rendered in jupyterlab
Description
I'm using %%ai to create python code that generates plots. The code is generated and correct but the plot after Output: shows as a missing file icon.
Reproduce
The magic
%%ai openai-chat:gpt-3.5-turbo
plot x squared from 1 to 10
creates an output cell with the correct code and an image for the plot. The plot is not rendered and instead shows the missing image icon.
I inspected the browser and found the plot is

but that file does not exist.
Expected behavior
The magic displays the code and the plot
Context
- OS: Chromebook Version 116.0.5845.168
- Browser and version: Chrome Version 116.0.5845.168
- JupyterLab version: Version 4.0.6
Troubleshoot Output
$PATH:
/home/xxxx/.local/bin
/usr/local/bin
/usr/bin
/bin
/usr/local/games
/usr/games
sys.path:
/home/xxxxx/.local/bin
/usr/lib/python39.zip
/usr/lib/python3.9
/usr/lib/python3.9/lib-dynload
/home/kmcisaac/.local/lib/python3.9/site-packages
/usr/local/lib/python3.9/dist-packages
/usr/lib/python3/dist-packages
sys.executable:
/usr/bin/python3
sys.version:
3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110]
platform.platform():
Linux-5.15.117-19680-g54e910f94133-x86_64-with-glibc2.31
which -a jupyter:
/home/xxxxx/.local/bin/jupyter
pip list:
Package Version
------------------------- ------------
aiohttp 3.8.5
aiosignal 1.3.1
aiosqlite 0.19.0
anyio 4.0.0
appdirs 1.4.4
argon2-cffi 23.1.0
argon2-cffi-bindings 21.2.0
arrow 1.2.3
asttokens 2.4.0
async-lru 2.0.4
async-timeout 4.0.3
attrs 23.1.0
Babel 2.12.1
backcall 0.2.0
beautifulsoup4 4.12.2
bleach 6.0.0
Brotli 1.1.0
certifi 2023.7.22
cffi 1.15.1
charset-normalizer 3.2.0
click 8.1.7
click-plugins 1.1.1
cligj 0.7.2
cloudpickle 2.2.1
colorama 0.4.6
comm 0.1.4
contourpy 1.1.1
cycler 0.11.0
dask 2023.9.2
dataclasses-json 0.5.14
debugpy 1.8.0
decorator 5.1.1
defusedxml 0.7.1
distributed 2023.9.2
exceptiongroup 1.1.3
executing 1.2.0
faiss-cpu 1.7.4
fastjsonschema 2.18.0
Fiona 1.9.4.post1
fonttools 4.42.1
fqdn 1.5.1
frozenlist 1.4.0
fsspec 2023.9.2
geopandas 0.14.0
gitdb 4.0.10
GitPython 3.1.36
greenlet 2.0.2
idna 3.4
importlib-metadata 6.8.0
importlib-resources 6.1.0
inflate64 0.3.1
ipykernel 6.25.2
ipython 8.15.0
ipython-genutils 0.2.0
ipywidgets 8.1.1
isoduration 20.11.0
jedi 0.19.0
Jinja2 3.1.2
json5 0.9.14
jsonpath-ng 1.6.0
jsonpointer 2.4
jsonschema 4.19.1
jsonschema-specifications 2023.7.1
jupyter 1.0.0
jupyter-ai 2.2.0
jupyter-ai-magics 2.2.0
jupyter-client 8.3.1
jupyter-console 6.6.3
jupyter-core 5.3.1
jupyter-events 0.7.0
jupyter-lsp 2.2.0
jupyter-server 2.7.3
jupyter-server-mathjax 0.2.6
jupyter-server-terminals 0.4.4
jupyterlab 4.0.6
jupyterlab-git 0.43.0
jupyterlab-pygments 0.2.2
jupyterlab-server 2.25.0
jupyterlab-spellchecker 0.8.4
jupyterlab-widgets 3.0.9
kiwisolver 1.4.5
langchain 0.0.277
langsmith 0.0.41
locket 1.0.0
MarkupSafe 2.1.3
marshmallow 3.20.1
matplotlib 3.8.0
matplotlib-inline 0.1.6
mistune 3.0.1
msgpack 1.0.7
multidict 6.0.4
multivolumefile 0.2.3
mypy-extensions 1.0.0
nbclient 0.8.0
nbconvert 7.8.0
nbdime 3.2.1
nbformat 5.9.2
nest-asyncio 1.5.8
notebook 7.0.4
notebook-shim 0.2.3
numexpr 2.8.7
numpy 1.26.0
openai 0.28.1
overrides 7.4.0
packaging 23.1
pandas 2.1.1
pandocfilters 1.5.0
parso 0.8.3
partd 1.4.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 10.0.1
pip 20.3.4
platformdirs 3.10.0
playwright 1.38.0
ply 3.11
prometheus-client 0.17.1
prompt-toolkit 3.0.39
psutil 5.9.5
ptyprocess 0.7.0
pure-eval 0.2.2
py7zr 0.20.6
pyarrow 13.0.0
pybcj 1.0.1
pycparser 2.21
pycryptodomex 3.19.0
pydantic 1.10.13
pyee 9.0.4
Pygments 2.16.1
pyparsing 3.1.1
pypdf2 3.0.1
pyppmd 1.0.0
pyproj 3.6.1
python-dateutil 2.8.2
python-dotenv 1.0.0
python-json-logger 2.0.7
pytz 2023.3.post1
PyYAML 6.0.1
pyzmq 25.1.1
pyzstd 0.15.9
qtconsole 5.4.4
QtPy 2.4.0
referencing 0.30.2
regex 2023.8.8
requests 2.31.0
rfc3339-validator 0.1.4
rfc3986-validator 0.1.1
rpds-py 0.10.3
scipy 1.11.3
Send2Trash 1.8.2
setuptools 52.0.0
shapely 2.0.1
six 1.16.0
smmap 5.0.1
sniffio 1.3.0
sortedcontainers 2.4.0
soupsieve 2.5
SQLAlchemy 2.0.21
stack-data 0.6.2
tblib 2.0.0
tenacity 8.2.3
termcolor 2.3.0
terminado 0.17.1
texttable 1.6.7
tiktoken 0.5.1
tinycss2 1.2.1
tomli 2.0.1
toolz 0.12.0
tornado 6.3.3
tqdm 4.66.1
traitlets 5.10.0
typing-extensions 4.8.0
typing-inspect 0.9.0
tzdata 2023.3
uri-template 1.3.0
urllib3 1.26.16
wcwidth 0.2.6
webcolors 1.13
webencodings 0.5.1
websocket-client 1.6.3
websockets 10.4
wheel 0.34.2
widgetsnbextension 4.0.9
yarl 1.9.2
zict 3.0.0
zipp 3.17.0
Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:
@Kevin-McIsaac Thank you for opening this issue! What is the raw output of the LLM you used? Is it producing an inline image, for example, or is it linking to an image hosted on a third-party web site?
Not sure how to find raw LLM output. However, I get an output cell with the python code followed. Three is a line like this
Output:
followed by an img. The image points to a local URL that does not exist.
If I try navigating to http://localhost:8888/files I get a 404
@JasonWeill Let's say we ask it to plot a viz using Matplotlib code, the expected behavior is to write the code and run it to generate a Matplotlib Plot in the cell output.