pgmpy: ImportError in v0.1.10
Subject of the issue
ImportError in pgmpy 0.1.10
Your environment
- 0.1.10
- Python 3.7.4
- Mac OS
Steps to reproduce
➜ ~ mkvirtualenv test-pgmpy-0.10.1
Using base prefix '/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7'
New python executable in /Users/lienmichiels/.virtualenvs/test-pgmpy-0.10.1/bin/python3.7
Also creating executable in /Users/lienmichiels/.virtualenvs/test-pgmpy-0.10.1/bin/python
Installing setuptools, pip, wheel...
done.
virtualenvwrapper.user_scripts creating /Users/lienmichiels/.virtualenvs/test-pgmpy-0.10.1/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/lienmichiels/.virtualenvs/test-pgmpy-0.10.1/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/lienmichiels/.virtualenvs/test-pgmpy-0.10.1/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/lienmichiels/.virtualenvs/test-pgmpy-0.10.1/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/lienmichiels/.virtualenvs/test-pgmpy-0.10.1/bin/get_env_details
(test-pgmpy-0.10.1) ➜ ~ pip install pgmpy
Collecting pgmpy
Using cached pgmpy-0.1.10-py3-none-any.whl (339 kB)
Collecting networkx
Using cached networkx-2.4-py3-none-any.whl (1.6 MB)
Collecting pandas
Downloading pandas-1.0.1-cp37-cp37m-macosx_10_9_x86_64.whl (9.8 MB)
|████████████████████████████████| 9.8 MB 551 kB/s
Collecting numpy
Using cached numpy-1.18.1-cp37-cp37m-macosx_10_9_x86_64.whl (15.1 MB)
Collecting joblib
Using cached joblib-0.14.1-py2.py3-none-any.whl (294 kB)
Collecting statsmodels
Using cached statsmodels-0.11.0-cp37-cp37m-macosx_10_9_x86_64.whl (8.4 MB)
Collecting scipy
Using cached scipy-1.4.1-cp37-cp37m-macosx_10_6_intel.whl (28.4 MB)
Collecting torch
Using cached torch-1.4.0-cp37-none-macosx_10_9_x86_64.whl (81.1 MB)
Collecting tqdm
Using cached tqdm-4.42.1-py2.py3-none-any.whl (59 kB)
Collecting pyparsing
Using cached pyparsing-2.4.6-py2.py3-none-any.whl (67 kB)
Collecting decorator>=4.3.0
Using cached decorator-4.4.1-py2.py3-none-any.whl (9.2 kB)
Collecting pytz>=2017.2
Using cached pytz-2019.3-py2.py3-none-any.whl (509 kB)
Collecting python-dateutil>=2.6.1
Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting patsy>=0.5
Using cached patsy-0.5.1-py2.py3-none-any.whl (231 kB)
Collecting six>=1.5
Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: decorator, networkx, numpy, pytz, six, python-dateutil, pandas, joblib, scipy, patsy, statsmodels, torch, tqdm, pyparsing, pgmpy
Successfully installed decorator-4.4.1 joblib-0.14.1 networkx-2.4 numpy-1.18.1 pandas-1.0.1 patsy-0.5.1 pgmpy-0.1.10 pyparsing-2.4.6 python-dateutil-2.8.1 pytz-2019.3 scipy-1.4.1 six-1.14.0 statsmodels-0.11.0 torch-1.4.0 tqdm-4.42.1
(test-pgmpy-0.10.1) ➜ ~ ipython
/usr/local/lib/python3.7/site-packages/IPython/core/interactiveshell.py:925: UserWarning: Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.
warn("Attempting to work in a virtualenv. If you encounter problems, please "
Python 3.7.4 (default, Sep 7 2019, 18:27:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.5.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import pgmpy.estimators
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-199e78196b94> in <module>
----> 1 import pgmpy.estimators
~/.virtualenvs/test-pgmpy-0.10.1/lib/python3.7/site-packages/pgmpy/estimators/__init__.py in <module>
4 from pgmpy.estimators.StructureScore import StructureScore
5 from pgmpy.estimators.K2Score import K2Score
----> 6 from pgmpy.estimators.BDeuScore import BDeuScore
7 from pgmpy.estimators.BicScore import BicScore
8 from pgmpy.estimators.ExhaustiveSearch import ExhaustiveSearch
ImportError: cannot import name 'BDeuScore' from 'pgmpy.estimators.BDeuScore' (/Users/lienmichiels/.virtualenvs/test-pgmpy-0.10.1/lib/python3.7/site-packages/pgmpy/estimators/BDeuScore.py)
Expected behaviour
Import should succeed.
Actual behaviour
Import fails.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (5 by maintainers)
Commits related to this issue
- Change the name of Bdeu to BDeu in docs [ref #1228, #1229] — committed to ankurankan/pgmpy by ankurankan 4 years ago
Hmm, this is very weird. It might be because of some caching on pypi or travis. But @LienM @CrapsJeroen thanks a lot for reporting this, I will try to get it fixed in next deployment.
No reference Bdeu anymore in the current codebase, was probably a release error. Should be fixed in the next release.
FWIW: I can confirm I face the same issue with v0.1.10 when trying to
from pgmpy.estimators import HillClimbSearch, BicScore. After downgrading to v0.1.9 I didn’t get the problem.