ColabGeek is designed to help run useful tools on Google Colab, including web IDE, port forwarding and so on. It is worth noting that this package is also compatible with other Ubuntu operating system based servers, so try this package on other platforms as well.
Version: 1.4.1
Platform: Ubuntu 22.04 LTS
Update: 2024/11/20
pip install ColabGeek
First import ColabGeek and update all the packages and dependencies in the system (Please run under root privilege).
import ColabGeek
ColabGeek.update_environment()
Initialize the Colab session by adding a new user (or changing the password for the existing user) and mounting Google Drive.
main = ColabGeek.ColabSession(user = "knight",password = "midnight",mount_GD = True)
As a cloud computing platform based on Jupyter notebook, Google Colab does not provide a top-notch user-friendly environment for R language data mining and other non-Python programming. Therefore, this project aims to provide methods for quickly installing other web IDEs on Google Colab, enabling it to expand its range of capabilities.
code server is a web IDE provided by Coder that enables developers to write, run and debug code from a web browser. It is built on the open-source Visual Studio Code editor and offers many of the same features, such as code highlighting, auto completion, and debugging.
# ColabSession.Run_code_server has the following parameters:
# - port Listening port for code server, set to None to use the default port.
# - password The code server login password, set to None to use the ColabSession user password.
# - verbose Whether to show the running logs.
main.Run_code_server()
You can also install code server extension by providing extension id or the path of the VSIX file downloaded from VSCode marketplace.
# ColabSession.Install_code_server_extension has the following parameters:
# - extension The extension id or the path of the VSIX file.
# - verbose Whether to show the running logs.
main.Install_code_server_extension(extension = "ms-python.anaconda-extension-pack")
You can also configure code server through ColabSession.Config_code_server
method.
# ColabSession.Config_code_server has the following parameters:
# - property Specify the property to be added or updated in the settings.json file.
# - value Specify the value for the corresponding property, can be of any type that is supported by JSON.
main.Config_code_server(property = "workbench.colorTheme",value = "Default Dark+")
main.Config_code_server(property = "editor.fontSize",value = 18)
main.Config_code_server(property = "terminal.integrated.fontSize",value = 18)
main.Config_code_server(property = "files.autoSave",value = "off")
Rstudio server is a web IDE for R programming. With Rstudio server, users can run R scripts, create and manage R projects, develop and test code, and share their work with others. Rstudio server also offers powerful features such as syntax highlighting, code completion, debugging and data visualization.
# ColabSession.Run_Rstudio_server has the following parameters:
# - port Listening port for Rstudio server, set to None to use the default port.
# - verbose Whether to show the running logs.
main.Run_Rstudio_server()
JupyterLab is a flexible and extensible web IDE designed to support the entire workflow in data science, scientific computing, and machine learning projects. ColabGeek pulls the mrdoge/jupyterlab docker image from Docker Hub and executes using udocker. Notice that it is not recommended to run udocker and JupyterLab under ColabSession user root.
# ColabSession.Run_JupyterLab has the following parameters:
# - port Listening port for JupyterLab, set to None to use the default port.
# - password The JupyterLab login password, set to None to use the ColabSession user password.
# - mount_Colab Whether to map the Colab /content directory to the JupyterLab container /content directory.
# - verbose Whether to show the running logs.
main.Run_JupyterLab()
Google Colab does not allow any internet connections to their host servers except the official web interface. Therefore, a tunnelling method is required to access services installed on Colab.
# ColabSession.Run_localtunnel has the following parameters:
# - port Listening port for localtunnel, set to None to use the default port.
# - host Upstream host server providing forwarding.
# - subdomain Request this subdomain. Do not include the "_" in the subdomain.
# - verbose Whether to show the running logs.
main.Run_localtunnel()
# ColabSession.Run_ngrok has the following parameters:
# - token The token of your personal ngrok account.
# - port Listening port for ngrok, set to None to use the default port.
# - domain Request this domain.
# - verbose Whether to show the running logs.
main.Run_ngrok(token = "replace with your own ngrok token!")
# ColabSession.Run_Cloudflare_Tunnel has the following parameters:
# - token The token of your tunnel created on Cloudflare.
# - verbose Whether to show the running logs.
main.Run_Cloudflare_Tunnel(token = "replace with your own tunnel token!")
Although not allowed by Google and not recommended by myself, building a proxy server using Colab sounds pretty "Geek". However, this function only helps to install and run shadowsocks on Colab, and I have no clue how to connect to the shadowsocks server. Just use this method on your own Ubuntu servers, that should work. If you have any good ideas, leave an issue please!
# ColabSession.Run_shadowsocks has the following parameters:
# - port Listening port for shadowsocks server, set to None to use the default port.
# - password The shadowsocks server password, set to None to use the ColabSession user password.
# - encrypt The encryption method for shadowsocks server.
# - verbose Whether to show the running logs.
main.Run_shadowsocks()
Jekyll is a simple, blog-aware, static site generator that allows users to create their own websites or blogs without the need for databases or server-side programming languages. It takes text written in Markdown, processes it through a template engine, and generates a ready-to-publish static website. ColabGeek provides a method to automatically install Jekyll and all of its dependencies. Users can easily access their Jekyll websites using tunnelling methods also provided by ColabGeek.
# ColabSession.Install_Jekyll has the following parameters:
# - Ruby_version The version number of Ruby to install.
# - verbose Whether to show the running logs.
main.Install_Jekyll(Ruby_version = "3.3.5",verbose = True)
Stable Diffusion is a deep learning, text-to-image model released in 2022 based on diffusion techniques. It is primarily used to generate detailed images conditioned on text descriptions, though it can also be applied to other tasks such as inpainting, outpainting, and generating image-to-image translations guided by a text prompt. Stable Diffusion WebUI is a browser interface for Stable Diffusion that allows to create beautiful art much more easily. Stable Diffusion WebUI can be easily installed through ColabGeek and conveniently accessed by the tunnelling methods also provided by ColabGeek.
# ColabSession.Run_Stable_Diffusion_WebUI has the following parameters:
# - path The directory to install Stable Diffusion WebUI. The default path is located in the home of the ColabSession user.
# - port Listening port for Stable Diffusion WebUI, set to None to use the default port.
# - verbose Whether to show the running logs.
# - args Additional arguments to pass to the Stable Diffusion WebUI setup script.
# - **kwargs Additional arguments to pass to the Stable Diffusion WebUI setup script. Cannot be used in conjunction with the args parameter.
main.Run_Stable_Diffusion_WebUI()
# Use tunnelling method built in Stable Diffusion WebUI:
# main.Run_Stable_Diffusion_WebUI(args = "--share --gradio-auth username:password")
# main.Run_Stable_Diffusion_WebUI(share = "")
ColabGeek has violated numerous community rules of Google Colab. Therefore, users should consider carefully before using ColabGeek, as the author assumes no responsibility for any potential risks. All ColabGeek users are encouraged to consider subscribing Colab Pro or Pro+ to support the excellent services provided by Google. Keep in mind, avoid misuse and Don't Be Evil.