ColtAllen / btyd

Buy Till You Die and Customer Lifetime Value statistical models in Python.
https://btyd.readthedocs.io/
Apache License 2.0
114 stars 9 forks source link

btyd library is dependent on lifetimes but doesn't install it. #42

Closed s-pike closed 2 years ago

s-pike commented 2 years ago

I installed btyd using pip install btyd.

It installed with no errors. However, it won't import as I haven't installed the lifetimes library in that environment. I think the references need to be changed in modified_beta_geo_fitter.py

Error message:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Input In [1], in <cell line: 4>()
      2 import pandas as pd
      3 import numpy as np
----> 4 import btyd

File /libraries/CLTV/lib/python3.9/site-packages/btyd/__init__.py:6, in <module>
      4 from .fitters.beta_geo_fitter import BetaGeoFitter
      5 from .fitters.beta_geo_beta_binom_fitter import BetaGeoBetaBinomFitter
----> 6 from .fitters.modified_beta_geo_fitter import ModifiedBetaGeoFitter
      7 from .fitters.pareto_nbd_fitter import ParetoNBDFitter
      8 from .fitters.gamma_gamma_fitter import GammaGammaFitter

File /libraries/CLTV/lib/python3.9/site-packages/btyd/fitters/modified_beta_geo_fitter.py:11, in <module>
      8 from autograd.scipy.special import gammaln, beta, gamma
      9 from scipy.special import hyp2f1
---> 11 from lifetimes import BetaGeoFitter
     12 from lifetimes.generate_data import modified_beta_geometric_nbd_model
     15 class ModifiedBetaGeoFitter(BetaGeoFitter):

ModuleNotFoundError: No module named 'lifetimes'

Version: btyd==0.1a1

ColtAllen commented 2 years ago

Hey @s-pike, thanks for bringing this to my attention. I think this is also causing issues with the doc builds, so I'll roll it into the current PR I'm working on for the documentation. I'll also look at the CI/CD scripts, because they should have caught this.

ColtAllen commented 2 years ago

This issue was fixed in https://github.com/ColtAllen/btyd/pull/43 and will be included in the Beta release.