Reputation: 4461
Ubuntu 16.04.3
I'd like to install pgAdmin:
I hvae created a virtualenv with python 2.
Then install pgAdmin 4 v2.0:
pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.0/pip/pgadmin4-2.0-py2.py3-none-any.whl
It's time to run pgAdmin:
(pgadmin4) michael@michael-desktop:~/PycharmProjects/venv$ python pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Traceback (most recent call last):
File "pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py", line 55, in <module>
exec(open(file_quote(setupfile), 'r').read())
File "<string>", line 46, in <module>
File "/home/michael/PycharmProjects/venv/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/data_directory.py", line 23, in create_app_data_directory
_create_directory_if_not_exists(os.path.dirname(config.SQLITE_PATH))
File "/home/michael/PycharmProjects/venv/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/setup/data_directory.py", line 15, in _create_directory_if_not_exists
os.mkdir(_path)
OSError: [Errno 13] Permission denied: '/var/lib/pgadmin'
Could you give me a kick here?
Upvotes: 13
Views: 36394
Reputation: 15327
As per documentation in pgadmin site
if you are mounting var/lib/pgadmin you your host machine you should execute the following command
sudo chown -R 5050:5050 <your_pgadmin_host_directory>
Upvotes: 0
Reputation: 11
solved issue with several steps 1. create empty folders on host vm
mkdir /private/var/lib/pgadmin chmod 777 /private/var/lib/pgadmin
docker pull dpage/pgadmin4 docker run -p 80:80\ -v /private/var/lib/pgadmin:/var/lib/pgadmin \
...
/private/var/lib/pgadmin -rw-------. 1 5050 5050 757760 Jan 13 23:11 pgadmin4.db drwx------. 2 5050 5050 50 Jan 13 23:00 sessions drwxr-xr-x. 3 5050 5050 31 Jan 13 23:17 storage
thus UID 5050 is our target one 4. copy your pgadmin4.db into target dir and apply proper UID [5050 in my case]
As a result application will work, user settings will be saved.
Upvotes: 1
Reputation: 17
I had the same problem with pgAdmin4 v3.1, I just write sudo python pgAdmin4.py
and it worked!.
Upvotes: -4
Reputation: 3528
I installed pgadmin4 v2.1 on Ubuntu 16.04 and had this problem. See the last line of code. (I run this in a script file, lazy.) I also installed 2.0 this way as a test to see if it really is a fix. I did not have to use config_local.py
.
cd ..
cd home/vagrant
sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev
virtualenv .pgadmin4
cd .pgadmin4
source bin/activate
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.1/pip/pgadmin4-2.1-py2.py3-none-any.whl
pip install pgadmin4-2.1-py2.py3-none-any.whl
# For this either use your remote host panel to edit the file or:
nano lib/python2.7/site-packages/pgadmin4/config.py
# Change:
# DEFAULT_SERVER = '0.0.0.0'
# Here is the trick. Run this boot up file with sudo. This fixed it for me.
sudo python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Upvotes: 0
Reputation: 8144
create the folders manually (or add to your pgAdmin installation script, if there is one), and assign the permissions:
sudo mkdir "/var/log/pgadmin"
sudo chmod a+wrx "/var/log/pgadmin"
sudo mkdir "/var/lib/pgadmin"
sudo chmod a+wrx "/var/lib/pgadmin"
this would not assign permissions to the entire /var/log
but just for the /var/log/pgadmin
only.
Upvotes: 5
Reputation: 6007
If you do not want to change the permission of anything, you can always override default paths in pgAdmin4.
Create a file named config_local.py (if not already present) at your installation location ../pgadmin4/web/
File location in my case: /usr/local/lib/python2.7/dist-packages/pgadmin4/config_local.py
and add following code in your config_local.py
,
import os
DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
SQLITE_PATH = os.path.join(DATA_DIR, 'pgadmin4.db')
SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
Restart pgAdmin4 and check.
Upvotes: 33
Reputation: 2129
Permission error means the user 'michael' (/var/lib has drwxr-xr-x) has the permission to execute but doesn't have the permission to write on the folder (according to your comment of the folder info below). One of the solutions you can use to be able to access freely the folder would be something like:
chown -R michael:root /path/to/the/directory
The second part of the answer, you've figured it out @Michael. downloading pgadmin by using the command:
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.5/pip/pgadmin4-1.5-py2.py3-none-any.whl
and then execute command:
pip install pgadmin4*.whl.
Upvotes: 6