Reputation: 23
I'm using Google Colab for a project that only runs in Python 2 (I'm replicating an older work). However I wanted to reset the runtime and suddenly it wasn't connecting anymore (runtime kept trying to connect but got disconnected). This bug would happen often and what I'd usually do to fix it is change the runtime Python version to 3 and then back to 2. However this time when I changed to Python3 and accessed the runtime settings options to change back to 2 there was no option on the UI to change back to Python 2. Did Google decide exactly now that they're getting rid of Python2 on colabs for good? If that's the case is there anyway to manually set it back to Python2 again? Thank you in advance.
Upvotes: 2
Views: 3492
Reputation: 637
The Python development team reported that Python 2 is no longer supported as of January 1, 2020. Colab has stopped updating Python 2 runtimes and will gradually no longer support Python 2 notebooks. We suggest that you migrate your important notebooks to Python 3.
To change the notebook runtime from Python 2 to Python 3, select Runtime> Change Runtime Type and choose Python 3. It is no longer possible to change the runtime from Python 3 to Python 2. For information on how to migrate code from Python 2 to Python 3, see Python 2 to Python 3 Code Portability.
From colab page explaining that
Upvotes: 0
Reputation: 40888
You can create a new Python 2.7 notebook with this link.
https://colab.research.google.com/notebook#create=true&language=python2
Then copy your old code to it, paste, and run.
Another method is to download your ipynb file, open it in a text editor, edit the runtime to python2. Then upload it back to try and run it.
Upvotes: 3