How do I make python modules available to all users?












0















I work in a multi-user setting and am relatively new to Python. The machines in question run Ubuntu 16.04, and we are using Python 2.7. I personally have installed several additional modules, such as tensorflow, keras, and some other related modules and I believe I used the pip installer (pip 18.0 from /usr/local/lib/python2.7/) to install these (sudo pip install X).



I've been successfully running python scripts for months using all of these modules but another user has been unable to run any python code that uses any of the modules that I've installed. Even a 1-line script that exists only to import a module such as:



import tensorflow


fails to run, generating an ImportError (I'll only paste the last couple of lines):



File "/usr/local/lib/python2.7/dist- 
packages/tensorflow/python/ops/variable_scope.py", line 24, in <module>
import enum # pylint: disable=g-bad-import-order
ImportError: No module named enum


What did I do wrong that's making these modules invisible to other users, and how can I fix it?










share|improve this question



























    0















    I work in a multi-user setting and am relatively new to Python. The machines in question run Ubuntu 16.04, and we are using Python 2.7. I personally have installed several additional modules, such as tensorflow, keras, and some other related modules and I believe I used the pip installer (pip 18.0 from /usr/local/lib/python2.7/) to install these (sudo pip install X).



    I've been successfully running python scripts for months using all of these modules but another user has been unable to run any python code that uses any of the modules that I've installed. Even a 1-line script that exists only to import a module such as:



    import tensorflow


    fails to run, generating an ImportError (I'll only paste the last couple of lines):



    File "/usr/local/lib/python2.7/dist- 
    packages/tensorflow/python/ops/variable_scope.py", line 24, in <module>
    import enum # pylint: disable=g-bad-import-order
    ImportError: No module named enum


    What did I do wrong that's making these modules invisible to other users, and how can I fix it?










    share|improve this question

























      0












      0








      0








      I work in a multi-user setting and am relatively new to Python. The machines in question run Ubuntu 16.04, and we are using Python 2.7. I personally have installed several additional modules, such as tensorflow, keras, and some other related modules and I believe I used the pip installer (pip 18.0 from /usr/local/lib/python2.7/) to install these (sudo pip install X).



      I've been successfully running python scripts for months using all of these modules but another user has been unable to run any python code that uses any of the modules that I've installed. Even a 1-line script that exists only to import a module such as:



      import tensorflow


      fails to run, generating an ImportError (I'll only paste the last couple of lines):



      File "/usr/local/lib/python2.7/dist- 
      packages/tensorflow/python/ops/variable_scope.py", line 24, in <module>
      import enum # pylint: disable=g-bad-import-order
      ImportError: No module named enum


      What did I do wrong that's making these modules invisible to other users, and how can I fix it?










      share|improve this question














      I work in a multi-user setting and am relatively new to Python. The machines in question run Ubuntu 16.04, and we are using Python 2.7. I personally have installed several additional modules, such as tensorflow, keras, and some other related modules and I believe I used the pip installer (pip 18.0 from /usr/local/lib/python2.7/) to install these (sudo pip install X).



      I've been successfully running python scripts for months using all of these modules but another user has been unable to run any python code that uses any of the modules that I've installed. Even a 1-line script that exists only to import a module such as:



      import tensorflow


      fails to run, generating an ImportError (I'll only paste the last couple of lines):



      File "/usr/local/lib/python2.7/dist- 
      packages/tensorflow/python/ops/variable_scope.py", line 24, in <module>
      import enum # pylint: disable=g-bad-import-order
      ImportError: No module named enum


      What did I do wrong that's making these modules invisible to other users, and how can I fix it?







      linux python pip






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 10 at 15:19









      C McNorganC McNorgan

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I strongly recommend avoid using python-pip on production context.
          Modules installed that way aren't updated during system updates which may lead to vulnerabilities that never get patched ....



          Nevertheless, pip, by default, install the module only in calling user's $HOME.
          For pip to install "system-wide", use the --system switch.



          For more details, see pip install --help output






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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/3.0/"u003ecc by-sa 3.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%2fsuperuser.com%2fquestions%2f1392790%2fhow-do-i-make-python-modules-available-to-all-users%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














            I strongly recommend avoid using python-pip on production context.
            Modules installed that way aren't updated during system updates which may lead to vulnerabilities that never get patched ....



            Nevertheless, pip, by default, install the module only in calling user's $HOME.
            For pip to install "system-wide", use the --system switch.



            For more details, see pip install --help output






            share|improve this answer




























              0














              I strongly recommend avoid using python-pip on production context.
              Modules installed that way aren't updated during system updates which may lead to vulnerabilities that never get patched ....



              Nevertheless, pip, by default, install the module only in calling user's $HOME.
              For pip to install "system-wide", use the --system switch.



              For more details, see pip install --help output






              share|improve this answer


























                0












                0








                0







                I strongly recommend avoid using python-pip on production context.
                Modules installed that way aren't updated during system updates which may lead to vulnerabilities that never get patched ....



                Nevertheless, pip, by default, install the module only in calling user's $HOME.
                For pip to install "system-wide", use the --system switch.



                For more details, see pip install --help output






                share|improve this answer













                I strongly recommend avoid using python-pip on production context.
                Modules installed that way aren't updated during system updates which may lead to vulnerabilities that never get patched ....



                Nevertheless, pip, by default, install the module only in calling user's $HOME.
                For pip to install "system-wide", use the --system switch.



                For more details, see pip install --help output







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 10 at 16:10









                binarymbinarym

                1262




                1262






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • 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%2fsuperuser.com%2fquestions%2f1392790%2fhow-do-i-make-python-modules-available-to-all-users%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

                    Terni

                    A new problem with tex4ht and tikz

                    Sun Ra