Reputation: 161
I have a Python 2.7 question, if somebody can help. When we install a Python module using pip, how do we make it available to all users? Please, see the example below (with module faker). The import works when I am root, but doesn’t work when I am ubuntu user. I have already tried to install using option --system, and also changing umask, as recommended in some articles I have found. Didn’t work so far. Any ideas? If we run "which python", both users point to the same one.
root@ip-172-30-244-157:/home/ubuntu#
root@ip-172-30-244-157:/home/ubuntu# python
Python 2.7.17 (default, Sep 30 2020, 13:38:04)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import faker
>>>
>>> exit()
root@ip-172-30-244-157:/home/ubuntu#
root@ip-172-30-244-157:/home/ubuntu#
root@ip-172-30-244-157:/home/ubuntu# exit
exit
ubuntu@ip-172-30-244-157:~$
ubuntu@ip-172-30-244-157:~$
ubuntu@ip-172-30-244-157:~$ python
Python 2.7.17 (default, Sep 30 2020, 13:38:04)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import faker
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named faker
>>>
Upvotes: 0
Views: 714
Reputation: 161
Ok, I solved the issue. In my case, the problematic module was "faker". But, when we install the faker, another additional module is installed as well (in this case - text-unidecode). Then I uninstalled both modules, ran "umask 022" and re-installed the faker. This solved the issue for all other users. Thanks all for the help!
Upvotes: 1