How to use python 3.9.12 kernel and up

Hello!
I was wondering how i can get datalore to run python 3.9 or 3.10 in pip mode or conda mode? y have tried everythong but i dont seem to get this working. And this could be a deal breaker if icant get my code to work. the minimn i requere is 3.9.12 please help

There is no place that i know of to choose the python kernel version.I can only see that i am running in python 3.8.12

Thank you in advance

1 Like

Seconded

Same issue. I’ve spent hours debugging my problem loading custom packages from GitHub, only to finally realize the problem is that the packages are using language features from laster versions of Python, specifically – the match statement

It would seem the thing to do is modify the environment.yml file. I’ve tried variations like:

datalore-env-format-version: "0.2"
datalore-package-manager: "pip"
datalore-base-env: "default"
dependencies:
  - python: "3.11.1"

and

datalore-env-format-version: "0.2"
datalore-package-manager: "pip"
datalore-base-env: "default"
dependencies:
  - python=3.11

Also tried installing via the init.sh using:

sudo apt update && sudo apt install -y python3.11 python3-pip

Nothing works

1 Like

Hi @Chris_Brinkman

For pip-based environment it’s not enough to install the required python version, it’s also needed to build the venv based on it:

init.sh

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

environment.yml

datalore-env-format-version: "0.2"
datalore-package-manager: "pip"
datalore-base-env: "my311"
dependencies:
2 Likes

Thank you so much, I will give it a try! Is there a documentation page that discusses this?

I tried implementing the environment.yml and init.sh, as shown by @artem.borzilov, however received the following errors:

E: Unable to locate package python3.11-venv
E: Couldn’t find any package by glob 'python3.11-venv

E: Couldn’t find any package by regex 'python3.11-venv

/data/notebook_files/init.sh: 2: /usr/bin/python3.11: not found
/data/notebook_files/init.sh: 3: /opt/python/envs/my311/bin/python: not found

Any help on solving this issue would be greatly appreciated.

@marcus, hmm, it works for me:

Could you try again in a new notebook?

Hey @igro, thanks for the response!
Unfortunately I got the same error message.

Steps I took:

  • New notebook: didn’t change any settings (Python, jupyter mode, environment pip)
  • edited the file ‘/data/notebook_files/environment.yml’ to the following:

datalore-env-format-version: “0.2”
datalore-package-manager: “pip”
datalore-base-env: “my311”
dependencies:

  • created a new file, ‘/data/notebook_files/init.sh’, in the same folder as environment.yml. Then edited the file to the following text:

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

  • Run > Stop machine
  • Run > Start machine

I then received the following error in my screen:
image

And the following error file appeared:

E: Unable to locate package python3.11-venv
E: Couldn’t find any package by glob 'python3.11-venv

E: Couldn’t find any package by regex 'python3.11-venv

/data/notebook_files/init.sh: 2: /usr/bin/python3.11: not found
/data/notebook_files/init.sh: 3: /opt/python/envs/my311/bin/python: not found

Is there anything I did incorrectly? Any tips on how to procede?
Kind regards.

FWIW, it did work for me. Thanks.

1 Like

Did you make any other changes besides modifying the environment.yml and init.sh files?

Created a new Datalore account, repeated the process I described above, got the same error.

Below, I try different init.sh configurations, and show the error messages they give:

Attempt 1:

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

Error message 1:

E: Unable to locate package python3.11-venv
E: Couldn't find any package by glob 'python3.11-venv
   '
E: Couldn't find any package by regex 'python3.11-venv
   '
/data/notebook_files/init.sh: 2: /usr/bin/python3.11: not found
/data/notebook_files/init.sh: 3: /opt/python/envs/my311/bin/python: not found

Attempt 2:

sudo apt-get update && sudo apt-get install -y python3.11 python3.11-venv

Error message 2:

debconf: delaying package configuration, since apt-utils is not installed

Attempt 3:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update && sudo apt-get install -y python3.11 python3.11-venv

Error message 3:

debconf: delaying package configuration, since apt-utils is not installed

Attempt 4:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update && sudo apt-get install -y python3.11 python3.11-venv
/usr/bin/python3.11 -m venv /opt/python/envs/my311

Error message 4:

E: Unable to locate package python3.11-venv
E: Couldn't find any package by glob 'python3.11-venv
   '
E: Couldn't find any package by regex 'python3.11-venv
   '
/data/notebook_files/init.sh: 3: /usr/bin/python3.11: not found

Sharing this to help with the identification of the issue.

No changes, and let me copy/paste the contents for you for my 3.11 setup that works perfectly…

environment.yml:

datalore-env-format-version: "0.2"
datalore-package-manager: "pip"
datalore-base-env: "my311"
dependencies:

init.sh:

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

Thanks for your response @Chris_Brinkman!

I recorded my attempt to run the code, in which I got the same error:

@igro, did you do something different when tried to run the code?

1 Like

Hi @marcus,

Could you please try to clone this notebook to your workspace and check if it works?

1 Like

To follow up on Artem’s post:

I also getting this warning in the error log (attached to the notebook files), but it shouldn’t affect the installation of the package.

E: Couldn’t find any package by glob 'python3.11-venv

It seems, there are non-unix line ending characters in your init.sh file, please try creating init.sh using the following magics (will overwrite existing file):

!echo "sudo apt-get update && sudo apt-get install -y python3.11 python3.11-venv" > init.sh
!echo "/usr/bin/python3.11 -m venv /opt/python/envs/my311" >> init.sh
!echo "/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" >> init.sh
1 Like

Bless your heart @artem.borzilov! It finally worked!

For other people reading this in the future, and having the same issue, here’s what I did:

  • downloaded the init.sh file from the notebook of @artem.borzilov’s
  • uploaded it in my notebook

As for the cause of the problem, you are correct @igro, there is indeed an extra byte that shows up when I copy and paste the file, as can be seem bellow:

Thanks to everyone who helped me fix this!!
:pray::pray::pray::pray::pray::pray::pray::pray::heart:

2 Likes

Glad the issue is now resolved!

there is indeed an extra byte that shows up when I copy and paste the file

Thank you for confirming this, I didn’t manage to reproduce it on my Windows VM, but I’ll file a ticket in our tracker and we will investigate this issue further.

Happy coding!

2 Likes

I just had this issue and resolved with this thread. One thing should be noted, use Run → Stop Machine vs Kernel → Restart kernel after getting the environment.yml and init.sh files correct. Not sure that the difference is.

I did update to 3.11 just as in this thread (which matched my greater project) and noticed the python version as ‘3.11.0rc1 (main, Aug 12 2022, 10:02:14) [GCC 11.2.0]’. Is there a way to update to a newer version of python 3.11?

Hi @Dean,

One thing should be noted, use Run → Stop Machine vs Kernel → Restart kernel after getting the environment.yml and init.sh files correct. Not sure that the difference is.

“Restart kernel” will restart kernel (reset state) on the running agent
“Stop machine” (+ “Start machine”) will re-create the computational agent completely

I did update to 3.11 just as in this thread (which matched my greater project) and noticed the python version as ‘3.11.0rc1 (main, Aug 12 2022, 10:02:14) [GCC 11.2.0]’. Is there a way to update to a newer version of python 3.11?

It seems, it is the only version in the default apt ppa:

$ apt search ^python3.11$
Sorting... Done
Full Text Search... Done
python3.11/jammy-updates,now 3.11.0~rc1-1~22.04 amd64 [installed]
  Interactive high-level object-oriented language (version 3.11)

From what I see, it is usually recommended to add a third party ppa containing most recent builds.

Alternatively you can also build a specific required version from the sources.