twopirllc / pandas-ta

Technical Analysis Indicators - Pandas TA is an easy to use Python 3 Pandas Extension with 150+ Indicators
https://twopirllc.github.io/pandas-ta/
MIT License
5.46k stars 1.06k forks source link

ModuleNotFoundError: No module named 'pkg_resources' #821

Closed dharmatech closed 2 months ago

dharmatech commented 2 months ago

I installed pandas_ta as follows:

(env-3.12-pandas) PS C:\Users\dharm\Dropbox\Documents\yfinance_all_stocks.py> pip install pandas_ta
Collecting pandas_ta
  Downloading pandas_ta-0.3.14b.tar.gz (115 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 115.1/115.1 kB 446.2 kB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pandas in c:\users\dharm\python-environments\env-3.12-pandas\lib\site-packages (from pandas_ta) (2.2.2)
Requirement already satisfied: numpy>=1.26.0 in c:\users\dharm\python-environments\env-3.12-pandas\lib\site-packages (from pandas->pandas_ta) (1.26.4)
Requirement already satisfied: python-dateutil>=2.8.2 in c:\users\dharm\python-environments\env-3.12-pandas\lib\site-packages (from pandas->pandas_ta) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in c:\users\dharm\python-environments\env-3.12-pandas\lib\site-packages (from pandas->pandas_ta) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in c:\users\dharm\python-environments\env-3.12-pandas\lib\site-packages (from pandas->pandas_ta) (2024.1)
Requirement already satisfied: six>=1.5 in c:\users\dharm\python-environments\env-3.12-pandas\lib\site-packages (from python-dateutil>=2.8.2->pandas->pandas_ta) (1.16.0)
Building wheels for collected packages: pandas_ta
  Building wheel for pandas_ta (pyproject.toml) ... done
  Created wheel for pandas_ta: filename=pandas_ta-0.3.14b0-py3-none-any.whl size=218926 sha256=51e14c8cdc45f2868c0c8723acc8b59cb3e07e78ac0e9780933829938726d82a
  Stored in directory: c:\users\dharm\appdata\local\pip\cache\wheels\fd\ed\18\2a12fd1b7906c63efca6accb351929f2c7f6bbc674e1c0ba5d
Successfully built pandas_ta
Installing collected packages: pandas_ta
Successfully installed pandas_ta-0.3.14b0

[notice] A new release of pip is available: 24.0 -> 24.2
[notice] To update, run: python.exe -m pip install --upgrade pip

When I try to import pandas_ta I get the following:

(env-3.12-pandas) PS C:\Users\dharm\Dropbox\Documents\yfinance_all_stocks.py> python
Python 3.12.3 (tags/v3.12.3:f6650f9, Apr  9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas_ta
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\dharm\python-environments\env-3.12-pandas\Lib\site-packages\pandas_ta\__init__.py", line 7, in <module>
    from pkg_resources import get_distribution, DistributionNotFound
ModuleNotFoundError: No module named 'pkg_resources'
>>>

Any suggestions welcome. Thank you!

hemantbuchade commented 2 months ago

Try to upgrade setuptools using command prompt

twopirllc commented 2 months ago

Hello @dharmatech

To be clear, this is not a Pandas TA issue. Python decided to deprecate/remove setuptools in Python version 3.12. So in short, @hemantbuchade is correct, you also need to install setuptools.

More on a simple web search for: ModuleNotFoundError: No module named 'pkg_resources'

Kind Regards, KJ