Skip to content

Using graphein 1.7.7 in colab #424

@mahdi-shafiei

Description

@mahdi-shafiei

Describe the bug
Using graphein in colab:
When graphin is installed in colab environment , numpy gets downgraded when using pip install graphein in colab. Then from graphein.protein.config import ProteinGraphConfig fails with this message:

ValueError                                Traceback (most recent call last)
[<ipython-input-2-427fb779643b>](https://localhost:8080/#) in <cell line: 0>()
----> 1 from graphein.protein.config import ProteinGraphConfig
      2 
      3 config = ProteinGraphConfig()
      4 config.dict()

8 frames
[/usr/local/lib/python3.11/dist-packages/numpy/random/_pickle.py](https://localhost:8080/#) in <module>
----> 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

To Reproduce
This is the output of running !pip install graphein:

Collecting graphein
  Downloading graphein-1.7.7-py3-none-any.whl.metadata (19 kB)
Requirement already satisfied: pandas in /usr/local/lib/python3.11/dist-packages (from graphein) (2.2.2)
Collecting biopandas>=0.5.1 (from graphein)
  Downloading biopandas-0.5.1-py3-none-any.whl.metadata (1.6 kB)
Collecting biopython (from graphein)
  Downloading biopython-1.85-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (13 kB)
Collecting bioservices>=1.10.0 (from graphein)
  Downloading bioservices-1.12.1-py3-none-any.whl.metadata (19 kB)
Collecting cpdb-protein==0.2.0 (from graphein)
  Downloading cpdb-protein-0.2.0.tar.gz (68 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 68.6/68.6 kB 4.6 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: cython in /usr/local/lib/python3.11/dist-packages (from graphein) (3.0.12)
Collecting deepdiff (from graphein)
  Downloading deepdiff-8.4.2-py3-none-any.whl.metadata (7.1 kB)
Collecting loguru (from graphein)
  Downloading loguru-0.7.3-py3-none-any.whl.metadata (22 kB)
Collecting looseversion (from graphein)
  Downloading looseversion-1.3.0-py2.py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: matplotlib>=3.4.3 in /usr/local/lib/python3.11/dist-packages (from graphein) (3.10.0)
Requirement already satisfied: multipledispatch in /usr/local/lib/python3.11/dist-packages (from graphein) (1.0.0)
Requirement already satisfied: networkx in /usr/local/lib/python3.11/dist-packages (from graphein) (3.4.2)
Collecting numpy<2 (from graphein)
  Downloading numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.0/61.0 kB 4.3 MB/s eta 0:00:00
Requirement already satisfied: plotly in /usr/local/lib/python3.11/dist-packages (from graphein) (5.24.1)
Requirement already satisfied: pydantic in /usr/local/lib/python3.11/dist-packages (from graphein) (2.11.3)
Requirement already satisfied: rich in /usr/local/lib/python3.11/dist-packages (from graphein) (13.9.4)
Collecting rich-click (from graphein)
  Downloading rich_click-1.8.8-py3-none-any.whl.metadata (7.9 kB)
Requirement already satisfied: seaborn in /usr/local/lib/python3.11/dist-packages (from graphein) (0.13.2)
Requirement already satisfied: pyyaml!=5.4.0,!=5.4.1,!=6.0.0 in /usr/local/lib/python3.11/dist-packages (from graphein) (6.0.2)
Requirement already satisfied: scikit-learn in /usr/local/lib/python3.11/dist-packages (from graphein) (1.6.1)
Requirement already satisfied: scipy>=1.8 in /usr/local/lib/python3.11/dist-packages (from graphein) (1.14.1)
Requirement already satisfied: tqdm in /usr/local/lib/python3.11/dist-packages (from graphein) (4.67.1)
Collecting wget (from graphein)
  Downloading wget-3.2.zip (10 kB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: xarray in /usr/local/lib/python3.11/dist-packages (from graphein) (2025.1.2)
Collecting jaxtyping (from graphein)
  Downloading jaxtyping-0.3.1-py3-none-any.whl.metadata (7.0 kB)
Collecting mmtf-python==1.1.3 (from biopandas>=0.5.1->graphein)
  Downloading mmtf_python-1.1.3-py2.py3-none-any.whl.metadata (1.2 kB)
Collecting looseversion (from graphein)
  Downloading looseversion-1.1.2-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.11/dist-packages (from biopandas>=0.5.1->graphein) (75.2.0)
Requirement already satisfied: msgpack>=1.0.0 in /usr/local/lib/python3.11/dist-packages (from mmtf-python==1.1.3->biopandas>=0.5.1->graphein) (1.1.0)
Collecting appdirs<2.0.0,>=1.4.4 (from bioservices>=1.10.0->graphein)
  Downloading appdirs-1.4.4-py2.py3-none-any.whl.metadata (9.0 kB)
Requirement already satisfied: beautifulsoup4<5.0.0,>=4.12.3 in /usr/local/lib/python3.11/dist-packages (from bioservices>=1.10.0->graphein) (4.13.4)
Requirement already satisfied: click<9.0.0,>=8.1.8 in /usr/local/lib/python3.11/dist-packages (from bioservices>=1.10.0->graphein) (8.1.8)
Collecting colorlog<7.0.0,>=6.9.0 (from bioservices>=1.10.0->graphein)
  Downloading colorlog-6.9.0-py3-none-any.whl.metadata (10 kB)
Collecting easydev<0.14.0,>=0.13.3 (from bioservices>=1.10.0->graphein)
  Downloading easydev-0.13.3-py3-none-any.whl.metadata (4.0 kB)
Collecting grequests<0.8.0,>=0.7.0 (from bioservices>=1.10.0->graphein)
  Downloading grequests-0.7.0-py2.py3-none-any.whl.metadata (1.3 kB)
Requirement already satisfied: lxml<6.0.0,>=5.3.0 in /usr/local/lib/python3.11/dist-packages (from bioservices>=1.10.0->graphein) (5.3.2)
Requirement already satisfied: requests<3.0.0,>=2.32.3 in /usr/local/lib/python3.11/dist-packages (from bioservices>=1.10.0->graphein) (2.32.3)
Collecting requests-cache<2.0.0,>=1.2.1 (from bioservices>=1.10.0->graphein)
  Downloading requests_cache-1.2.1-py3-none-any.whl.metadata (9.9 kB)
Collecting suds-community<2.0.0,>=1.2.0 (from bioservices>=1.10.0->graphein)
  Downloading suds_community-1.2.0-py3-none-any.whl.metadata (1.6 kB)
Requirement already satisfied: wrapt<2.0.0,>=1.17.2 in /usr/local/lib/python3.11/dist-packages (from bioservices>=1.10.0->graphein) (1.17.2)
Collecting xmltodict<0.15.0,>=0.14.2 (from bioservices>=1.10.0->graphein)
  Downloading xmltodict-0.14.2-py2.py3-none-any.whl.metadata (8.0 kB)
Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.4.3->graphein) (1.3.2)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.4.3->graphein) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.4.3->graphein) (4.57.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.4.3->graphein) (1.4.8)
Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.4.3->graphein) (24.2)
Requirement already satisfied: pillow>=8 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.4.3->graphein) (11.1.0)
Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.4.3->graphein) (3.2.3)
Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.4.3->graphein) (2.8.2)
Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas->graphein) (2025.2)
Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas->graphein) (2025.2)
Requirement already satisfied: typing_extensions>=4 in /usr/local/lib/python3.11/dist-packages (from rich-click->graphein) (4.13.2)
Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.11/dist-packages (from rich->graphein) (3.0.0)
Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.11/dist-packages (from rich->graphein) (2.18.0)
Collecting orderly-set<6,>=5.3.0 (from deepdiff->graphein)
  Downloading orderly_set-5.4.0-py3-none-any.whl.metadata (6.2 kB)
Collecting wadler-lindig>=0.1.3 (from jaxtyping->graphein)
  Downloading wadler_lindig-0.1.5-py3-none-any.whl.metadata (17 kB)
Requirement already satisfied: tenacity>=6.2.0 in /usr/local/lib/python3.11/dist-packages (from plotly->graphein) (9.1.2)
Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.11/dist-packages (from pydantic->graphein) (0.7.0)
Requirement already satisfied: pydantic-core==2.33.1 in /usr/local/lib/python3.11/dist-packages (from pydantic->graphein) (2.33.1)
Requirement already satisfied: typing-inspection>=0.4.0 in /usr/local/lib/python3.11/dist-packages (from pydantic->graphein) (0.4.0)
Requirement already satisfied: joblib>=1.2.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn->graphein) (1.4.2)
Requirement already satisfied: threadpoolctl>=3.1.0 in /usr/local/lib/python3.11/dist-packages (from scikit-learn->graphein) (3.6.0)
Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.11/dist-packages (from beautifulsoup4<5.0.0,>=4.12.3->bioservices>=1.10.0->graphein) (2.6)
Collecting colorama<0.5.0,>=0.4.6 (from easydev<0.14.0,>=0.13.3->bioservices>=1.10.0->graphein)
  Downloading colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB)
Collecting line-profiler<5.0.0,>=4.1.2 (from easydev<0.14.0,>=0.13.3->bioservices>=1.10.0->graphein)
  Downloading line_profiler-4.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (34 kB)
Requirement already satisfied: pexpect<5.0.0,>=4.9.0 in /usr/local/lib/python3.11/dist-packages (from easydev<0.14.0,>=0.13.3->bioservices>=1.10.0->graphein) (4.9.0)
Requirement already satisfied: platformdirs<5.0.0,>=4.2.0 in /usr/local/lib/python3.11/dist-packages (from easydev<0.14.0,>=0.13.3->bioservices>=1.10.0->graphein) (4.3.7)
Collecting gevent (from grequests<0.8.0,>=0.7.0->bioservices>=1.10.0->graphein)
  Downloading gevent-25.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (13 kB)
Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.11/dist-packages (from markdown-it-py>=2.2.0->rich->graphein) (0.1.2)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.7->matplotlib>=3.4.3->graphein) (1.17.0)
Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests<3.0.0,>=2.32.3->bioservices>=1.10.0->graphein) (3.4.1)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests<3.0.0,>=2.32.3->bioservices>=1.10.0->graphein) (3.10)
Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests<3.0.0,>=2.32.3->bioservices>=1.10.0->graphein) (2.3.0)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests<3.0.0,>=2.32.3->bioservices>=1.10.0->graphein) (2025.1.31)
Requirement already satisfied: attrs>=21.2 in /usr/local/lib/python3.11/dist-packages (from requests-cache<2.0.0,>=1.2.1->bioservices>=1.10.0->graphein) (25.3.0)
Collecting cattrs>=22.2 (from requests-cache<2.0.0,>=1.2.1->bioservices>=1.10.0->graphein)
  Downloading cattrs-24.1.3-py3-none-any.whl.metadata (8.4 kB)
Collecting url-normalize>=1.4 (from requests-cache<2.0.0,>=1.2.1->bioservices>=1.10.0->graphein)
  Downloading url_normalize-2.2.0-py3-none-any.whl.metadata (4.9 kB)
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.11/dist-packages (from pexpect<5.0.0,>=4.9.0->easydev<0.14.0,>=0.13.3->bioservices>=1.10.0->graphein) (0.7.0)
Requirement already satisfied: greenlet>=3.2.0 in /usr/local/lib/python3.11/dist-packages (from gevent->grequests<0.8.0,>=0.7.0->bioservices>=1.10.0->graphein) (3.2.0)
Collecting zope.event (from gevent->grequests<0.8.0,>=0.7.0->bioservices>=1.10.0->graphein)
  Downloading zope.event-5.0-py3-none-any.whl.metadata (4.4 kB)
Collecting zope.interface (from gevent->grequests<0.8.0,>=0.7.0->bioservices>=1.10.0->graphein)
  Downloading zope.interface-7.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (44 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 44.4/44.4 kB 3.3 MB/s eta 0:00:00
Downloading graphein-1.7.7-py3-none-any.whl (316 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 316.0/316.0 kB 20.3 MB/s eta 0:00:00
Downloading biopandas-0.5.1-py3-none-any.whl (68 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 68.3/68.3 kB 5.2 MB/s eta 0:00:00
Downloading looseversion-1.1.2-py3-none-any.whl (8.1 kB)
Downloading mmtf_python-1.1.3-py2.py3-none-any.whl (25 kB)
Downloading bioservices-1.12.1-py3-none-any.whl (258 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 258.0/258.0 kB 18.1 MB/s eta 0:00:00
Downloading numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.3/18.3 MB 34.6 MB/s eta 0:00:00
Downloading rich_click-1.8.8-py3-none-any.whl (35 kB)
Downloading biopython-1.85-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.3/3.3 MB 83.3 MB/s eta 0:00:00
Downloading deepdiff-8.4.2-py3-none-any.whl (87 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 87.6/87.6 kB 6.9 MB/s eta 0:00:00
Downloading jaxtyping-0.3.1-py3-none-any.whl (55 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 55.3/55.3 kB 4.1 MB/s eta 0:00:00
Downloading loguru-0.7.3-py3-none-any.whl (61 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.6/61.6 kB 4.4 MB/s eta 0:00:00
Downloading appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Downloading colorlog-6.9.0-py3-none-any.whl (11 kB)
Downloading easydev-0.13.3-py3-none-any.whl (57 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.0/57.0 kB 4.3 MB/s eta 0:00:00
Downloading grequests-0.7.0-py2.py3-none-any.whl (5.7 kB)
Downloading orderly_set-5.4.0-py3-none-any.whl (12 kB)
Downloading requests_cache-1.2.1-py3-none-any.whl (61 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.4/61.4 kB 4.6 MB/s eta 0:00:00
Downloading suds_community-1.2.0-py3-none-any.whl (145 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 145.3/145.3 kB 9.7 MB/s eta 0:00:00
Downloading wadler_lindig-0.1.5-py3-none-any.whl (20 kB)
Downloading xmltodict-0.14.2-py2.py3-none-any.whl (10.0 kB)
Downloading cattrs-24.1.3-py3-none-any.whl (66 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 66.5/66.5 kB 5.0 MB/s eta 0:00:00
Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB)
Downloading line_profiler-4.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (750 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 750.2/750.2 kB 41.1 MB/s eta 0:00:00
Downloading url_normalize-2.2.0-py3-none-any.whl (14 kB)
Downloading gevent-25.4.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.1 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 72.6 MB/s eta 0:00:00
Downloading zope.event-5.0-py3-none-any.whl (6.8 kB)
Downloading zope.interface-7.2-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (259 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 259.8/259.8 kB 19.0 MB/s eta 0:00:00
Building wheels for collected packages: cpdb-protein, wget
  Building wheel for cpdb-protein (pyproject.toml) ... done
  Created wheel for cpdb-protein: filename=cpdb_protein-0.2.0-cp311-cp311-linux_x86_64.whl size=245145 sha256=7fa9a4cce0b449aff467480b36f30845326704306419e0d3f0b1f4999537cbfd
  Stored in directory: /root/.cache/pip/wheels/9d/0a/be/785478cf0a0939ea190abc78a86ba920af4b262047130b47cc
  Building wheel for wget (setup.py) ... done
  Created wheel for wget: filename=wget-3.2-py3-none-any.whl size=9655 sha256=004a627ab1f04484d7df3648b99f4020dc9d4e97b1d7743d6a1485261256b582
  Stored in directory: /root/.cache/pip/wheels/40/b3/0f/a40dbd1c6861731779f62cc4babcb234387e11d697df70ee97
Successfully built cpdb-protein wget
Installing collected packages: wget, appdirs, zope.interface, zope.event, xmltodict, wadler-lindig, url-normalize, suds-community, orderly-set, numpy, mmtf-python, looseversion, loguru, line-profiler, colorlog, colorama, cattrs, requests-cache, jaxtyping, gevent, easydev, deepdiff, biopython, rich-click, grequests, cpdb-protein, biopandas, bioservices, graphein
  Attempting uninstall: numpy
    Found existing installation: numpy 2.0.2
    Uninstalling numpy-2.0.2:
      Successfully uninstalled numpy-2.0.2
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.
Successfully installed appdirs-1.4.4 biopandas-0.5.1 biopython-1.85 bioservices-1.12.1 cattrs-24.1.3 colorama-0.4.6 colorlog-6.9.0 cpdb-protein-0.2.0 deepdiff-8.4.2 easydev-0.13.3 gevent-25.4.1 graphein-1.7.7 grequests-0.7.0 jaxtyping-0.3.1 line-profiler-4.2.0 loguru-0.7.3 looseversion-1.1.2 mmtf-python-1.1.3 numpy-1.26.4 orderly-set-5.4.0 requests-cache-1.2.1 rich-click-1.8.8 suds-community-1.2.0 url-normalize-2.2.0 wadler-lindig-0.1.5 wget-3.2 xmltodict-0.14.2 zope.event-5.0 zope.interface-7.2

Desktop (please complete the following information):

  • OS: in Colab
  • Python Version: Python 3.11.12
  • Graphein Version [e.g. 22] & how it was installed: graphein-1.7.7 installed using pip in colab

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions