So i just freshly installed ubuntu 18.04 which comes with python3.6 out of the box. then i installed pip
sudo apt update
sudo apt install python3-pip
after that i installed pandas using
pip3 install pandas
which got stored at
/home/anubhav/.local/lib/python3.6/site-packages
which i assume is the expected path where it should install. Now i created a system user
sudo adduser --system ggc_user
and then i imported pandas using:
sudo -u ggc_user bash -c 'python3 -c import pandas"'
which gives me error:
Module not found.
then I uninstalled the pandas and tried to install it system-wide using
pip3 install --system pandas
but then i got error:
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 360, in run
prefix=options.prefix_path,
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.6/dist-packages/pytz'
So my question is, how to make my python modules available to system user ggc_user
? What is the right way to install modules?