Labo-Lacourse / stepmix

A Python package following the scikit-learn API for model-based clustering and generalized mixture modeling (latent class/profile analysis) of continuous and categorical data. StepMix handles missing values through Full Information Maximum Likelihood (FIML) and provides multiple stepwise Expectation-Maximization (EM) estimation methods.
https://stepmix.readthedocs.io/en/latest/index.html
MIT License
59 stars 4 forks source link

Uninstalled optional dependency in computational examples #28

Closed sachaMorin closed 1 year ago

sachaMorin commented 1 year ago

When running the simulations in scripts with a fresh install, this happens

Traceback (most recent call last):
  File "run_bakk_simulation.py", line 170, in <module>
    main(n_simulations=args.n_simulations, latex=args.latex, covariate=args.covariate)
  File "run_bakk_simulation.py", line 141, in main
    print(df.to_latex(multirow=True, multicolumn=True))
  File "/home/sacha/Documents/temp/stepmix/venv/lib/python3.8/site-packages/pandas/core/generic.py", line 3459, in to_latex
    return self._to_latex_via_styler(
  File "/home/sacha/Documents/temp/stepmix/venv/lib/python3.8/site-packages/pandas/core/generic.py", line 3515, in _to_latex_via_styler
    from pandas.io.formats.style import Styler
  File "/home/sacha/Documents/temp/stepmix/venv/lib/python3.8/site-packages/pandas/io/formats/style.py", line 56, in <module>
    jinja2 = import_optional_dependency("jinja2", extra="DataFrame.style requires jinja2.")
  File "/home/sacha/Documents/temp/stepmix/venv/lib/python3.8/site-packages/pandas/compat/_optional.py", line 145, in import_optional_dependency
    raise ImportError(msg)
ImportError: Missing optional dependency 'Jinja2'. DataFrame.style requires jinja2. Use pip or conda to install Jinja2.

I suggest we simply remove the latex flag from the README commands and state in argparse help to install Jinja2 if they want the (optional) latex output.