Switch Python versions
The procedures below explain how to switch Python versions by adding your custom environment in pip- and conda-based environments.
Switch Python versions in conda-based environment
Open the notebook where you want to customize your environment.
Open the Attached data tool from the left-hand sidebar.
Click Notebook files to expand the list and open environment.yml.
Edit the environment.yml file as shown in the examples below:
datalore-env-format-version: "0.2" datalore-package-manager: "conda" datalore-base-env: "py39" dependencies:Create a new environment to specify the required Python version:
Under Notebook files, click the New file icon.
In the new file, add the content as shown in the example below.
channels: - conda-forge - defaults dependencies: - python=3.9.10 - pyyaml - protobuf - python-logstash - wrapt - ipykernel - ipython_genutils - jupyter_client - jedi
Build a new virtual environment based on your custom environment file:
Open the Environment tool from the left-hand sidebar.
Click the Edit init.sh to install additional dependencies link.
Add a command to build the virtual environment.
/opt/anaconda3/bin/conda env create --name py39 --file py39env.yml
Switch Python versions in pip-based environment
Open the notebook where you want to customize your environment.
Open the Attached data tool from the left-hand sidebar.
Click Notebook files to expand the list and open environment.yml.
Edit the environment.yml file as shown in the examples below:
datalore-env-format-version: "0.2" datalore-package-manager: "pip" datalore-base-env: "my311" dependencies:Build a new virtual environment based on your custom environment file:
Open the Environment tool from the left-hand sidebar.
Click the Edit init.sh to install additional dependencies link.
Add a command to build the virtual environment.
sudo apt-get update && sudo apt-get install -y python3.11 python3.11-venv /usr/bin/python3.11 -m venv /opt/python/envs/my311 /opt/python/envs/my311/bin/python -m pip install ipykernel==5.5.3 ipython==7.31.1 ipython_genutils==0.2.0 jedi==0.17.2 lets-plot==3.0.0 aiohttp==3.8.3 pandas==1.5.3