I am trying to use the joeymt lbrary in Google Colab, which I installed in Google Drive, so that I don't have to install each time I work on the project. There is a solution described here: How do I install a library permanently in Colab?, which I follow along, but in the last step, when I try to run the training program, I get an error.
This is what I've tried:
I am mounting drive and inserting the path like described in the mentioned post like this:
import os, sys
from google.colab import drive
#drive.mount('/content/drive')
nb_path = '/content/drive/MyDrive/another_location'
if nb_path not in sys.path:
sys.path.insert(1,nb_path)
sys.path then looks like this:
['',
'/content/drive/MyDrive/another_location',
'/content',
'/env/python',
'/usr/lib/python37.zip',
'/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/usr/local/lib/python3.7/dist-packages',
'/usr/lib/python3/dist-packages',
'/usr/local/lib/python3.7/dist-packages/IPython/extensions',
'/root/.ipython']
I then installed joeynmt from source using ! git clone https://github.com/joeynmt/joeynmt.git and then ! git checkout 4b73db1) with no error at the location in drive.
%cd joeynmt
!pip3 install --target=$nb_path .
In the Google Drive folder are now joeynmt and all its installed dependencies.
Now when I try to run train:
import joeynmt
!python -m joeynmt train /path_to_yaml_config_file
it throws the error
/usr/bin/python3: No module named joeynmt
Normally, if I'd just install joeynmt with cd joeynmt pip3 install . joeynmt would get installed into /usr/local/lib/python3.7/dist-packages/joeynmt and the command above would work just fine and start the training routine.
If I run 'joeynmt' in sys.modules I get True, so what am I missing? I somehow think the path I inserted into the sys.path list is getting ignored? Or why does it say No module named joeynmt?