pyodide: Cannot install `ruamel.yaml`: `Can't find a pure Python 3 wheel for ruamel-yaml-clib>=0.2.6`

🐛 Bug

I cannot install ruamel.yaml on Pyodide.

To Reproduce

>>> await micropip.install('ruamel.yaml', keep_going=True)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/lib/python3.10/site-packages/micropip/_micropip.py", line 552, in install
    raise ValueError(
ValueError: Can't find a pure Python 3 wheel for: 'ruamel-yaml-clib>=0.2.6; platform_python_implementation == "CPython" and python_version < "3.11"'
See: https://pyodide.org/en/stable/usage/faq.html#micropip-can-t-find-a-pure-python-wheel

I see that this dependency should only be installed for CPython, but apparently micropip is trying to pull it anyways?

Expected behavior

Installing ruamel.yaml works.

Environment

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 16 (13 by maintainers)

Most upvoted comments

it is a bug in micropip which is happening because it canonicalize the requested package name.

I don’t think this is correct. I did the following:

pyodide.loadPackage("micropip");
pyodide.runPythonAsyinc(`import micropip; await micropip.install("ruamel.yaml", deps=False)`);
pyodide.runPython(`
import sys
from ruamel.yaml import YAML
yaml = YAML()
d = dict(a=dict(b=2),c=[3, 4])
yaml.dump(d, sys.stdout)
`);

and it printed:

a:
  b: 2
c:
- 3
- 4

So I think it works fine. If you try without deps=False, then you get an error about ruamel-yaml-clib, which we aren’t building. The solution would be to build ruamel-yaml-clib as well.

I found that micropip.install("ruamel.yaml") is still not available though… it is a bug in micropip which is happening because it canonicalize the requested package name.

ruamel.yaml works without ruamel.yaml.clib (it might be slow, but works). The issue is that we are using the incorrect package name for ruamel.yaml in Pyodide: ruamel. I think I fixed this in #2637 #3006 . I’ll split out a PR from it that fixes this issue first.