From 79c52b79347b3f0c8a8a2153fb1a1f2e6c8f131e Mon Sep 17 00:00:00 2001 From: Ben Webb Date: Thu, 14 Sep 2023 09:49:14 -0700 Subject: [PATCH] Try to future-proof Python path Google updated their colab environment again, to Ubuntu 22.04. Rather than changing our hard-coded Python path again to match, try to detect the correct location at runtime. --- rnapolii/modeling/.template.deposition.ipynb | 4 ++-- rnapolii/modeling/deposition-colab.ipynb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rnapolii/modeling/.template.deposition.ipynb b/rnapolii/modeling/.template.deposition.ipynb index f923873..9288547 100644 --- a/rnapolii/modeling/.template.deposition.ipynb +++ b/rnapolii/modeling/.template.deposition.ipynb @@ -116,8 +116,8 @@ "!wget -O /etc/apt/trusted.gpg.d/salilab.asc https://salilab.org/~ben/pubkey256.asc\n", "!apt update\n", "!apt install imp\n", - "import sys\n", - "sys.path.append('/usr/lib/python3.8/dist-packages')" + "import sys, os, glob\n", + "sys.path.append(os.path.dirname(glob.glob('/usr/lib/python*/dist-packages/IMP')[0]))" ] }, { diff --git a/rnapolii/modeling/deposition-colab.ipynb b/rnapolii/modeling/deposition-colab.ipynb index bc7c83c..8686e6c 100644 --- a/rnapolii/modeling/deposition-colab.ipynb +++ b/rnapolii/modeling/deposition-colab.ipynb @@ -123,8 +123,8 @@ "!wget -O /etc/apt/trusted.gpg.d/salilab.asc https://salilab.org/~ben/pubkey256.asc\n", "!apt update\n", "!apt install imp\n", - "import sys\n", - "sys.path.append('/usr/lib/python3.8/dist-packages')" + "import sys, os, glob\n", + "sys.path.append(os.path.dirname(glob.glob('/usr/lib/python*/dist-packages/IMP')[0]))" ] }, {