ModuleNotFoundError: No module named 'pandas' (only as root)python3 - ImportError: No module named '_chipset'Problem getting script to run via cron tabBash script doesn't work properly in crontab but does work manuallyCalling .py script from .sh script error “ImportError: No module named apiclient.discovery”Python module not found when launched in cronCronjob - Unable to find module “pydub”

Is there a difference between historical fiction and creative non-fiction?

Why didn't Snape ask Dumbledore why he let "Moody" search his office?

What are the most important factors in determining how fast technology progresses?

Does SQL Server's serializable isolation level lock entire table

Composing religious songs and melodies on Shabbos

In the Star Trek: TNG continuity is cloning illegal?

Determine the Winner of a Game of Australian Football

What is the next number in the sequence 21, 21, 23, 20, 5, 25, 31, 24, ...?

Can 35 mm film which went through a washing machine still be developed?

What's the difference between motherboard and chassis?

Is there any specific significance of inverse demand?

Is there a penalty for switching targets?

Making a animation of multiple 3D objects rotating

Power Adapter for Traveling to Scotland (I live in the US)

How to catch creatures that can predict the next few minutes?

Are 1 in 6 deaths in the USA due to lead exposure?

Spectrometer vs Spectrometry vs Spectroscopy

Why is the time of useful consciousness only seconds at high altitudes, when I can hold my breath much longer at ground level?

I pay for a service, but I miss the broadcast

Fair Use of Photos as a Derivative Work

Would we have more than 8 minutes of light, if the sun "went out"?

What is /dev/null and why can't I use hx on it?

Is there any problem with students seeing faculty naked in university gym?

Applying UK Visit Visa Application from AU



ModuleNotFoundError: No module named 'pandas' (only as root)


python3 - ImportError: No module named '_chipset'Problem getting script to run via cron tabBash script doesn't work properly in crontab but does work manuallyCalling .py script from .sh script error “ImportError: No module named apiclient.discovery”Python module not found when launched in cronCronjob - Unable to find module “pydub”






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









1















So I'm having this weird issue.



I just installed server 18.04.1 LTS. The purpose of this server is to run scheduled Python scripts.



I can run my script just fine when authenticated with the user-account created during installation. But it won't run when scheduled with CRON (sudo crontab -e).



So... I set root password, authenticate and try running script and receive error "ModuleNotFoundError: No module named 'pandas'". So... I install pandas (sudo apt-get install python-pandas) and re-run. Same error










share|improve this question
























  • Please add output of pip freeze | grep pandas, su -c "pip freeze | grep pandas" and apt-cache policy python-pandas to the question.

    – N0rbert
    Jan 18 at 21:39

















1















So I'm having this weird issue.



I just installed server 18.04.1 LTS. The purpose of this server is to run scheduled Python scripts.



I can run my script just fine when authenticated with the user-account created during installation. But it won't run when scheduled with CRON (sudo crontab -e).



So... I set root password, authenticate and try running script and receive error "ModuleNotFoundError: No module named 'pandas'". So... I install pandas (sudo apt-get install python-pandas) and re-run. Same error










share|improve this question
























  • Please add output of pip freeze | grep pandas, su -c "pip freeze | grep pandas" and apt-cache policy python-pandas to the question.

    – N0rbert
    Jan 18 at 21:39













1












1








1








So I'm having this weird issue.



I just installed server 18.04.1 LTS. The purpose of this server is to run scheduled Python scripts.



I can run my script just fine when authenticated with the user-account created during installation. But it won't run when scheduled with CRON (sudo crontab -e).



So... I set root password, authenticate and try running script and receive error "ModuleNotFoundError: No module named 'pandas'". So... I install pandas (sudo apt-get install python-pandas) and re-run. Same error










share|improve this question














So I'm having this weird issue.



I just installed server 18.04.1 LTS. The purpose of this server is to run scheduled Python scripts.



I can run my script just fine when authenticated with the user-account created during installation. But it won't run when scheduled with CRON (sudo crontab -e).



So... I set root password, authenticate and try running script and receive error "ModuleNotFoundError: No module named 'pandas'". So... I install pandas (sudo apt-get install python-pandas) and re-run. Same error







python






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 18 at 10:12









Michael DeYoungMichael DeYoung

61 bronze badge




61 bronze badge















  • Please add output of pip freeze | grep pandas, su -c "pip freeze | grep pandas" and apt-cache policy python-pandas to the question.

    – N0rbert
    Jan 18 at 21:39

















  • Please add output of pip freeze | grep pandas, su -c "pip freeze | grep pandas" and apt-cache policy python-pandas to the question.

    – N0rbert
    Jan 18 at 21:39
















Please add output of pip freeze | grep pandas, su -c "pip freeze | grep pandas" and apt-cache policy python-pandas to the question.

– N0rbert
Jan 18 at 21:39





Please add output of pip freeze | grep pandas, su -c "pip freeze | grep pandas" and apt-cache policy python-pandas to the question.

– N0rbert
Jan 18 at 21:39










1 Answer
1






active

oldest

votes


















0
















Regardless of your purpose, tt's probably a safer choice to not use root to run any scripts on your server.



(I don't actually know if running cron scripts with root can create a vulnerability or not, but better safe than sorry i guess).



With that in mind, I think you could solve this by either



1) setting the permission for your user (the one that runs the script successfully) in the cron.allow file:




usually in the path /usr/lib/cron/cron.allow, simply adding the username in a separate line.




or



2) setting a custom env for the script:



HOME=user-home-directory
LOGNAME=user-login-id
PATH=/usr/bin:/usr/sbin:.
SHELL=/usr/bin/sh
PYTHONPATH=/usr/lib/pythonX.X


For more detailed information check this crontrab reference.



Hope that helps.






share|improve this answer




























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1110822%2fmodulenotfounderror-no-module-named-pandas-only-as-root%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    Regardless of your purpose, tt's probably a safer choice to not use root to run any scripts on your server.



    (I don't actually know if running cron scripts with root can create a vulnerability or not, but better safe than sorry i guess).



    With that in mind, I think you could solve this by either



    1) setting the permission for your user (the one that runs the script successfully) in the cron.allow file:




    usually in the path /usr/lib/cron/cron.allow, simply adding the username in a separate line.




    or



    2) setting a custom env for the script:



    HOME=user-home-directory
    LOGNAME=user-login-id
    PATH=/usr/bin:/usr/sbin:.
    SHELL=/usr/bin/sh
    PYTHONPATH=/usr/lib/pythonX.X


    For more detailed information check this crontrab reference.



    Hope that helps.






    share|improve this answer































      0
















      Regardless of your purpose, tt's probably a safer choice to not use root to run any scripts on your server.



      (I don't actually know if running cron scripts with root can create a vulnerability or not, but better safe than sorry i guess).



      With that in mind, I think you could solve this by either



      1) setting the permission for your user (the one that runs the script successfully) in the cron.allow file:




      usually in the path /usr/lib/cron/cron.allow, simply adding the username in a separate line.




      or



      2) setting a custom env for the script:



      HOME=user-home-directory
      LOGNAME=user-login-id
      PATH=/usr/bin:/usr/sbin:.
      SHELL=/usr/bin/sh
      PYTHONPATH=/usr/lib/pythonX.X


      For more detailed information check this crontrab reference.



      Hope that helps.






      share|improve this answer





























        0














        0










        0









        Regardless of your purpose, tt's probably a safer choice to not use root to run any scripts on your server.



        (I don't actually know if running cron scripts with root can create a vulnerability or not, but better safe than sorry i guess).



        With that in mind, I think you could solve this by either



        1) setting the permission for your user (the one that runs the script successfully) in the cron.allow file:




        usually in the path /usr/lib/cron/cron.allow, simply adding the username in a separate line.




        or



        2) setting a custom env for the script:



        HOME=user-home-directory
        LOGNAME=user-login-id
        PATH=/usr/bin:/usr/sbin:.
        SHELL=/usr/bin/sh
        PYTHONPATH=/usr/lib/pythonX.X


        For more detailed information check this crontrab reference.



        Hope that helps.






        share|improve this answer















        Regardless of your purpose, tt's probably a safer choice to not use root to run any scripts on your server.



        (I don't actually know if running cron scripts with root can create a vulnerability or not, but better safe than sorry i guess).



        With that in mind, I think you could solve this by either



        1) setting the permission for your user (the one that runs the script successfully) in the cron.allow file:




        usually in the path /usr/lib/cron/cron.allow, simply adding the username in a separate line.




        or



        2) setting a custom env for the script:



        HOME=user-home-directory
        LOGNAME=user-login-id
        PATH=/usr/bin:/usr/sbin:.
        SHELL=/usr/bin/sh
        PYTHONPATH=/usr/lib/pythonX.X


        For more detailed information check this crontrab reference.



        Hope that helps.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 17 at 6:45

























        answered Apr 17 at 6:36









        Lucas Vasconcellos CzepanikiLucas Vasconcellos Czepaniki

        869 bronze badges




        869 bronze badges































            draft saved

            draft discarded















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1110822%2fmodulenotfounderror-no-module-named-pandas-only-as-root%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Tamil (spriik) Luke uk diar | Nawigatjuun

            Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

            Where does the image of a data connector as a sharp metal spike originate from?Where does the concept of infected people turning into zombies only after death originate from?Where does the motif of a reanimated human head originate?Where did the notion that Dragons could speak originate?Where does the archetypal image of the 'Grey' alien come from?Where did the suffix '-Man' originate?Where does the notion of being injured or killed by an illusion originate?Where did the term “sophont” originate?Where does the trope of magic spells being driven by advanced technology originate from?Where did the term “the living impaired” originate?