Commit 8b36691f authored by Vaclav Hanzl's avatar Vaclav Hanzl
Browse files

Improve notebook: Automate tracking of the python version in Colab

parent feb99932
......@@ -97,6 +97,7 @@
"#@markdown **Note**: This installs the software on the Colab \n",
"#@markdown notebook in the cloud and not on your computer.\n",
"\n",
"import sys\n",
"from IPython.utils import io\n",
"import os\n",
"import subprocess\n",
......@@ -104,6 +105,8 @@
"\n",
"TQDM_BAR_FORMAT = '{l_bar}{bar}| {n_fmt}/{total_fmt} [elapsed: {elapsed} remaining: {remaining}]'\n",
"\n",
"python_version = '.'.join(sys.version.split('.')[:2]) # get string like \"3.9\"\n",
"\n",
"try:\n",
" with io.capture_output() as captured:\n",
" %shell sudo apt install --quiet --yes hmmer\n",
......@@ -125,7 +128,7 @@
" %shell conda install -y -q -c conda-forge -c bioconda \\\n",
" kalign2=2.04 \\\n",
" hhsuite=3.3.0 \\\n",
" python=3.9 \\\n",
" python={python_version} \\\n",
" 2>&1 1>/dev/null\n",
" %shell pip install -q \\\n",
" ml-collections==0.1.0 \\\n",
......@@ -184,7 +187,7 @@
"\n",
" %shell conda install -y -q -c conda-forge openmm=7.5.1\n",
" # Apply OpenMM patch.\n",
" %shell pushd /opt/conda/lib/python3.9/site-packages/ && \\\n",
" %shell pushd /opt/conda/lib/python{python_version}/site-packages/ && \\\n",
" patch -p0 < /content/openfold/lib/openmm.patch && \\\n",
" popd\n",
" %shell conda install -y -q -c conda-forge pdbfixer=1.7\n",
......@@ -221,8 +224,8 @@
"import unittest.mock\n",
"import sys\n",
"\n",
"sys.path.insert(0, '/usr/local/lib/python3.9/site-packages/')\n",
"sys.path.append('/opt/conda/lib/python3.9/site-packages')\n",
"sys.path.insert(0, f'/usr/local/lib/python{python_version}/site-packages/')\n",
"sys.path.append(f'/opt/conda/lib/python{python_version}/site-packages')\n",
"\n",
"# Allows us to skip installing these packages\n",
"unnecessary_modules = [\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment