TDAmeritrade / stumpy

STUMPY is a powerful and scalable Python library for modern time series analysis

Home Page:https://stumpy.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No module named 'pkg_resources'

Galsor opened this issue · comments

Hi everyone,

I am starting to experiment Stumpy. I am running a poetry environment with Python 3.12.1.
I successfully installed Stumpy and its dependencies.

Below the poetry logs:

Package operations: 4 installs, 0 updates, 0 removals

  • Installing llvmlite (0.42.0)
  • Installing numba (0.59.0)
  • Installing scipy (1.12.0)
  • Installing stumpy (1.12.0)

Writing lock file

However running from stumpy import stump in a Jupyter notebook I faced the following error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[22], [line 1](vscode-notebook-cell:?execution_count=22&line=1)
----> [1](vscode-notebook-cell:?execution_count=22&line=1) from stumpy import stump
      [3](vscode-notebook-cell:?execution_count=22&line=3) m = 5
      [4](vscode-notebook-cell:?execution_count=22&line=4) mp = stump(evolution_ratio, m)

File [~/Projects/ts_pattern_matching/.venv/lib/python3.12/site-packages/stumpy/__init__.py:4](https://file+.vscode-resource.vscode-cdn.net/Users/antiez/Projects/ts_pattern_matching/notebooks/~/Projects/ts_pattern_matching/.venv/lib/python3.12/site-packages/stumpy/__init__.py:4)
      [1](https://file+.vscode-resource.vscode-cdn.net/Users/antiez/Projects/ts_pattern_matching/notebooks/~/Projects/ts_pattern_matching/.venv/lib/python3.12/site-packages/stumpy/__init__.py:1) import os.path
      [3](https://file+.vscode-resource.vscode-cdn.net/Users/antiez/Projects/ts_pattern_matching/notebooks/~/Projects/ts_pattern_matching/.venv/lib/python3.12/site-packages/stumpy/__init__.py:3) from numba import cuda
----> [4](https://file+.vscode-resource.vscode-cdn.net/Users/antiez/Projects/ts_pattern_matching/notebooks/~/Projects/ts_pattern_matching/.venv/lib/python3.12/site-packages/stumpy/__init__.py:4) from pkg_resources import DistributionNotFound, get_distribution
      [6](https://file+.vscode-resource.vscode-cdn.net/Users/antiez/Projects/ts_pattern_matching/notebooks/~/Projects/ts_pattern_matching/.venv/lib/python3.12/site-packages/stumpy/__init__.py:6) from .aamp import aamp  # noqa: F401
      [7](https://file+.vscode-resource.vscode-cdn.net/Users/antiez/Projects/ts_pattern_matching/notebooks/~/Projects/ts_pattern_matching/.venv/lib/python3.12/site-packages/stumpy/__init__.py:7) from .aamp_mmotifs import aamp_mmotifs  # noqa: F401

ModuleNotFoundError: No module named 'pkg_resources'

Any ideas on how to solve this ?

Fixed the issue by adding setuptools dependancy.
I have also seen a merged PR fixing the issue the 2th of feb.
Hopefully it will be released soon.
Let's pursue those tests with stumpy ;)

@Galsor Thank you for your question. I am curious as to what you mean when you say:

Hopefully it will be released soon.

The fact that you encountered ModuleNotFoundError: No module named 'pkg_resources' error implies that you were trying to install STUMPY directly from the Github source and not from either PyPI or conda-forge (this along with the fact that you mention poetry leads me to believe that this is true). If you had installed STUMPY from PyPI or conda-forge then you should not have run into the aforementioned error. If you received this error after installing from PyPI or conda-forge then please point us to the specific version and I can take a look. Otherwise, there is nothing to "fix". Am I missing your point?

If you are indeed installing from source along with poetry (which isn't used by STUMPY), then you will likely need to specify setuptools as a part of your build tools. This is currently specified in the pyproject.toml. Unfortunately, I do not use poetry and am little help there.

Note to install STUMPY from source (without all of the development tools), all you should need to do is:

python -m pip install .