jeeftor / mint-scraper-for-homeassistant

AppDaemon script for scraping financial data from MINT to display in home assistant
4 stars 1 forks source link

Compile Error (Error Importing Numpy...) #7

Open robertoleonardo opened 1 year ago

robertoleonardo commented 1 year ago

hi - i've been using this app successfully for a number of months but just realized today that it stopped working a few weeks back. i've been tinkering all day, including by re-setting my MFA token and such with mint -- no dice. the below bit from my log seems to reflect the issue.

2023-10-29 19:18:53.455241 WARNING Error: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 1000, in check_app_updates
    await utils.run_in_executor(self, self.read_app, mod["name"], mod["reload"])
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 304, in run_in_executor
    response = future.result()
               ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 783, in read_app
    self.modules[module_name] = importlib.import_module(module_name)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/appdaemon/apps/mint-scraper-for-homeassistant/mint_scraper.py", line 11, in <module>
    from mintapi.api import Mint
  File "/usr/lib/python3.11/site-packages/mintapi/__init__.py", line 3, in <module>
    from mintapi.api import *
  File "/usr/lib/python3.11/site-packages/mintapi/api.py", line 3, in <module>
    from mintapi.browser import SeleniumBrowser
  File "/usr/lib/python3.11/site-packages/mintapi/browser.py", line 8, in <module>
    from mintapi.endpoints import MintEndpoints
  File "/usr/lib/python3.11/site-packages/mintapi/endpoints.py", line 13, in <module>
    import pandas as pd
  File "/usr/lib/python3.11/site-packages/pandas/__init__.py", line 16, in <module>
    raise ImportError(
ImportError: Unable to import required dependencies:
numpy: Error importing numpy: you should not try to import numpy from
        its source directory; please exit the numpy source tree, and relaunch
        your python interpreter from there.

Specifically, something to do with numpy. If it makes a difference (though i doubt it does), i went back in my HASS logbooks and now determined that the last date the scraper was successfully working was on 10/14 at 430 am :)

one thing i've noticed is that when i first boot appdaemon if i refresh the browser a tthe right time -- there is about a 5 second window where it says the mint app did load (and the logs earlier reflect that mini api was successfully loaded), but then within a few seconds it switches to "compile error"

i don't think i've made any changes on my end that would impact it, other than updating home assistant periodically to keep it current. home assistant version info:

Home Assistant 2023.10.5
Supervisor 2023.10.1
Operating System 11.1
Frontend 20231005.0 - latest

app daemon - version 13.6

any ideas what's going on?

robertoleonardo commented 1 year ago

for anyone who is having this issue - i think i fixed it. it appears to be the newest version of numpy - 1.26.1 -- which was released right aroun when the issue started for me. i'm forcing appdaemon to install numpy v 1.26.0 and that seems to have fixed it.

here's how: i moved 'mintapi' from the appdaemon config settings into a requirements.txt file, AFTER numpy==1.26.0. 1.26.0 meets the lowest version number required by mint api but if it's not already installed, 1.26.1 will get installed and cause issues.

here's what my addons config now looks like:
image

and my requirements.txt:


numpy==1.26.0
configargparse==1.5.3
future==0.18.3
keyring==23.2.1
mock==4.0.2
oathtool==2.3.0
pandas
selenium-requests==2.0.3
xmltodict==0.12.0
selenium>=4.11.2
mintapi

i probably really only needed to have one line in there -- numpy==1.26.0 -- and could've let mintapi do the rest of importing, but i've got it working with the above so i'm not going to mess with it anymore...