-1

I can run basic Python scripts from SQL Server Agent using the CmdExec to run a bat file pointing to my py file that prints hello world. However when trying run a file that uses the pandas module the Agent keeps coming up with the error below:

import pandas as pd File "C:\...\Python\Python39\lib\site-packages\pandas\__init__.py"<c/> line 47<c/> in <module> raise ImportError( ImportError: Unable to import required dependencies: dateutil: No module named 'dateutil'. Process Exit Code 1

The test code I am trying to execute is below:

import pandas as pd

lst=['a','b','c']

df=pd.DataFrame(lst)
df.to_csv(r'C:\Test.csv',index=False)

Seeing if you had any suggestions?

1 Answer 1

0

Try pip install python-dateutil

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks I gave that a shot but looks like I already had it installed.
You probably need to install it for the user running sql server agent, or globally.
I am running the server agent on my local machine for testing and given the agent access to all folders. Not sure if that is what you mean.
Checking if anyone had any possible solution?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.