Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Prototype-X/fd8bf6d8b929224621613316bf37db02 to your computer and use it in GitHub Desktop.
Save Prototype-X/fd8bf6d8b929224621613316bf37db02 to your computer and use it in GitHub Desktop.
Install pgAdmin4 v2.0 with python3 on Ubuntu 16.04 DESKTOP mode

Install pgAdmin4 v2.0 with python3 on Ubuntu 16.04 DESKTOP mode

  1. Get Python Wheel pgAdmin4

     wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.0/pip/pgadmin4-2.0-py2.py3-none-any.whl
    
  2. Install pip3

     sudo apt install python3-pip
    
  3. Install virtualenv

     sudo pip3 install virtualenv
    
  4. Create virtualenv in dir ~/py3-venv-pgadmin

     virtualenv --system-site-packages --no-setuptools --python=python3.5 ~/py3-venv-pgadmin
    
  5. Activate virtualenv

     cd ~/py3-venv-pgadmin/bin
     source activate
    
  6. Check pip3

     which pip3
     ~/py3-venv-pgadmin/bin/pip3
    
  7. Install pgAdmin4

     pip3 install pgadmin4-2.0-py2.py3-none-any.whl
    
  8. For desktop deployment

     cd ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4
     touch config_local.py
     nano config_local.py
    

    write:

     import os
     SERVER_MODE = False
     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')
    

    run:

     python3 ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4/setup.py
    
  9. Run pgAdmin4

     python3 ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4/pgAdmin4.py
    
  10. Exit virtualenv

     deactivate
    
  11. For run pgadmin4 create script ~/py3-venv-pgadmin/pgadmin4.sh

     #!/usr/bin/env bash
     cd ~/py3-venv-pgadmin/bin
     source activate
     python3 ~/py3-venv-pgadmin/lib/python3.5/site-packages/pgadmin4/pgAdmin4.py
    
  12. Create alias for bash

     nano ~/.bashrc
    

    write at the end of file:

     alias pgadmin4='~/py3-venv-pgadmin/pgadmin4.sh'
    

    reload bashrc

     source ~/.bashrc
    

    now you can run pgadmin

     pgadmin4
    
@JOFLIX
Copy link

JOFLIX commented Aug 4, 2019

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 342, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "/usr/lib/python3/dist-packages/pip/download.py", line 809, in unpack_url
unpack_file_url(link, location, download_dir, hashes=hashes)
File "/usr/lib/python3/dist-packages/pip/download.py", line 715, in unpack_file_url
unpack_file(from_path, location, content_type, link)
File "/usr/lib/python3/dist-packages/pip/utils/init.py", line 617, in unpack_file
flatten=not filename.endswith('.whl')
File "/usr/lib/python3/dist-packages/pip/utils/init.py", line 500, in unzip_file
zipfp = open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/home/moringa/pgAdmin4/pgadmin4-2.0-py2.py3-none-any.whl'

I Get the above error , kindly help

@mcnesium
Copy link

having set this:

services:
  pgadmin:
    image: dpage/pgadmin4:latest
    volumes:
      - /data/pgadmin:/var/lib/pgadmin

… I had to do chown -R 5050:5050 /data/pgadmin on the host system when upgrade to v4.16 came in.
5050 is the uid of pgadmin in my container, so it might help to do docker exec -ti <pgadmin_container> id pgadmin first.

@pedromigueltorres01
Copy link

me da el error de status 1 en el paso 6.. alguen me puede ayudar por favor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment