Skip to content

Support for copernicusmarine package in Pyodide/JupyterLite environment (import failing due to incompatible native dependencies) #18

@dbazin-eo

Description

@dbazin-eo

Summary

I would like to request support for installing and importing the Copernicus Marine Toolbox (copernicusmarine) (https://github.com/mercator-ocean/copernicus-marine-toolbox) within the JupyterLite/Pyodide-based environment provided by climet-eu/lab.

This toolbox is essential for subsetting and accessing Copernicus Marine datasets directly within browser-based training notebooks. However, attempts to install or import the package currently fail due to missing/unsupported dependencies in the Pyodide runtime.


Context

I attempted installation using both:

  • micropip.install("copernicusmarine")
  • %pip install copernicusmarine

In both cases, the installation step completes (or appears to), but the import fails due to underlying binary dependencies such as:

  • pydantic_core
  • orjson
  • jsonschema
  • Dynamic libraries (*.so) not supported or failing to load in WASM

Typical errors include:

ImportError: Could not load dynamic lib: ...
Error: bad export type for '_ZN64...'

and:

Error: bad export type for '__rust_no_alloc_shim_is_unstable': undefined

These errors indicate that the dependencies required by copernicusmarine rely on native extensions or Rust-based modules that are not yet available in a Pyodide-compatible build.


Reasons, motivations and use cases

  • The copernicusmarine client is the official Python interface for downloading, subsetting, and searching datasets from the Copernicus Marine Service.
  • It is a key dependency for browser-based training notebooks, especially for large-scale training (e.g., thousands of participants) where zero-install environments such as climet-eu lab are essential.
  • Without it, users cannot interact directly with Copernicus Marine data from within the browser notebook.

Required Dependencies

The package currently depends on libraries known to be problematic in Pyodide unless precompiled for WASM, though most of the packages are already available in climet-eu lab and it's already a very nice work from you 🙏

  • pydantic>=2
  • pydantic_core
  • orjson
  • jsonschema
  • pystac
  • h5py, zarr, numcodecs
  • numpy, pandas, xarray, fsspec

The full list is available from the official documentation: https://toolbox-docs.marine.copernicus.eu/en/stable/installation.html#dependencies

Providing Pyodide-compatible builds for these appears necessary for successful import.


Request

Could you please:

Add Pyodide-compatible builds for:

  • copernicusmarine
  • Its core dependencies (pydantic_core, orjson, jsonschema, pystac, etc.)

Or

Provide a curated pyodide-lock.json including the full dependency graph precompiled for WASM.

Or

Document whether supporting this package is currently blocked by Rust-based dependencies.


Reproduction Steps

Using %pip:

%pip install copernicusmarine
import copernicusmarine

Using micropip:

import micropip
await micropip.install("copernicusmarine")
import copernicusmarine

Both result in import errors due to incompatible shared objects.


Environment


Expected Outcome

Be able to import and use:

import copernicusmarine
temperature_climatology = copernicusmarine.open_dataset(
  dataset_id="cmems_mod_glo_phy_my_0.083deg-climatology_P1M-m",
  variables=["thetao", "zos", "so"],
  minimum_longitude=4.14,
  maximum_longitude=8.29,
  minimum_latitude=54.69,
  maximum_latitude=60.46,
  minimum_depth=0,
  maximum_depth=5000,
)

and work directly with Copernicus Marine datasets:

print(temperature_climatology)

Thank You

Adding support for this package would greatly benefit browser-based training workflows.

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