biolink / biolink-model-toolkit

A collection of useful python functions for looking up information and working with the Biolink Model
https://biolink.github.io/biolink-model-toolkit/
BSD 3-Clause "New" or "Revised" License
20 stars 11 forks source link

install bmt in colab #92

Closed raven44099 closed 1 year ago

raven44099 commented 1 year ago

Hi, For my project it is important to run bmt in google colab. I tried to install bmt but was not successful. Is it not possible?

Attempt 1: !pip install bmt

colab output

```py Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Requirement already satisfied: bmt in /usr/local/lib/python3.7/dist-packages/bmt-0.8.12-py3.7.egg (0.8.12) Collecting linkml Using cached linkml-1.3.12-py3-none-any.whl (210 kB) Requirement already satisfied: linkml-runtime in /usr/local/lib/python3.7/dist-packages/linkml_runtime-1.3.6-py3.7.egg (from bmt) (1.3.6) Requirement already satisfied: deprecation>=2.0.6 in /usr/local/lib/python3.7/dist-packages/deprecation-2.1.0-py3.7.egg (from bmt) (2.1.0) Requirement already satisfied: stringcase>=1.0.0 in /usr/local/lib/python3.7/dist-packages/stringcase-1.2.0-py3.7.egg (from bmt) (1.2.0) Requirement already satisfied: pytest in /usr/local/lib/python3.7/dist-packages (from bmt) (3.6.4) Requirement already satisfied: recommonmark in /usr/local/lib/python3.7/dist-packages/recommonmark-0.7.1-py3.7.egg (from bmt) (0.7.1) Requirement already satisfied: sphinx in /usr/local/lib/python3.7/dist-packages (from bmt) (1.8.6) Requirement already satisfied: sphinx-rtd-theme in /usr/local/lib/python3.7/dist-packages/sphinx_rtd_theme-1.1.0-py3.7.egg (from bmt) (1.1.0) Requirement already satisfied: sphinxcontrib-napoleon in /usr/local/lib/python3.7/dist-packages/sphinxcontrib_napoleon-0.7-py3.7.egg (from bmt) (0.7) Requirement already satisfied: tox in /usr/local/lib/python3.7/dist-packages/tox-4.0.0b2-py3.7.egg (from bmt) (4.0.0b2) Requirement already satisfied: flake8 in /usr/local/lib/python3.7/dist-packages/flake8-5.0.4-py3.7.egg (from bmt) (5.0.4) Requirement already satisfied: black<=21.12b0 in /usr/local/lib/python3.7/dist-packages/black-21.12b0-py3.7.egg (from bmt) (21.12b0) Requirement already satisfied: click>=7.1.2 in /usr/local/lib/python3.7/dist-packages (from black<=21.12b0->bmt) (7.1.2) Collecting mypy-extensions>=0.4.3 Using cached mypy_extensions-0.4.3-py2.py3-none-any.whl (4.5 kB) Collecting pathspec<1,>=0.9.0 Using cached pathspec-0.10.1-py3-none-any.whl (27 kB) Collecting platformdirs>=2 Using cached platformdirs-2.5.2-py3-none-any.whl (14 kB) Collecting tomli<2.0.0,>=0.2.6 Using cached tomli-1.2.3-py3-none-any.whl (12 kB) Collecting typed-ast>=1.4.2 Using cached typed_ast-1.5.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (843 kB) Requirement already satisfied: typing-extensions>=3.10.0.0 in /usr/local/lib/python3.7/dist-packages (from black<=21.12b0->bmt) (4.1.1) Requirement already satisfied: packaging in /usr/local/lib/python3.7/dist-packages (from deprecation>=2.0.6->bmt) (21.3) Collecting importlib-metadata<4.3,>=1.1.0 Using cached importlib_metadata-4.2.0-py3-none-any.whl (16 kB) Collecting mccabe<0.8.0,>=0.7.0 Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB) Collecting pycodestyle<2.10.0,>=2.9.0 Using cached pycodestyle-2.9.1-py2.py3-none-any.whl (41 kB) Collecting pyflakes<2.6.0,>=2.5.0 Using cached pyflakes-2.5.0-py2.py3-none-any.whl (66 kB) Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata<4.3,>=1.1.0->flake8->bmt) (3.10.0) Collecting pyshexc>=0.8.3 Using cached PyShExC-0.9.1-py2.py3-none-any.whl (69 kB) Requirement already satisfied: graphviz>=0.10.1 in /usr/local/lib/python3.7/dist-packages (from linkml->bmt) (0.10.1) Collecting jsonasobj2<2.0.0,>=1.0.3 Using cached jsonasobj2-1.0.4-py3-none-any.whl (6.3 kB) Requirement already satisfied: pyyaml in /usr/local/lib/python3.7/dist-packages (from linkml->bmt) (6.0) Requirement already satisfied: openpyxl in /usr/local/lib/python3.7/dist-packages (from linkml->bmt) (3.0.10) Collecting prefixcommons>=0.1.7 Using cached prefixcommons-0.1.12-py3-none-any.whl (29 kB) Collecting isodate>=0.6.0 Using cached isodate-0.6.1-py2.py3-none-any.whl (41 kB) Collecting jinja2>=3.1.0 Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB) Collecting rdflib>=6.0.0 Using cached rdflib-6.2.0-py3-none-any.whl (500 kB) Collecting myst-parser Using cached myst_parser-0.18.1-py3-none-any.whl (58 kB) Collecting sphinx-click Using cached sphinx_click-4.3.0-py3-none-any.whl (8.9 kB) Collecting tox Using cached tox-3.27.0-py2.py3-none-any.whl (86 kB) Collecting watchdog>=0.9.0 Using cached watchdog-2.1.9-py3-none-manylinux2014_x86_64.whl (78 kB) Requirement already satisfied: python-dateutil in /usr/local/lib/python3.7/dist-packages (from linkml->bmt) (2.8.2) Requirement already satisfied: sqlalchemy>=1.4.31 in /usr/local/lib/python3.7/dist-packages (from linkml->bmt) (1.4.42) Collecting prefixmaps<0.2.0,>=0.1.3 Using cached prefixmaps-0.1.4-py3-none-any.whl (205 kB) Requirement already satisfied: jsonschema[format]>=4.0.0 in /usr/local/lib/python3.7/dist-packages (from linkml->bmt) (4.3.3) Collecting pyshex>=0.7.20 Using cached PyShEx-0.8.1-py3-none-any.whl (51 kB) Collecting linkml-dataops Using cached linkml_dataops-0.1.0-py3-none-any.whl (27 kB) Collecting hbreader Using cached hbreader-0.9.1-py3-none-any.whl (7.6 kB) Collecting parse Using cached parse-1.19.0.tar.gz (30 kB) Requirement already satisfied: requests>=2.22 in /usr/local/lib/python3.7/dist-packages (from linkml->bmt) (2.23.0) Collecting antlr4-python3-runtime<4.10,>=4.9.0 Using cached antlr4-python3-runtime-4.9.3.tar.gz (117 kB) Collecting pyjsg>=0.11.6 Using cached PyJSG-0.11.10-py3-none-any.whl (80 kB) Requirement already satisfied: pydantic in /usr/local/lib/python3.7/dist-packages (from linkml->bmt) (1.10.2) Requirement already satisfied: six in /usr/local/lib/python3.7/dist-packages (from isodate>=0.6.0->linkml->bmt) (1.15.0) Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.7/dist-packages (from jinja2>=3.1.0->linkml->bmt) (2.0.1) Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema[format]>=4.0.0->linkml->bmt) (22.1.0) Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema[format]>=4.0.0->linkml->bmt) (0.18.1) Requirement already satisfied: importlib-resources>=1.4.0 in /usr/local/lib/python3.7/dist-packages (from jsonschema[format]>=4.0.0->linkml->bmt) (5.10.0) Collecting uri-template Using cached uri_template-1.2.0-py3-none-any.whl (10 kB) Collecting fqdn Using cached fqdn-1.5.1-py3-none-any.whl (9.1 kB) Collecting webcolors>=1.11 Using cached webcolors-1.12-py3-none-any.whl (9.9 kB) Requirement already satisfied: idna in /usr/local/lib/python3.7/dist-packages (from jsonschema[format]>=4.0.0->linkml->bmt) (2.10) Collecting isoduration Using cached isoduration-20.11.0-py3-none-any.whl (11 kB) Collecting jsonpointer>1.13 Using cached jsonpointer-2.3-py2.py3-none-any.whl (7.8 kB) Collecting rfc3987 Using cached rfc3987-1.3.8-py2.py3-none-any.whl (13 kB) Collecting rfc3339-validator Using cached rfc3339_validator-0.1.4-py2.py3-none-any.whl (3.5 kB) Collecting deprecated Using cached Deprecated-1.2.13-py2.py3-none-any.whl (9.6 kB) Collecting json-flattener>=0.1.9 Using cached json_flattener-0.1.9-py3-none-any.whl (10 kB) Collecting click>=7.1.2 Using cached click-8.1.3-py3-none-any.whl (96 kB) Collecting pytest-logging<2016.0.0,>=2015.11.4 Using cached pytest-logging-2015.11.4.tar.gz (3.9 kB) Collecting requests>=2.22 Using cached requests-2.28.1-py3-none-any.whl (62 kB) Collecting prefixmaps<0.2.0,>=0.1.3 Using cached prefixmaps-0.1.3-py3-none-any.whl (205 kB) INFO: pip is looking at multiple versions of click to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of prefixcommons to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of markupsafe to determine which version is compatible with other requirements. This could take a while. Collecting MarkupSafe>=2.0 Using cached MarkupSafe-2.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB) Using cached MarkupSafe-2.1.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB) Using cached MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (31 kB) Using cached MarkupSafe-2.0.0-cp37-cp37m-manylinux2010_x86_64.whl (31 kB) INFO: pip is looking at multiple versions of json-flattener to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of linkml-runtime to determine which version is compatible with other requirements. This could take a while. Collecting linkml-runtime Using cached linkml_runtime-1.3.6-py3-none-any.whl (324 kB) INFO: pip is looking at multiple versions of click to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of prefixcommons to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of markupsafe to determine which version is compatible with other requirements. This could take a while. Using cached linkml_runtime-1.3.5-py3-none-any.whl (324 kB) INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking Using cached linkml_runtime-1.3.4-py3-none-any.whl (324 kB) Using cached linkml_runtime-1.3.3-py3-none-any.whl (323 kB) Using cached linkml_runtime-1.3.2-py3-none-any.whl (321 kB) Collecting prefixcommons>=0.1.7 Using cached prefixcommons-0.1.11-py3-none-any.whl (18 kB) Collecting linkml-runtime Using cached linkml_runtime-1.3.1-py3-none-any.whl (320 kB) Using cached linkml_runtime-1.3.0-py3-none-any.whl (320 kB) INFO: pip is looking at multiple versions of json-flattener to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of linkml-runtime to determine which version is compatible with other requirements. This could take a while. INFO: pip is looking at multiple versions of jsonpointer to determine which version is compatible with other requirements. This could take a while. Collecting jsonpointer>1.13 Using cached jsonpointer-2.2-py2.py3-none-any.whl (7.5 kB) INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking Using cached jsonpointer-2.1-py2.py3-none-any.whl (7.4 kB) Using cached jsonpointer-2.0-py2.py3-none-any.whl (7.6 kB) Using cached jsonpointer-1.14-py2.py3-none-any.whl (7.4 kB) INFO: pip is looking at multiple versions of importlib-resources to determine which version is compatible with other requirements. This could take a while. Collecting importlib-resources>=1.4.0 Using cached importlib_resources-5.10.0-py3-none-any.whl (34 kB) INFO: pip is looking at multiple versions of jsonpointer to determine which version is compatible with other requirements. This could take a while. Using cached importlib_resources-5.9.0-py3-none-any.whl (33 kB) INFO: This is taking longer than usual. You might need to provide the dependency resolver with stricter constraints to reduce runtime. If you want to abort this run, you can press Ctrl + C to do so. To improve how pip performs, tell us what happened here: https://pip.pypa.io/surveys/backtracking Using cached importlib_resources-5.8.1-py3-none-any.whl (32 kB) Downloading importlib_resources-5.8.0-py3-none-any.whl (28 kB) Downloading importlib_resources-5.7.1-py3-none-any.whl (28 kB) Downloading importlib_resources-5.7.0-py3-none-any.whl (28 kB) Downloading importlib_resources-5.6.0-py3-none-any.whl (28 kB) INFO: pip is looking at multiple versions of importlib-resources to determine which version is compatible with other requirements. This could take a while. Downloading importlib_resources-5.4.0-py3-none-any.whl (28 kB) Downloading importlib_resources-5.3.0-py3-none-any.whl (28 kB) Downloading importlib_resources-5.2.3-py3-none-any.whl (27 kB) Downloading importlib_resources-5.2.2-py3-none-any.whl (27 kB) ERROR: Operation cancelled by user ```

Attempt 2:

# clone the repo
!git clone https://github.com/biolink/biolink-model-toolkit

# cd into the folder
%cd biolink-model-toolkit

# install
!python setup.py install

But this cell ended with: error: The 'linkml' distribution was not found and is required by bmt. When I run !pip install linkml, I get errors like in attempt 1, so I hoped you could resolve attempt 1.

Update!

Quick fix, use https://github.com/biolink/kgx Interestingly from bmt import Toolkit works after running:

!git clone https://github.com/biolink/kgx
%cd kgx
!pip3 install -r requirements.txt
sierra-moxon commented 1 year ago

@raven44099 - while debugging another issue in this repo, I was able to install bmt in colab with:

!pip install bmt

and then able to initialize and call methods in bmt like this:

from bmt import Toolkit
BMT = Toolkit("https://raw.githubusercontent.com/biolink/biolink-model/v3.1.2/biolink-model.yaml")
# get_all_types()
types = BMT.get_all_types()
sierra-moxon commented 1 year ago

closing for now, please of course reopen if still an issue. :)