-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Matplotlib magic command not available #139
Comments
Thanks @ElioDiNino for the report. I was able to reproduce the issue with the latest demo: https://jupyterlite.github.io/demo/lab/index.html Not sure when it started to fail. Maybe @martinRenou will know more. |
It's unclear to me what changed here. It indeed used to work. The traceback only seems to show files from IPython which did not change since a year. Invoking @ianthomas23 who was looking into the matplotlib magic implementation, also @Carreau may know a bit more what changed recently in IPython. Anyway, we could probably fix it by providing a simple implementation of def arg_split(s, posix=False, strict=True):
raise s.split(" ") |
Ah, this was creating crashes for emscripten/sagemath, so yes this is a recent change to accomodate emscripten. I'll make a fix. |
If you can pin IPython to !=8.22.0,!=8.22.1 and it can wait a month for release that's great. Otherwise I can try to make a 8.22.2 by end of week. |
Thanks for the prompt PR. Pinning IPython is a fine workaround for now! |
How do you pin ipython in jupyterlite? It is already included and downgrading doesn't seem to work: import micropip
await micropip.install("ipython==8.21.0") Give the following error: ---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[1], line 2
1 import micropip
----> 2 await micropip.install("ipython==8.21.0")
File /lib/python3.11/site-packages/micropip/_commands/install.py:142, in install(requirements, keep_going, deps, credentials, pre, index_urls, verbose)
130 index_urls = package_index.INDEX_URLS[:]
132 transaction = Transaction(
133 ctx=ctx,
134 ctx_extras=[],
(...)
140 index_urls=index_urls,
141 )
--> 142 await transaction.gather_requirements(requirements)
144 if transaction.failed:
145 failed_requirements = ", ".join([f"'{req}'" for req in transaction.failed])
File /lib/python3.11/site-packages/micropip/transaction.py:204, in Transaction.gather_requirements(self, requirements)
201 for requirement in requirements:
202 requirement_promises.append(self.add_requirement(requirement))
--> 204 await asyncio.gather(*requirement_promises)
File /lib/python3.11/site-packages/micropip/transaction.py:211, in Transaction.add_requirement(self, req)
208 return await self.add_requirement_inner(req)
210 if not urlparse(req).path.endswith(".whl"):
--> 211 return await self.add_requirement_inner(Requirement(req))
213 # custom download location
214 wheel = WheelInfo.from_url(req)
File /lib/python3.11/site-packages/micropip/transaction.py:290, in Transaction.add_requirement_inner(self, req)
287 # Is some version of this package is already installed?
288 req.name = canonicalize_name(req.name)
--> 290 satisfied, ver = self.check_version_satisfied(req)
291 if satisfied:
292 logger.info(f"Requirement already satisfied: {req} ({ver})")
File /lib/python3.11/site-packages/micropip/transaction.py:235, in Transaction.check_version_satisfied(self, req)
231 if req.specifier.contains(ver, prereleases=True):
232 # installed version matches, nothing to do
233 return True, ver
--> 235 raise ValueError(
236 f"Requested '{req}', " f"but {req.name}=={ver} is already installed"
237 )
ValueError: Requested 'ipython==8.21.0', but ipython==8.22.1 is already installed |
Concerning the pyolite kernel I don't know if it's even possible to do this, but using jupyterlite-xeus and xeus-python you should be able to specify the IPython version in the |
Thank you @martinRenou for following up. This is what I understood too from reading the documentation and I tried that but hit another issue - h5py is not yet available on emscripten-forge, emscripten-forge/recipes#685. 🤷 |
I'd love to see a simple example of the use of jupyterlite-xeus... I've read about it, but been a bit daunted to try something new ;-) |
Yeah, it would be great to continue this PR.
One simple example is https://github.com/jupyterlite/xeus-python-demo, just use the template repository and change the |
Thanks for all the work on this! With regards to the IPython release, @Carreau when can I expect the next version? I'm not sure how I can properly pin the IPython version for my JupyterLite build (doing so in the |
Usually I do a monthly release on the last Friday of each month. |
Ah, so the next release will be at the end of March? |
Hi @Carreau, as mentioned in the discussion, any Jupyterlite+Pyodide based notebook using an IPython magic (%run, %matplotlib...) is currently broken without possibility to implement a quick fix (unlike xeus-python backed ones). So, if possible, I would welcome an anticipated release of IPython 8.22.2. |
I just released 8.22.2 a few minutes ago, that should fix things. It will take a few hours to be on conda-forge |
Much appreciated! I will now close this issue since creating a new build pulls in the latest IPython version and everything runs as expected. @jtpio feel free to reopen it if you only want it closed after it is resolved in the JupyterLite demo. |
Thanks all!
Normally this should be picked up automatically by the demo repo which uses the Pyodide kernel and installs |
Indeed no need to rebuild. My deployment got fixed as well. Thanks a lot @Carreau! |
Note that xeus-python should also be pulling the latest IPython automatically now as it has been updated on emscripten-forge. Thanks a lot @Carreau !! |
Description
The matplotlib magic command (
%matplotlib
) is unavailable despite the example using it here. It's not clear to me whether this is a JupyterLite bug, or just a bug with the demo so I am putting it here for now.Reproduce
Expected behavior
The magic command should execute without issue. A good way to test this would be being able to run
%matplotlib --list
.Context
Browser Output
The text was updated successfully, but these errors were encountered: