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?

New contributor
C McNorgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
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

Your Answer

C McNorgan is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.