Skip to main content

Upgrade AI Workbench notebooks to Python 3.13

AI Workbench supports two Python versions: Python 3.11 and Python 3.13. Your existing notebooks keep running on Python 3.11, and new notebooks start on Python 3.13. You upgrade each existing notebook to Python 3.13 when you are ready.

Python 3.11 is temporary. The Python project ends security fixes for Python 3.11 in October 2027, and BlueConic removes Python 3.11 from AI Workbench in a release planned for June 2027. Upgrade your notebooks before then. This article explains what changes, how to check if a notebook needs changes, which package versions to use, and how to upgrade a notebook.


Before you begin

  • Your user role needs the Notebook Editor permission in AI Workbench.

  • Your tenant must run release R106 or later. The option to upgrade a notebook is not available before R106.

  • Plan time to test. Newer package versions can change the results of your code. Test each notebook with your own data before you rely on it.


What changes in R106

Item

Before R106

From R106

Python versions

3.11

3.11 and 3.13

A notebook that you created earlier

Runs on 3.11

Runs on 3.11. Nothing changes

A new notebook (blank or from a template)

Runs on 3.11

Runs on 3.13

A copy of a notebook

Runs on 3.11

Runs on the same Python version as the notebook that you copied

Scheduled runs

Run on 3.11

Run on the Python version that the notebook stores

Switch a notebook to Python 3.13

Not possible

Possible in the editor, for each notebook. The switch goes one way

Package versions that you install in a notebook

Your own %pip install line decides

Your own %pip install line decides. Old versions can fail to install on Python 3.13

Notebook templates in the plugin gallery

Old package versions

New versions that work on Python 3.11 and 3.13. They apply to new notebooks only, and these start on Python 3.13

Standard library on Python 3.13

Not applicable

Python 3.12 and 3.13 removed some modules, for example distutils, imghdr, cgi, and telnetlib

Note: A notebook that you created earlier keeps its own install line. A new plugin version does not change it.

The Python 3.11 environment keeps its current package versions. BlueConic updates a package there only for a security fix. In R106 this applies to urllib3, oauthlib, tornado, aiohttp, and orjson. If your notebook uses one of them directly, test it after R106.

Other changes for a notebook on Python 3.13:

  • The packages six and decorator are no longer installed by default. Add them to your install line if you import them.

  • python-dateutil moves to a new major version (4.0) in the default environment.

  • The default environment has newer versions of Jupyter packages. This does not change how notebooks run.


Check if a notebook needs changes

A notebook on Python 3.11 needs no change today. Run this check before you upgrade a notebook. A notebook with no problem needs no change.

Open the notebook in edit mode. Find the cell that starts with %pip install or !pip install, and check each line against these rules:

  1. A package has a version with == (for example numpy==1.26.4). Check it against the tables in Choose package versions for Python 3.13.

  2. A package has no version (for example %pip install pandas). The newest version installs, and it can differ between Python 3.11 and Python 3.13, because some new versions need Python 3.12 or higher. Pin the version, so your notebook gives the same result on every run.

  3. The notebook imports a module that Python 3.12 or 3.13 removed. See Python modules removed in Python 3.12 and 3.13.

  4. The install line uses the package name sklearn. That name is a dead package. Use scikit-learn.

  5. A package or version is not in the tables of this article. Open the page of the package on PyPI and go to Download files. Look for a file for your version with cp313 in its name, or one that ends in py3-none-any.whl. Without such a file, pip builds the package from source, which is slow and can fail. You can also run pip install --dry-run --only-binary=:all: <package>==<version> in a Python 3.13 environment.

  6. The notebook installs blueconic with pip install. There is no package with this name on PyPI, and AI Workbench already includes its own blueconic package. Remove the line.

What happens when an old version cannot install on Python 3.13:

  • In a scheduled run, the platform runs the pip install lines first. If one fails, the run goes on. The notebook then fails at the first import of the missing package, or it uses an older version that was already installed.

  • Some old versions still install, because Python builds them from source. This is slow and can take several minutes for each package, for example about two minutes for numpy 1.26.4 and about five minutes for scikit-learn 1.5.1.

  • The build fails when it needs a tool or library that AI Workbench does not have. AI Workbench has a C++ compiler, but no cmake, Fortran compiler, BLAS library, Apache Arrow library, or leveldb library. Old pandas, pyarrow, and scipy versions, and plyvel, fail for this reason.


Choose package versions for Python 3.13

Tested package set

BlueConic ran its own template notebooks with this set on Python 3.11 and Python 3.13, using sample data. The set installs from ready-made wheels on both versions.

Package

Version

numpy

2.4.6

scipy

1.17.1

pandas

2.3.3

matplotlib

3.11.2

scikit-learn

1.9.1

seaborn

0.13.2

pyarrow

26.0.1

lifelines

0.30.3

lifetimes

0.11.3

ipytest

0.14.2

pymc

5.28.5 (also pin pytensor==2.38.2 and arviz==0.23.4)

pytz

2026.6

Example:

%pip install -q numpy==2.4.6 pandas==2.3.3 matplotlib==3.11.2 scipy==1.17.1 scikit-learn==1.9.1
  • These are newer major or minor versions than the old ones, and they can change the result of your code. See Changes in newer package versions.

  • numpy and scipy are not the newest versions. The newest versions need Python 3.12 or higher.

  • These versions also work on Python 3.11. Test them in a copy that still runs on Python 3.11, then switch the copy to Python 3.13.

Replacements for common old versions

Use this table when you cannot use the tested set. The third column gives the nearest higher version with ready-made wheels for both Python 3.13 and Python 3.11, so you can test it on Python 3.11 first. BlueConic checked these versions against the package index. It did not run every version against customer code.

Old version

On Python 3.13

Version for Python 3.13 (also works on 3.11)

Notes

numpy 1.20.x to 1.26.x (for example 1.20.3, 1.21.5, 1.22.x, 1.23.5, 1.24.x, 1.26.4)

Builds slowly from source, or fails

2.1.0 or higher (2.4.6 is the newest for Python 3.11)

1.20.x and 1.21.x have no ready-made file for Python 3.11 either. NumPy 2 removed old aliases (np.float_, np.NaN, np.Inf, np.product, np.row_stack)

pandas 2.0.x, 2.1.x, 2.2.0, 2.2.2

Build from source fails

2.2.3 or 2.3.3

applymap is now map. fillna(method=...) is deprecated

pandas 1.3.x, 1.4.x, 1.5.x

No

2.2.3 or 2.3.3

1.3.x has no ready-made file for Python 3.11 either. pandas 2 removed DataFrame.append, iteritems, Int64Index, and read_csv(error_bad_lines=...)

matplotlib 3.5.x, 3.7.x, 3.8.x

Builds slowly from source, or fails

3.9.2 or higher (3.11.2 tested)

Removed in 3.9: cm.get_cmap, cm.register_cmap. Removed in 3.10: tostring_rgb

scipy 1.7.x, 1.8.x

No (needs Python below 3.11)

1.14.1 or higher (1.17.1 tested)

Does not install on Python 3.11 either. Removed in 1.14: integrate.simps, integrate.trapz, interp2d

scipy 1.10.x, 1.12.x, 1.13.x

No (1.10.x needs Python below 3.12)

1.14.1 or higher (1.17.1 tested)

Same removals as above

onnxruntime 1.10 to 1.19 (for example ~=1.19.2, ==1.15.0, ==1.17.1)

No Python 3.13 file

1.20.0 or higher

1.20.0 is the first version with files for both Python 3.11 and 3.13. Test your model after the change

scikit-learn 0.24.x, 1.0.x, 1.1.x, 1.2.x, 1.3.x, 1.4.x, 1.5.1

No, or slow build

1.5.2 or higher (1.9.1 tested)

0.24.x has no ready-made file for Python 3.11 either. Removed: load_boston, get_feature_names, plot_confusion_matrix. A model saved with an old version might not load

pyarrow 10.x, 15.x, 17.0.0

Build from source fails

18.0.0 or higher (26.0.1 tested)

lifelines 0.28.x, 0.29.x

No (needs numpy below 2)

0.30.3

arviz 0.17.x, 0.18.x

No (needs numpy below 2)

0.19.0 or higher (0.23.4 tested)

pymc 5.12, pytensor 2.22.x

No

5.28.5 with pytensor==2.38.2

Test your model. pytensor 2.22.x needs Python below 3.13

pymc3

No

Move to pymc 5

The model syntax is different

onnx 1.10.x with onnx-simplifier 0.3.6 or 0.4.x, skl2onnx 1.10.x, protobuf 3.20.1

No

onnx 1.18.0 or higher, onnxsim in place of onnx-simplifier, skl2onnx 1.17 or higher

Update these packages together. BlueConic has not tested this combination

onnx 1.16.x (for example onnx~=1.16.2)

No Python 3.13 file

1.18.0 or higher

Use it with onnxruntime 1.20.0 or higher. Test your model after the change

onnxoptimizer 0.2.6

No Python 3.13 file

0.4.2 or higher

Not tested by BlueConic

boto3 1.20.x

Import fails (old botocore uses a removed module)

1.34.0 or higher

shapely 1.8.x, 2.0.0 to 2.0.5

No (2.0.4 installs on Python 3.11, but not on 3.13)

2.0.6 or higher

Shapely 2 geometries cannot change after creation

shap 0.44.x

No Python 3.13 file

0.48.0 or higher

Not tested by BlueConic

ijson 3.3.0

No Python 3.13 file

3.4.0 or higher

pgpy 0.5.4, 0.6.0

Install works, but import pgpy fails

No version fixes it

See the PGPy example under Python modules removed in Python 3.12 and 3.13

blueconic==1.0.0 (or any pip install blueconic line)

No package with this name on PyPI. The install fails on Python 3.11 and 3.13

Remove the line

AI Workbench already includes its own blueconic package. In a scheduled run, a failed install gives a warning only, and the run goes on

metaphone 0.6, pysftp 0.2.9, lightfm 1.17

PyPI has source files only. Pip builds them on every Python version

Not tested

Run your notebook on Python 3.13 to test it. A build of lightfm needs a C compiler

langchain 0.1.0, pymc-marketing 0.10.0, jupyter-contrib-nbextensions 0.5.1

No set of packages resolves on Python 3.13

Not tested

Update these packages to current releases, together with their related packages

sklearn (package name)

Dead package

scikit-learn

tdigest

No

No version works

The package needs a dependency without a wheel. Use a different method

plyvel

No. The build fails, because AI Workbench has no leveldb library

No version works

Use a different way to store the data

stringdist, scikit-multiflow

No (scikit-multiflow also fails on Python 3.11)

No version tested

paramiko 2.11.0 or 3.5.1, cryptography 37.x, ipytest, pytz, confluent-kafka 2.6.0, seaborn 0.13.1

Yes

Keep

These install on both versions. Old versions can be out of support. Update them if your security rules require it


Python modules removed in Python 3.12 and 3.13

Python 3.12 and 3.13 removed these standard library modules: distutils, imp, asyncore, asynchat, smtpd, cgi, cgitb, imghdr, pipes, telnetlib, crypt, nntplib, sndhdr, sunau, uu, xdrlib, aifc, audioop, chunk, mailcap, msilib, nis, ossaudiodev, spwd, and lib2to3.

A notebook uses one of them in one of two ways:

  • Your code imports the module. Replace it with another approach.

  • A package that you install imports the module. The package then fails at import on Python 3.13.

Example: PGPy

PGPy versions 0.5.4 and 0.6.0 use imghdr. The install works, but import pgpy fails on Python 3.13. Add the package standard-imghdr to fix it:

%pip install -q PGPy==0.5.4 "standard-imghdr; python_version >= '3.13'"

Test your notebook after this change.

Example: lifetimes

The package lifetimes needs pkg_resources, which comes from setuptools. Version 82 and higher of setuptools no longer include it. If you use lifetimes, pin setuptools below version 82.


Changes in newer package versions

Read the release notes of every package that you update. These changes come up most often:

  • NumPy 2. Removed aliases. Different type rules for scalars. np.core moved. Rebuild compiled packages that you built against NumPy 1.

  • pandas 2 and 3. Removed methods (see the replacement table). A new default string type and copy-on-write in pandas 3. Without a pin, a notebook can get pandas 3 on a new run, so pin the version.

  • matplotlib 3.9 and 3.10. Removed functions (see the replacement table). Style names that start with seaborn- changed in 3.6.

  • scikit-learn. Models saved with an old version might not load with a new version. Save a new copy.


Upgrade a notebook to Python 3.13

Important: The switch to Python 3.13 goes one way. A notebook on Python 3.13 cannot go back to Python 3.11. Always upgrade a copy, and keep the original until the copy works.

A notebook that you created earlier runs on Python 3.11. In edit mode, the toolbar shows an amber Edit mode (Python 3.11) label with an arrow. A scheduled run uses the same Python version as the notebook.

  1. Copy the notebook. The copy runs on Python 3.11, like the original. Do all the work below in the copy. The original stays on Python 3.11 and keeps working until you replace it.

  2. Edit the install cell of the copy. Use the versions from the tested set or the replacement table, and pin every package with ==. To test the new versions first, run the copy on Python 3.11 before you continue.

  3. Click the kernel name in the toolbar of the copy (Edit mode (Python 3.11)). The Select Kernel window opens.

  4. Choose Edit mode (Python 3.13) from the dropdown, and click Select. The kernel restarts on Python 3.13. The toolbar now shows Edit mode (Python 3.13) in plain text, without the amber color and arrow.

  5. Run all cells from the top. Watch for warnings and errors. Compare the result with the original on the same data.

  6. Save the copy. The copy keeps Python 3.13, and its scheduled runs use Python 3.13.

  7. Run the copy as a scheduled run. Scheduled runs install the packages into a fresh environment. Use a test run and check the run history for warnings. Set the schedule and other settings to match the original.

  8. Replace the original when the results match. Delete the original notebook, and give the copy the name of the original.

If the copy fails on Python 3.13, fix the install cell and the code. If you cannot fix it, delete the copy. The original still runs on Python 3.11.


Notebooks from the plugin gallery

With R106, BlueConic updates all notebook templates. New notebooks that you create from a template (for example A/B testing, CLV, Churn, Look-alike, or Next best action) get the new package versions and run on Python 3.13. The plugin update does not change a notebook that you already created. That notebook stays on Python 3.11.


Next steps

  • Test your scheduled notebooks first. A failed install in a scheduled run gives only a warning. The run then fails later, at the import of the package, and the error does not name the install that failed. Check the run history for the install warning.

  • Learn how BlueConic installs packages in scheduled runs in Update Python packages.

  • Read more about the BlueConic package in Use the BlueConic Python Package in AI Workbench.


FAQ

Do I need to change my notebooks now?

  • No. Existing notebooks keep running on Python 3.11. Upgrade them before the release that removes Python 3.11, planned for June 2027.

What happens to a notebook that is still on Python 3.11 when BlueConic removes Python 3.11?

  • It runs on Python 3.13. It might fail if it uses old package versions.

Can I switch a notebook back to Python 3.11?

  • No. The switch goes one way. Upgrade a copy first, and keep the original until the copy works.

Which Python version does a scheduled run use?

  • The version that the notebook stores. A notebook on Python 3.11 runs on Python 3.11, and a notebook on Python 3.13 runs on Python 3.13.

Does the plugin update change the template notebooks I already use?

  • No. The update applies to new notebooks only. Notebooks that you created earlier keep their install lines and stay on Python 3.11.

Where do I find the error from a failed install?

Who do I contact for help?

  • Contact BlueConic Support. Include the name of the notebook, the tenant, and the text of the error. BlueConic Support cannot edit your notebooks, but can help you understand errors and how to fix them.

Did this answer your question?