Skip to content

Unable to use monai in google colab #8423

@toufiqmusah

Description

@toufiqmusah

I'm unable to properly pip install, and then import monai in google colab. This started few days ago after some updates to the colab environment and seems to be associated with numpy.

Running pip install monai will install successfully but with the following error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
thinc 8.3.6 requires numpy<3.0.0,>=2.0.0, but you have numpy 1.26.4 which is incompatible.

And then importing anything monai throws the following:
ValueError Traceback (most recent call last)
in <cell line: 0>()
23 # from monai.data import Dataset
24 from monai.utils import set_determinism, first
---> 25 from monai.transforms import (
26 Compose,
27 Spacingd,

14 frames
/usr/local/lib/python3.11/dist-packages/numpy/random/_pickle.py in
----> 1 from .mtrand import RandomState
2 from ._philox import Philox
3 from ._pcg64 import PCG64, PCG64DXSM
4 from ._sfc64 import SFC64
5

numpy/random/mtrand.pyx in init numpy.random.mtrand()

ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Image

Image

I have so far tried downgrading/upgrading numpy with no success.

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