Development Setup script fails on Linux distros due to superuser privilege issues
Summary
The development setup script (gkcore_cli.py
) expects superuser privilege to run the docker-compose
command. At the same time, the script also contains pip install
command which shouldn't be run with sudo
due to security issues. It also ruins the purpose of using a virtual environment.
Steps to reproduce
Follow the Development Setup using Docker for Linux mentioned in the README file. The ./gkcore_cli init
step will fail.
Current behavior?
Development setup script with or without sudo
fails to complete installation successfully on Linux distros.
Expected Behavior?
Installation completes successfully without sudo
.
Relevant logs and/or screenshots
When used without sudo
:
File "/usr/lib/python3/dist-packages/docker/transport/unixconn.py", line 30, in connect
sock.connect(self.unix_socket)
PermissionError: [Errno 13] Permission denied
When used with sudo
:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.11/README.venv for more information.
Possible fixes
Since it's not advisable to run pip install
with sudo
, it's better to suggest users to configure system to run docker without superuser privileges instead. Update the Development Setup for Linux section in the README to add link to the official docker documentation for the same.