Skip to content

NameError: name 'HTML' is not defined #5855

Closed
@fbarfi

Description

@fbarfi

Description of your problem

Running the example: SMC-ABC_Lotka-Volterra_example. exactly as is. Getting the error down below. Thanks!

with pm.Model() as example:
    a = pm.Normal("a", mu=0, sigma=5)
    b = pm.HalfNormal("b", sigma=1)
    s = pm.Simulator("s", normal_sim, params=(a, b), sum_stat="sort", epsilon=1, observed=data)

    idata = pm.sample_smc()
    idata.extend(pm.sample_posterior_predictive(idata))

Please provide the full traceback.

Complete error traceback
RemoteTraceback                           Traceback (most recent call last)
RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/multiprocessing/pool.py", line 51, in starmapstar
    return list(itertools.starmap(args[0], args[1]))
  File "/opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/site-packages/pymc/smc/sample_smc.py", line 439, in _apply_args_and_kwargs
    return fn(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/site-packages/pymc/smc/sample_smc.py", line 361, in _sample_smc_int
    progressbar.update_bar(getattr(progressbar, "offset", 0) + 0)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/site-packages/fastprogress/fastprogress.py", line 76, in update_bar
    else: self.on_update(val, f'{100 * val/self.total:.2f}% [{val}/{self.total} {elapsed_t}<{remaining_t}{end}]')
  File "/opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/site-packages/fastprogress/fastprogress.py", line 127, in on_update
    if self.display: self.out.update(HTML(self.progress))
NameError: name 'HTML' is not defined
"""

The above exception was the direct cause of the following exception:

NameError                                 Traceback (most recent call last)
Input In [5], in <cell line: 1>()
      3 b = pm.HalfNormal("b", sigma=1)
      4 s = pm.Simulator("s", normal_sim, params=(a, b), sum_stat="sort", epsilon=1, observed=data)
----> 6 idata = pm.sample_smc()
      7 idata.extend(pm.sample_posterior_predictive(idata))

File /opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/site-packages/pymc/smc/sample_smc.py:227, in sample_smc(draws, kernel, start, model, random_seed, chains, cores, compute_convergence_checks, return_inferencedata, idata_kwargs, progressbar, **kernel_kwargs)
    224 t1 = time.time()
    226 if cores > 1:
--> 227     results = run_chains_parallel(
    228         chains, progressbar, _sample_smc_int, params, random_seed, kernel_kwargs, cores
    229     )
    230 else:
    231     results = run_chains_sequential(
    232         chains, progressbar, _sample_smc_int, params, random_seed, kernel_kwargs
    233     )

File /opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/site-packages/pymc/smc/sample_smc.py:408, in run_chains_parallel(chains, progressbar, to_run, params, random_seed, kernel_kwargs, cores)
    406 params = tuple(cloudpickle.dumps(p) for p in params)
    407 kernel_kwargs = {key: cloudpickle.dumps(value) for key, value in kernel_kwargs.items()}
--> 408 results = _starmap_with_kwargs(
    409     pool,
    410     to_run,
    411     [(*params, random_seed[chain], chain, pbars[chain]) for chain in range(chains)],
    412     repeat(kernel_kwargs),
    413 )
    414 results = tuple(cloudpickle.loads(r) for r in results)
    415 pool.close()

File /opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/site-packages/pymc/smc/sample_smc.py:435, in _starmap_with_kwargs(pool, fn, args_iter, kwargs_iter)
    431 def _starmap_with_kwargs(pool, fn, args_iter, kwargs_iter):
    432     # Helper function to allow kwargs with Pool.starmap
    433     # Copied from https://stackoverflow.com/a/53173433/13311693
    434     args_for_starmap = zip(repeat(fn), args_iter, kwargs_iter)
--> 435     return pool.starmap(_apply_args_and_kwargs, args_for_starmap)

File /opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/multiprocessing/pool.py:372, in Pool.starmap(self, func, iterable, chunksize)
    366 def starmap(self, func, iterable, chunksize=None):
    367     '''
    368     Like `map()` method but the elements of the `iterable` are expected to
    369     be iterables as well and will be unpacked as arguments. Hence
    370     `func` and (a, b) becomes func(a, b).
    371     '''
--> 372     return self._map_async(func, iterable, starmapstar, chunksize).get()

File /opt/homebrew/Caskroom/miniforge/base/envs/pymc_4/lib/python3.10/multiprocessing/pool.py:771, in ApplyResult.get(self, timeout)
    769     return self._value
    770 else:
--> 771     raise self._value

NameError: name 'HTML' is not defined

Please provide any additional information below.

Versions and main components

Python implementation: CPython
Python version : 3.10.4
IPython version : 8.4.0

Compiler : Clang 12.0.1
OS : Darwin
Release : 21.5.0
Machine : arm64
Processor : arm
CPU cores : 10
Architecture: 64bit

arviz : 0.12.1
matplotlib: 3.5.2
numpy : 1.22.4
pymc : 4.0.0b6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions