SMC Sampler "name 'HTML' is not defined" Error

Hello!

I’m trying to replicate the code in the Marginal Likelihood/Bayes Factor page, located here:

Bayes Factors and Marginal Likelihoods

All of the previous code blocks run fine but when I run the code block for the sampler, I obtain the following error:

RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\multiprocessing\pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\site-packages\pymc\smc\sampling.py", line 423, in _apply_args_and_kwargs
    return fn(*args, **kwargs)
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\site-packages\pymc\smc\sampling.py", line 345, in _sample_smc_int
    progressbar.update_bar(getattr(progressbar, "offset", 0) + 0)
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\site-packages\fastprogress\fastprogress.py", line 81, in update_bar
    self.on_update(val, f'{pct}[{val}/{tot} {elapsed_t}{self.lt}{remaining_t}{end}]')
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\site-packages\fastprogress\fastprogress.py", line 133, in on_update
    if self.display: self.out.update(HTML(self.progress))
NameError: name 'HTML' is not defined


Traceback (most recent call last):
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\multiprocessing\pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\site-packages\pymc\smc\sampling.py", line 423, in _apply_args_and_kwargs
    return fn(*args, **kwargs)
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\site-packages\pymc\smc\sampling.py", line 345, in _sample_smc_int
    progressbar.update_bar(getattr(progressbar, "offset", 0) + 0)
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\site-packages\fastprogress\fastprogress.py", line 81, in update_bar
    self.on_update(val, f'{pct}[{val}/{tot} {elapsed_t}{self.lt}{remaining_t}{end}]')
  File "c:\Users\drlac\anaconda3\envs\intuitive_bayes\lib\site-packages\fastprogress\fastprogress.py", line 133, in on_update
    if self.display: self.out.update(HTML(self.progress))
NameError: name 'HTML' is not defined

I’m at a loss to understand the error and was wondering if anyone could help. I’m using PyMC 5.0.2 on a Windows machine using VS Code as the IDE for the Jupyter Notebook.

Any help that can be provided to diagnose this problem would be greatly appreciated.

I think I may have found a potential bug. If I set the boolean value for the progress bar to “False”, the sampler runs just fine:

idata = pm.sample_smc(random_seed=42,progressbar=False)

It appears that the HTML error is related to the progress bar for the SMC sampler.

Can anyone recreate this issue?
Thanks again for any help.

1 Like

Please see this issue for more information.

Thanks for the reply as I was not aware of the issue.