Skip to content

ipywidgets in the enviornment on vscode jupyter notebook cause cell with pymc.sample to hang with default sampler #7615

@danieltomasz

Description

@danieltomasz

Describe the issue:

in the environments without ipywidgets the inference taking 1 second
When the ipywidgets is installed the cell with pymc code hangs on

Initializing NUTS using jitter+adapt_diag...
Multiprocess sampling (4 chains in 4 jobs)
NUTS: [θ]

I tested install both via conda and pip, the inference via bambi and other samplers worked fine in the same env,
the example below I tested in clean envs with

matplotlib
numpy
pandas
pymc
preliz
ipykernel
arviz

installed (and with or without ipywidgets)

Reproduceable code example:

import numpy as np
import pandas as pd
import pymc as pm
import preliz as pz
np.random.seed(123)
trials = 4
theta_real = 0.35 # unknown value in a real experiment
data = pz.Binomial(n=1, p=theta_real).rvs(trials)
data

with pm.Model() as our_first_model:
    θ = pm.Beta('θ', alpha=1., beta=1.)
    y = pm.Bernoulli('y', p=θ, observed=data)
    idata = pm.sample(1000, random_seed=4591)

Error message:

No response

PyMC version information:

Python 3.12.8, Pymc 5.19.1

Context for the issue:

Version: 1.96.0
Commit: 138f619c86f1199955d53b4166bef66ef252935c
Date: 2024-12-11T02:29:09.626Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions