Skip to content

micropip.install(["pkg==2", "pkg"]) always brings in "pkg" #232

@WebReflection

Description

@WebReflection

Coming from pyodide/pyodide#5603 (comment) and, as suggested by @hoodmane, here the issue:

  • when an explicit version of a package is specified in the list, if the same package without version, or any other package that depends on pkg is present, the default version specified in the yaml file becomes the import pkg
  • when it comes to multiple packages at once, there is no solution to this, example: micropip.install("fsspec ==2025.3.2", "fastparquet") where fastparquet has fsspec as dependency, both current 2024.3.1 and 2025.3.2 are downloaded but importing fsspec will always provide the indirectly resolved package instead of the explicitly required 2025.3.2
  • if packages are loaded in different steps, everything works as expected
# this always brings in both but fsspec will be 2024.3.1
micropip.install(["fsspec ==2025.3.2", "fsspec"])
# fsspec 2024.3.1

# doing this will download `fsspec` once with the desired version
micropip.install("fsspec ==2025.3.2")
micropip.install("fsspec") # no-op
# fsspec 2025.3.2

The same goes for mixed packages:

micropip.install(["fsspec ==2025.3.2", "fastparquet"])
# fsspec 2024.3.1 imported by parquet as dependency

# this works as expected
micropip.install("fsspec ==2025.3.2")
micropip,install("fastparquet")
# fsspec 2025.3.2 and not re-imported via fastparquet

Thanks in advance for looking into this!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions