0

I am new for pgadmin4.

I have installed python 3.6. I try to install pgAdmin4 with this guide.

But I am not able to run the pgadmin.

Here are the commands I ran with the error messages:

(pgadmin4) vadivel@vadivel:~/pgadmin4$ cd ~/pgadmin4
(pgadmin4) vadivel@vadivel:~/pgadmin4$ source bin/activate
(pgadmin4) vadivel@vadivel:~/pgadmin4$ python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py
/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
  """)
Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.

Errors:

Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/socketserver.py", line 641, in process_request_thread
    self.handle_error(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 200, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 235, in handle_one_request
    return self.run_wsgi()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1634, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1660, in try_trigger_before_first_request_functions
    func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/utils/__init__.py", line 43, in create_module_preference
    self.register_preferences()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/__init__.py", line 208, in register_preferences
    gettext("Show system objects?"), 'boolean', False,
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 539, in gettext
    t = get_translations()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 216, in get_translations
    catalog = support.Translations.load(dirname, [get_locale()])
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 244, in get_locale
    rv = babel.locale_selector_func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 269, in get_locale
    'miscellaneous', 'user_language', None, user_id
UnboundLocalError: local variable 'user_id' referenced before assignment

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/socketserver.py", line 641, in process_request_thread
    self.handle_error(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 200, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 235, in handle_one_request
    return self.run_wsgi()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1634, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1660, in try_trigger_before_first_request_functions
    func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/utils/__init__.py", line 43, in create_module_preference
    self.register_preferences()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/__init__.py", line 208, in register_preferences
    gettext("Show system objects?"), 'boolean', False,
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 539, in gettext
    t = get_translations()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 216, in get_translations
    catalog = support.Translations.load(dirname, [get_locale()])
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 244, in get_locale
    rv = babel.locale_selector_func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 269, in get_locale
    'miscellaneous', 'user_language', None, user_id
UnboundLocalError: local variable 'user_id' referenced before assignment

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/socketserver.py", line 641, in process_request_thread
    self.handle_error(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 200, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 235, in handle_one_request
    return self.run_wsgi()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1634, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1660, in try_trigger_before_first_request_functions
    func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/utils/__init__.py", line 43, in create_module_preference
    self.register_preferences()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/__init__.py", line 208, in register_preferences
    gettext("Show system objects?"), 'boolean', False,
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 539, in gettext
    t = get_translations()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 216, in get_translations
    catalog = support.Translations.load(dirname, [get_locale()])
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 244, in get_locale
    rv = babel.locale_selector_func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 269, in get_locale
    'miscellaneous', 'user_language', None, user_id
UnboundLocalError: local variable 'user_id' referenced before assignment

Exception in thread Thread-4:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.6/socketserver.py", line 641, in process_request_thread
    self.handle_error(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 696, in __init__
    self.handle()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 200, in handle
    rv = BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.6/http/server.py", line 418, in handle
    self.handle_one_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 235, in handle_one_request
    return self.run_wsgi()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 177, in run_wsgi
    execute(self.server.app)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/werkzeug/serving.py", line 165, in execute
    application_iter = app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1567, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1634, in full_dispatch_request
    self.try_trigger_before_first_request_functions()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask/app.py", line 1660, in try_trigger_before_first_request_functions
    func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/utils/__init__.py", line 43, in create_module_preference
    self.register_preferences()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/browser/__init__.py", line 208, in register_preferences
    gettext("Show system objects?"), 'boolean', False,
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 539, in gettext
    t = get_translations()
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 216, in get_translations
    catalog = support.Translations.load(dirname, [get_locale()])
  File "/home/vadivel/pgadmin4/local/lib/python3.6/site-packages/flask_babel/__init__.py", line 244, in get_locale
    rv = babel.locale_selector_func()
  File "/home/vadivel/pgadmin4/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 269, in get_locale
    'miscellaneous', 'user_language', None, user_id
UnboundLocalError: local variable 'user_id' referenced before assignment
1

Had the same problem, from a quick look I saw the code was going into this part to determine the language and only when 'SERVER_MODE' was set to False. I removed the line from the config and it works. I'm sure there is a better solution but this can help in the meantime.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.