No module named 'ta'

Hi,

I am trying to deploy my first app at https://share.streamlit.io/schwnb0/commodity_dashboard/main/commodity_dashboard.py. The application runs just fine locally but runs into trouble when sharing via streamlit.io. I receive the following error message:

ModuleNotFoundError: No module named ‘ta’

In the requirements.txt file, I include:

pandas-ta==0.2.23b0

Streamlit doesn’t seem to work well with the TA-Lib or Pandas-TA libraries. Is there a workaround to fix this? If not, would you recommend a more compatible python library for technical analysis?

Thank you

TA-lib is not friendly at all to be installed LOL

Check this other thread (there is a hack there): TA-Lib Streamlit Deploy Error

Also if you find a good library for tech analysis, please let me know as well, I’d be happy to get rid off TA-lib.

Cheers

1 Like

Thank you for the quick response. Two follow-up questions just to make sure I do this properly:

  • When you say “Add gcc and make to packages.txt”, can you provide the exact text to include in the packages file? I am not familiar with the correct format of a packages.txt file.

  • When you say “Add requests to requirements.txt”, can you also provide the exact text to include in the requirements file? Not sure what version of requirements is correct.

Thank you

I have one example on:

Cheers

Your fix worked - the app is now live. Thank you.

1 Like

After I used this modification a few days ago, streamlit worked successfully. However, now it doesn’t work properly again, the main problem is as follows:

Setting up freeglut3:amd64 (2.8.1-6) ...
Setting up libegl-dev:amd64 (1.3.2-1) ...
Setting up libgail-common:amd64 (2.24.33-2) ...
Setting up libpango1.0-dev:amd64 (1.46.2-3) ...
Setting up libglu1-mesa-dev:amd64 (9.0.1-1) ...
Setting up libgtk2.0-dev:amd64 (2.24.33-2) ...
Setting up libgles-dev:amd64 (1.3.2-1) ...
Setting up libglvnd-dev:amd64 (1.3.2-1) ...
Setting up libgl1-mesa-dev:amd64 (20.3.5-1) ...
Setting up freeglut3-dev:amd64 (2.8.1-6) ...
Processing triggers for libc-bin (2.31-13+deb11u2) ...
Processing triggers for libgdk-pixbuf-2.0-0:amd64 (2.42.2+dfsg-1) ...
  Stopping...
2021-12-20 06:26:58.353 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 354, in _run_script
    exec(code, module.__dict__)
  File "/app/indicators_4_option/indicators.py", line 57, in <module>
    import talib as ta
ModuleNotFoundError: No module named 'talib'



Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Reading package lists...[2021-12-20 07:24:55.180083] 
Reading package lists...[2021-12-20 07:24:55.876000] 
Building dependency tree...[2021-12-20 07:24:56.085244] 
Reading state information...[2021-12-20 07:24:56.085885] 
gcc is already the newest version (4:10.2.1-1).
make is already the newest version (4.3-4.1).
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
  Stopping...
2021-12-20 07:24:58.677 Uncaught app exception
Traceback (most recent call last):
  File "/home/appuser/venv/lib/python3.7/site-packages/streamlit/script_runner.py", line 354, in _run_script
    exec(code, module.__dict__)
  File "/app/indicators_4_option/indicators.py", line 57, in <module>
    import talib as ta
ModuleNotFoundError: No module named 'talib'



[client] Preparing system...
[client] Spinning up manager process...