Showing results for 
Search instead for 
Did you mean: 

PG Admin 4 python error


PG Admin 4 python error

When installing PG Admin4 v2 I was issuing the command to run the script in the pgadmin4-web directory. When running, it generated the following error 


Traceback (most recent call last):
File "", line 15, in <module>
from pgadmin.model import db, Version, SCHEMA_VERSION as CURRENT_SCHEMA_VERSION
File "/usr/lib/python2.7/site-packages/pgadmin4-web/pgadmin/", line 20, in <module>
from flask_security import Security, SQLAlchemyUserDatastore, current_user
File "/usr/lib/python2.7/site-packages/pgadmin4-web/flask_security/", line 13, in <module>
from .core import Security, RoleMixin, UserMixin, AnonymousUser, current_user
File "/usr/lib/python2.7/site-packages/pgadmin4-web/flask_security/", line 18, in <module>
from flask_babelex import Domain
ImportError: No module named flask_babelex


I have verified that I have the correct version of python installed as well as added to my PATH. It seems that no matter what I do, the script will not run. 

EDB Team Member

Re: PG Admin 4 python error

Hi billabyte,

There seems to be issue with the python installation.

Can you check on the below

1.Is the python installed correctly.Can you check if there are any dependent packages that should be are missing?
2.Is the path for python set properly.
3.What is the environment where you are installing the PgAdmin4.

Secondly, the error for flask_babelex points to the package not available.

Can you check whether flask has been installed.


Re: PG Admin 4 python error

1) I have examined and discovered I had python 2.7 and python 3 installed... but only 2.7 is in use 


2)python 2.7 is properly in path


3)this is centos 7 


4) do you know the specific yum install command for babelex ? I am fairly sure that flask is installed 

EDB Team Member

Re: PG Admin 4 python error

Hi @billabyte,


As it is a python library you can install it using pip :


pip install flask_babel


If you still face the issue as pointed out by one of our developers on the stack overflow, could you please try following :

Provide proper permission to the directory by the following commands :


sudo mkdir "/var/log/pgadmin" 
sudo chmod a+wrx "/var/log/pgadmin" 
sudo mkdir "/var/lib/pgadmin" 
sudo chmod a+wrx "/var/lib/pgadmin"

And then run the pgAdmin4 without sudo

cd pgadmin4
source bin/activate
python ~/pgadmin4/lib/python2.7/site-packages/pgadmin4/