Encountered an issue with pyodide whereby the wheel for ruamel.yaml.clib fails to install as there is no pure Python wheel available (unsurprising as its a C library).
When trying to %pip install pgfinder it fails with the following
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[1], line 3
1 await __import__("piplite").install(**{'requirements': ['ipywidgets']})
2 await __import__("piplite").install(**{'requirements': ['ipysheet']})
----> 3 await __import__("piplite").install(**{'requirements': ['pgfinder']})
4 #micropip.install(pgfinder, keep_going=True)
File /lib/python3.11/site-packages/piplite/piplite.py:103, in _install(requirements, keep_going, deps, credentials, pre)
101 """Invoke micropip.install with a patch to get data from local indexes"""
102 with patch("micropip._micropip._get_pypi_json", _get_pypi_json):
--> 103 return await _micropip.install(
104 requirements=requirements,
105 keep_going=keep_going,
106 deps=deps,
107 credentials=credentials,
108 pre=pre,
109 )
File /lib/python3.11/site-packages/micropip/_micropip.py:576, in install(requirements, keep_going, deps, credentials, pre)
566 wheel_base = Path(getsitepackages()[0])
568 transaction = Transaction(
569 ctx=ctx,
570 ctx_extras=[],
(...)
574 fetch_kwargs=fetch_kwargs,
575 )
--> 576 await transaction.gather_requirements(requirements)
578 if transaction.failed:
579 failed_requirements = ", ".join([f"'{req}'" for req in transaction.failed])
File /lib/python3.11/site-packages/micropip/_micropip.py:342, in Transaction.gather_requirements(self, requirements)
339 for requirement in requirements:
340 requirement_promises.append(self.add_requirement(requirement))
--> 342 await gather(*requirement_promises)
File /lib/python3.11/site-packages/micropip/_micropip.py:349, in Transaction.add_requirement(self, req)
346 return await self.add_requirement_inner(req)
348 if not urlparse(req).path.endswith(".whl"):
--> 349 return await self.add_requirement_inner(Requirement(req))
351 # custom download location
352 wheel = WheelInfo.from_url(req)
File /lib/python3.11/site-packages/micropip/_micropip.py:457, in Transaction.add_requirement_inner(self, req)
452 if self.check_version_satisfied(req):
453 # Maybe while we were downloading pypi_json some other branch
454 # installed the wheel?
455 return
--> 457 await self.add_wheel(wheel, req.extras)
File /lib/python3.11/site-packages/micropip/_micropip.py:472, in Transaction.add_wheel(self, wheel, extras)
470 await wheel.download(self.fetch_kwargs)
471 if self.deps:
--> 472 await self.gather_requirements(wheel.requires(extras))
474 self.wheels.append(wheel)
File /lib/python3.11/site-packages/micropip/_micropip.py:342, in Transaction.gather_requirements(self, requirements)
339 for requirement in requirements:
340 requirement_promises.append(self.add_requirement(requirement))
--> 342 await gather(*requirement_promises)
File /lib/python3.11/site-packages/micropip/_micropip.py:346, in Transaction.add_requirement(self, req)
344 async def add_requirement(self, req: str | Requirement) -> None:
345 if isinstance(req, Requirement):
--> 346 return await self.add_requirement_inner(req)
348 if not urlparse(req).path.endswith(".whl"):
349 return await self.add_requirement_inner(Requirement(req))
File /lib/python3.11/site-packages/micropip/_micropip.py:457, in Transaction.add_requirement_inner(self, req)
452 if self.check_version_satisfied(req):
453 # Maybe while we were downloading pypi_json some other branch
454 # installed the wheel?
455 return
--> 457 await self.add_wheel(wheel, req.extras)
File /lib/python3.11/site-packages/micropip/_micropip.py:472, in Transaction.add_wheel(self, wheel, extras)
470 await wheel.download(self.fetch_kwargs)
471 if self.deps:
--> 472 await self.gather_requirements(wheel.requires(extras))
474 self.wheels.append(wheel)
File /lib/python3.11/site-packages/micropip/_micropip.py:342, in Transaction.gather_requirements(self, requirements)
339 for requirement in requirements:
340 requirement_promises.append(self.add_requirement(requirement))
--> 342 await gather(*requirement_promises)
File /lib/python3.11/site-packages/micropip/_micropip.py:346, in Transaction.add_requirement(self, req)
344 async def add_requirement(self, req: str | Requirement) -> None:
345 if isinstance(req, Requirement):
--> 346 return await self.add_requirement_inner(req)
348 if not urlparse(req).path.endswith(".whl"):
349 return await self.add_requirement_inner(Requirement(req))
File /lib/python3.11/site-packages/micropip/_micropip.py:444, in Transaction.add_requirement_inner(self, req)
441 metadata = await _get_pypi_json(req.name, self.fetch_kwargs)
443 try:
--> 444 wheel = find_wheel(metadata, req)
445 except ValueError:
446 self.failed.append(req)
File /lib/python3.11/site-packages/micropip/_micropip.py:312, in find_wheel(metadata, req)
309 if best_wheel is not None:
310 return wheel
--> 312 raise ValueError(
313 f"Can't find a pure Python 3 wheel for '{req}'.\n"
314 f"See: {FAQ_URLS['cant_find_wheel']}\n"
315 "You can use `micropip.install(..., keep_going=True)`"
316 "to get a list of all packages with missing wheels."
317 )
ValueError: Can't find a pure Python 3 wheel for 'ruamel-yaml-clib>=0.2.7; platform_python_implementation == "CPython" and python_version < "3.12"'.
See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel
You can use `micropip.install(..., keep_going=True)`to get a list of all packages with missing wheels.
This is known issue and documented at #3034 which suggests some work to solve this has been done already, but its not currently in pyodide-0.23.0.
One option may be to work around this and change the read_yaml() function in pgfinder to use the standard pyYAML library instead which does install under Pyodide.
Encountered an issue with pyodide whereby the wheel for
ruamel.yaml.clib
fails to install as there is no pure Python wheel available (unsurprising as its a C library).When trying to
%pip install pgfinder
it fails with the followingThis is known issue and documented at #3034 which suggests some work to solve this has been done already, but its not currently in
pyodide-0.23.0
.One option may be to work around this and change the
read_yaml()
function inpgfinder
to use the standard pyYAML library instead which does install under Pyodide.In the Pyodide console...