Skip to content
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

Optional dependency ignored by micropip #69

Open
oeway opened this issue Jun 30, 2023 · 1 comment
Open

Optional dependency ignored by micropip #69

oeway opened this issue Jun 30, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@oeway
Copy link

oeway commented Jun 30, 2023

🐛 Bug

When install optional dependency micropip.install(['pydantic[email]']) (defined here), however, installing the dependency manually works.

To Reproduce

Go to https://pyodide.org/en/stable/console.html

Welcome to the Pyodide terminal emulator 🐍
Python 3.11.2 (main, Jun 18 2023 00:11:52) on WebAssembly/Emscripten
Type "help", "copyright", "credits" or "license" for more information.
>>> import micropip
await micropip.install(['pydantic[email]'])
import email_validator
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ModuleNotFoundError: No module named 'email_validator'
>>> import micropip
await micropip.install(['pydantic[email]', 'email-validator>=2.0.0'])
import email_validator
>>> 

Expected behavior

It should work by just doing micropip.install(['pydantic[email]']).

Environment

>>> import pyodide
>>> pyodide.__version__
'0.23.3'
@oeway oeway added the bug Something isn't working label Jun 30, 2023
@rth rth transferred this issue from pyodide/pyodide Jun 30, 2023
@rth
Copy link
Member

rth commented Jun 30, 2023

I think it's because pydantic is built as part of the main Pyodide distribution here which doesn't have the notion of optional dependencies. Micropip loads it via loadPyodide. For packages installed from PyPI it should handle the optional dependencies correctly.

So I agree it's not an ideal behavior, but I'm not sure what we can do about it. Supporting extra dependencies in the main distribution would be rather difficult (the same way as conda doesn't support them).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants