lopatovsky / HMMs

Continuous-time Hidden Markov Model
Creative Commons Zero v1.0 Universal
100 stars 49 forks source link

ImportError: No module named 'hmms.dthmm' #12

Open fanzipei opened 5 years ago

fanzipei commented 5 years ago

After I successfully install by pip install hmms, I got an error when import hmms.

`--------------------------------------------------------------------------- ImportError Traceback (most recent call last)

in () 1 import numpy as np 2 import matplotlib.pyplot as plt ----> 3 import hmms 4 5 get_ipython().run_line_magic('matplotlib', 'inline') ~/work/HMMs/hmms/__init__.py in () ----> 1 from .dthmm import * 2 from .cthmm import * 3 from .hmm import * 4 from .art import * 5 from .train import * ImportError: No module named 'hmms.dthmm'`
denklewer commented 4 years ago

reinstall using github. I've downgraded the cython to 0.25.2 and reinstalled using github. this helped me. pip install cython==0.25.2 python -m pip install git+https://github.com/lopatovsky/HMMs

kroegern1 commented 3 years ago

This didn't work for me @denklewer , I installed python 3.6 and tried it since cython had issues with recent python versions

denklewer commented 3 years ago

@kroegern1
Try this :

  1. conda create -n hmms_env python=3.8
  2. conda activate hmms_env
  3. pip install numpy cython

After that run

  1. python setup.py develop in a source directory
kroegern1 commented 3 years ago

Thanks, I did that and I was able to run > python, and then import hmms. The issue is trying to import hmms in the provided jupyter notebook. image

denklewer commented 3 years ago

Looks like your Jupyter is from the base environment. Check if you installed it in the same env. For this library the problem is always the order of installation of numpy and cython Second option: Did you find any errors during build (setup.py develop)?

kroegern1 commented 3 years ago

I ran the commands you had above and while in the "hmms_env" I ran

conda install -c conda-forge jupyterlab

then ran

jupyter notebook

and my kernel being used is python 3.8. The hmms_env is not visible in the kernel list in jupyter notebook if that's what you're saying to do.

(No issue during build of setup.py develop!)

denklewer commented 3 years ago

I'm out of ideas. Here is a list of packages for working env (3.8 + cython + numpy + install over github + jupyterlab over conda) May be we can compare package versions

anyio 3.3.0 argon2-cffi 20.1.0 async-generator 1.10 attrs 21.2.0 Babel 2.9.1 backcall 0.2.0 backports.functools-lru-cache 1.6.4 bleach 4.0.0 brotlipy 0.7.0 certifi 2021.5.30 cffi 1.14.6 chardet 4.0.0 charset-normalizer 2.0.0 colorama 0.4.4 cryptography 3.4.7 cycler 0.10.0 Cython 0.29.24 debugpy 1.4.1 decorator 5.0.9 defusedxml 0.7.1 entrypoints 0.3 hmms 0.1 idna 3.1 importlib-metadata 4.6.3 ipykernel 6.1.0 ipython 7.26.0 ipython-genutils 0.2.0 jedi 0.18.0 Jinja2 3.0.1 json5 0.9.5 jsonschema 3.2.0 jupyter-client 6.1.12 jupyter-core 4.7.1 jupyter-server 1.10.2 jupyterlab 3.1.6 jupyterlab-pygments 0.1.2 jupyterlab-server 2.7.0 kiwisolver 1.3.1 MarkupSafe 2.0.1 matplotlib 3.4.3 matplotlib-inline 0.1.2 mistune 0.8.4 nbclassic 0.3.1 nbclient 0.5.3 nbconvert 6.1.0 nbformat 5.1.3 nest-asyncio 1.5.1 notebook 6.4.3 numpy 1.21.1 packaging 21.0 pandas 1.3.1 pandocfilters 1.4.2 parso 0.8.2 pickleshare 0.7.5 Pillow 8.3.1 pip 21.2.4 prometheus-client 0.11.0 prompt-toolkit 3.0.19 pycparser 2.20 Pygments 2.9.0 pyOpenSSL 20.0.1 pyparsing 2.4.7 pyrsistent 0.17.3 PySocks 1.7.1 python-dateutil 2.8.2 pytz 2021.1 pywin32 301 pywinpty 1.1.3 pyzmq 22.2.1 requests 2.26.0 requests-unixsocket 0.2.0 scipy 1.7.1 Send2Trash 1.8.0 setuptools 57.4.0 six 1.16.0 sniffio 1.2.0 terminado 0.10.1 testpath 0.5.0 tornado 6.1 traitlets 5.0.5 urllib3 1.26.6 wcwidth 0.2.5 webencodings 0.5.1 websocket-client 0.57.0 wheel 0.37.0 win-inet-pton 1.1.0 wincertstore 0.2 zipp 3.5.0

kroegern1 commented 3 years ago

The issue seems to appear when I run the notebook. I can't run hmms in the kernel - mostly because I don't have a good understanding of how that would work now. I'm just going to use the terminal and a text editor since I can import it okay outside of a jupyter notebook. Thanks for your help so far!

skr3178 commented 2 years ago

reinstall using github. I've downgraded the cython to 0.25.2 and reinstalled using github. this helped me. pip install cython==0.25.2 python -m pip install git+https://github.com/lopatovsky/HMMs

Thanks for the guide. The following worked for me in the order: python version: 3.7.13 numpy 1.21.6 cPython 0.0.6 !pip install git+https://github.com/lopatovsky/HMMs