Description:
I'm encountering an issue with the Windows Task Scheduler when executing a Python script that utilizes pandas' read_excel()
method. Here's the scenario:
Problem:
When I manually trigger the scheduled task, it fails and reports that it cannot find the 'openpyxl' module, which is actually installed (version 3.1.2). Strangely, if I manually trigger the same script using PowerShell with the exact same Python runtime (3.10.7), it executes successfully.
Attempts:
I have tried several approaches, as I previously faced a similar issue due to another dependency, which got resolved after installation. However, in this case, 'openpyxl' was already installed, yet the problem persists only when running the task via Windows Task Scheduler.
Additional Info:
I initially suspected it might be a pandas-related problem, but to verify, I added an import statement for 'openpyxl' at the beginning of the script, and the issue persisted, confirming that it is related to the Windows Task Scheduler.
Has anyone encountered a similar issue with Windows Task Scheduler and pandas? Any suggestions on how to resolve this problem would be highly appreciated. Thank you!
Using virtual environment worked but using default environment still isn't working. My problem is resolved for now.