How do I install psycopg2-binary in Operator Framework Ansible? I've tried adding a RUN pip3 install psycopg2-binary
to the Dockerfile but that returns:
Installing collected packages: psycopg2-binary
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
strip_file_prefix=options.strip_file_prefix,
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 789, in install
**kwargs
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install
strip_file_prefix=strip_file_prefix
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
strip_file_prefix=strip_file_prefix,
File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib64/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib64/python3.6/site-packages/psycopg2'
PS. I couldn't add Operator-Framework tag because I need 130 more points to be able to ;)
I've found the origin of the Dockerfile and that helped me come up with this:
COPY requirements.txt ${HOME}/requirements.txt
USER root
RUN pip3 install -r ${HOME}/requirements.txt
USER ${USER_UID}