Skip to content Skip to sidebar Skip to footer

Cron Wont Import Pandas Module To Execute Python Script. ```importerror: No Module Named Pandas```

I am using xubuntu 18.01 I have a python program that that scrapes weather data and saves the files as a csv. It works perfectly running the command weatherdata in terminal after i

Solution 1:

The crontab -e job looks fine.

Why not just use:

34 * * * * /home/luke/bin/weatherdata

Or else set a sh file ... eg. myfile.sh

#!/usr/local/env bash
/home/luke/bin/weatherdata

Then crontab -e reads

34 * * * * /home/luke/myfile.sh

Cron works a dream unless your system admin is blocking it.

Solution 2:

As @thatotherguy suggested it was my path that was the problem.

1) I ran echo $PATH in terminal and got back:

/home/luke/anaconda3/bin:/home/luke/anaconda3/condabin:/home/luke/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

2) I copy and pasted the above path to replace: PATH=/home/luke/bin/:/usr/sbin:/usr/bin:/sbin:/bin with

PATH=/home/luke/anaconda3/bin:/home/luke/anaconda3/condabin:/home/luke/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

3) I changed PATH=/ to PATH=$PATH:/

Now the cronjob executes perfectly.

Post a Comment for "Cron Wont Import Pandas Module To Execute Python Script. ```importerror: No Module Named Pandas```"