I’ve been trying to use google colab to run a file from a code base stored in my google drive. In order to run this file, I need a slew of packages to be installed, a few of which are not already installed by default in google colab sessions. Since there’s a lot of specific versions I need, I would like to be able to use something akin to a virtual environment where I have my own versions of all the packages I need. Since google colab sessions have temporary file storage, I’ve been trying to use google drive as a location to download the packages and then access them from each colab session, but I’ve been having issues with this.
I’ve been using this guide (https://www.youtube.com/watch?v=N6J4weYZ9lU&ab_channel=AdrianDolinay) and have done the exact same process but with different packages and using ln -s to create a symbolic link instead of os.symlink(), but I’ve been having some issues. It seems like I can download the packages to my google drive correctly, but when I try to access them from a new google colab session, it doesn’t seem to work. In particular, libpysal was correctly downloaded in the colab session where I downloaded all the packages, but it can’t be imported from a new google colab session. I have confirmed that my symbolic link works by using ls -l and also by using it to directly access that folder I’ve linked to.
As a separate question, all of the guides I’ve looked at accomplish this google drive package installation by mounting google drive into the colab session and then creating a symbolic link from a folder in the session to a google drive folder where you can download or access previously downloaded packages. But I don’t understand why symbolic links are used here–Why can’t I just directly add a google drive folder to my path after I mount google drive in each google colab session? Or if there’s not a definitive reason, is there some advantage of using a symbolic link here?
Daniel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.