DanielBok / copulae

Multivariate data modelling with Copulas in Python
https://copulae.readthedocs.io/en/latest/
MIT License
141 stars 26 forks source link

ModuleNotFoundError: No module named 'copulae.special._specfunc' #47

Closed RichardPlat closed 3 years ago

RichardPlat commented 3 years ago

When using 'from copulae import GaussianCopula' I get this warning:

ModuleNotFoundError: No module named 'copulae.special._specfunc'

Anyone knows how to solve this?

DanielBok commented 3 years ago

How can I reproduce this?

Do you use conda? Which python version? Which package version? Do you want have a minimum code snippet to repro?

Chrismarsh commented 1 year ago

@DanielBok I get this too if I install copulae from source. copulae 0.7.7, python 3.8.10, macos + linux

$ git clone https://github.com/DanielBok/copulae.git
$ cd copulae
$ pip install -r build-requirements.txt
$ pip install .
$ python -c "import copulae"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/__init__.py", line 1, in <module>
    from copulae.archimedean import *
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/archimedean/__init__.py", line 1, in <module>
    from .clayton import ClaytonCopula
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/archimedean/clayton.py", line 4, in <module>
    from copulae.copula import Summary, TailDep
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/copula/__init__.py", line 1, in <module>
    from .base import *
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/copula/base.py", line 8, in <module>
    from copulae.copula.estimator import EstimationMethod, fit_copula
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/copula/estimator/__init__.py", line 1, in <module>
    from .estimator import fit_copula, EstimationMethod
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/copula/estimator/estimator.py", line 8, in <module>
    from copulae.stats import pearson_rho
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/stats/__init__.py", line 3, in <module>
    from .stable.stable import skew_stable
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/stats/stable/stable.py", line 7, in <module>
    from copulae.special.trig import tanpi2
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/special/__init__.py", line 2, in <module>
    from .special_func import *
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/special/special_func.py", line 7, in <module>
    from copulae.special.dilog import dilog, dilog_complex
  File "/Users/cmarsh/Documents/science/code/copulae/copulae/special/dilog.py", line 3, in <module>
    from ._specfunc import dilog as _dilog, dilog_complex as _dilog_complex
ModuleNotFoundError: No module named 'copulae.special._specfunc'

If, instead, I do

$ python setup.py bdist_wheel
$ cd dist
$ pip install copulae-0.7.7-cp310-cp310-macosx_12_0_arm64.whl
$ python -c "import copulae"

it then works as expected. It's not clear to me why the bdist_wheel step is needed, as pip indicates it is building a wheel