I've installed postgresql 9.6 (using suggested linux installer) which comes with pgAdmin4, but getting a few errors.
First, I had to change the folder name from "pgAdmin 4" (note the extra space) to "pgAdmin4" to avoid "file not found error".
Then I run sudo python pgAdmin4.py
and got the following error:
Traceback (most recent call last):
File "../../pgAdmin4.py", line 24, in <module>
from pgadmin import create_app
File "/opt/PostgreSQL/9.6/pgAdmin4/web/pgadmin/__init__.py", line 17, in <module>
from flask import Flask, abort, request, current_app
ImportError: No module named flask
I tried following this related question: Flask ImportError: No Module Named Flask -- managed to installed flask on virtualenv.
But then I started getting other flask related modules that are missing: flask_babel, flask_login, flask_security. I installed all of them using pip, but then I got an error on missing module htmlmin.minify
which I can't seems to able to install.
Traceback (most recent call last):
File "../pgAdmin4.py", line 24, in <module>
from pgadmin import create_app
File "/opt/PostgreSQL/9.6/pgAdmin4/web/pgadmin/__init__.py", line 23, in <module>
from htmlmin.minify import html_minify
ImportError: No module named htmlmin.minify
I also exported PYTHONPATH to the one on flask, as described here, still getting the same error.
So, anyone have an idea how to make pgAdmin4 work on ubuntu environemt?
If pgAdmin displays this message, there are two possible reasons for this: the database server isn't running - simply start it. the server isn't configured to accept TCP/IP requests on the address shown.
To open pgAdmin, select pgAdmin4 from the EDB Postgres menu. The client opens in your default browser. To connect to the Advanced Server database server, expand the Servers node of the Browser tree control, and right click on the EDB Postgres Advanced Server node. When the context menu opens, select Connect Server .
According to https://www.pgadmin.org/download/pip4.php.
Install the virtualenv by running:
sudo apt-get install virtualenv
You also need to install these 2 libraries:
sudo apt-get install libpq-dev python-dev
Then:
cd ~/bin/
virtualenv pgadmin4
I prefer to use the ~/bin/
directory for installing applications.
Then you download the pgadmin4-1.1-py2-none-any.whl
or pgadmin4-1.1-py3-none-any.whl
depending on the python version you use. For this example we use python 2.7.
You download pgadmin4:
wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.1/pip/pgadmin4-1.1-py2-none-any.whl
Activate the virtualenv:
. ~/bin/pgadmin4/bin/activate
After that you will see (pgadmin4)
in the terminal.
Inside of pgadmin4 run:
pip install ./pgadmin4-1.1-py2-none-any.whl
After that you must be able to run pgadmin4:
python ~/bin/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
In order to make the running process a bit easier you can create an alias. For instance, in Ubuntu 16.04 LTS, add alias in the ~/.bash_aliases
file:
alias pgadmin4='. /home/your_username/bin/pgadmin4/bin/activate; /home/your_username/bin/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py'
Where your_username
should be replaced by your real user name.
Then give execute permission, for example, 764
to the pgAdmin4.py
file in:
/home/your_username/bin/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
Also you need to edit the pgAdmin4.py
file and add this line in the very top:
#!/home/your_username/bin/pgadmin4/bin/python
where your_username
is your real user name.
This will make sure that you run the application using the required version of python and include all necessary dependencies in order to run pgadmin4
.
Then run . ~/.bashrc
in order to apply the changes.
So now you can open your terminal and simply type pgadmin4
in order to run it.
Open your browser and point to:
http://127.0.0.1:5050
One more thing to note - if you need to run pgadmin4
in desktop mode you need to change SERVER_MODE
to False in:
/home/your_username/bin/pgadmin4/lib/python2.7/site-packages/pgadmin4/config.py
Otherwise when you visit localhost:5050 it will ask you for your login and password.
UDPATE:
As of 2021 (and significantly earlier) a much better option would be to use a preconfigured docker container with pgadmin4 on it. For example, a pgadmin4 docker image can be downloaded from https://hub.docker.com/r/dpage/pgadmin4/.
Hope this helps.
After following the documentation on adding PgAdmin 4 to my Fedora 28 failed in every possible way I went with the Docker option:
mkdir ~/.pgadmin4 # to store config and stuff
docker run -d --rm --network host -v ~/.pgadmin4:/pgadmin thajeztah/pgadmin4
Then go to http://localhost:5050 and you are done with it.
See https://github.com/thaJeztah/pgadmin4-docker for more info.
Please, try these commands:
sudo apt-get install pgadmin4
sudo python3.5 /usr/share/pgadmin4/web/pgAdmin4.py
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With