jbn / ZigZag

Python library for identifying the peaks and valleys of a time series.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'zigzag.core'

john-intele opened this issue · comments

When run the example

from pandas_datareader import get_data_yahoo
from zigzag import *

X = get_data_yahoo('GOOG')['Adj Close']
pivots = peak_valley_pivots(X.values, 0.2, -0.2)
ts_pivots = pd.Series(X, index=X.index)
ts_pivots = ts_pivots[pivots != 0]
X.plot()
ts_pivots.plot(style='g-o');

I got this error, I did run pip install zigzag

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-98-e7b98d0b102d> in <module>
      1 from pandas_datareader import get_data_yahoo
----> 2 from zigzag import *
      3 
      4 X = get_data_yahoo('GOOG')['Adj Close']
      5 pivots = peak_valley_pivots(X.values, 0.2, -0.2)

~/opt/miniconda3/lib/python3.8/site-packages/zigzag/__init__.py in <module>
----> 1 from zigzag.core import *
      2 
      3 
      4 __title__ = "zigzag"
      5 __description__ = "Package for finding peaks and valleys of time series."

ModuleNotFoundError: No module named 'zigzag.core'

@john-intele - a little late in finding this problem but I was able to reproduce it for a while. I no longer can reproduce this after:

$ pip uninstall -y ZigZag
$ python -m pip install --no-cache-dir --force-reinstall  ZigZag

I'm not sure how we hosed our systems or how the clean install fixed it, but maybe this comment helps someone out in the future.

Note: I also ran pip install cython during my troubleshooting. Not sure if that's related.

For me, the problem was that I tried to run the ipynb file from a cloned ZigZag repo. And when executing from zigzag import *, it tried to import zigzag from the local repo instead from the pip installed package.

Solution:

  • Copy the ipynb file to a different dir mv ZigZag/zigzag_demo.ipynb ~/your_new_path/zigzag_demo.ipynb
  • Load the new notebook file from jupyter, and everything works.

Both problems were more on ZigZags end. The new version (0.3.0) should fix the install problems.

I have the same problem, I download the zip file and then install the package.
I solve the problem deleting from my local files the zigzag folder that contain the package