Обсуждение: pgadmin4 and Python3

Поиск
Список
Период
Сортировка

pgadmin4 and Python3

От
Dmitry Voronin
Дата:
Hello, Dave and pgadmin team.

Two questions.

Will any versions of pgadmin3 be released in the future?

I want run padmin4 as desktop application. So, I compled runtime part and run it. Pgadmin4 tell me to enter Python Bin
pathand application path. I entered it, but it is not helpful for me.
 
I sucessfully run pgadmin4 as web applicaion by confiugre and install requirements for Python3.
Can you tell me how run pgadmin4 as desktop application more in details please?

-- 
Best regards, Dmitry Voronin



Re: pgadmin4 and Python3

От
Dave Page
Дата:
Hi

On Sat, Jun 11, 2016 at 6:10 PM, Dmitry Voronin
<carriingfate92@yandex.ru> wrote:
> Hello, Dave and pgadmin team.
>
> Two questions.
>
> Will any versions of pgadmin3 be released in the future?

Extremely unlikely.

> I want run padmin4 as desktop application. So, I compled runtime part and run it. Pgadmin4 tell me to enter Python
Binpath and application path. I entered it, but it is not helpful for me.
 
> I sucessfully run pgadmin4 as web applicaion by confiugre and install requirements for Python3.
> Can you tell me how run pgadmin4 as desktop application more in details please?

The runtime will search for pgAdmin4.py in various places that it
expects it might find it (for example, where it would be in a Mac
Appbundle, a Windows installation or a development tree). If you have
it somewhere else, you can enter the directory containing pgAdmin4.py
in the configuration (don't include the filename, just the directory
path). This is done in Server::Init() in Server.cpp of the runtime if
you want to look at the logic.

The runtime will also do a search (albeit much smaller) for a Python
virtual environment containing the Python dependencies for the app. If
needed, you can set this to the site-packages directory within the
virtual environment which will allow the runtime to find all the
dependencies; for example, on my machine that would be
/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/. This
is handled in Server::Server(quint16 port) in Server.cpp of the
runtime.


-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Re: pgadmin4 and Python3

От
Дмитрий Воронин
Дата:
11.06.2016, 20:24, "Dave Page" <dpage@pgadmin.org>:

>
>>  I want run padmin4 as desktop application. So, I compled runtime part and run it. Pgadmin4 tell me to enter Python
Binpath and application path. I entered it, but it is not helpful for me.
 
>>  I sucessfully run pgadmin4 as web applicaion by confiugre and install requirements for Python3.
>>  Can you tell me how run pgadmin4 as desktop application more in details please?
>
> The runtime will search for pgAdmin4.py in various places that it
> expects it might find it (for example, where it would be in a Mac
> Appbundle, a Windows installation or a development tree). If you have
> it somewhere else, you can enter the directory containing pgAdmin4.py
> in the configuration (don't include the filename, just the directory
> path). This is done in Server::Init() in Server.cpp of the runtime if
> you want to look at the logic.
>
> The runtime will also do a search (albeit much smaller) for a Python
> virtual environment containing the Python dependencies for the app. If
> needed, you can set this to the site-packages directory within the
> virtual environment which will allow the runtime to find all the
> dependencies; for example, on my machine that would be
> /Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/. This
> is handled in Server::Server(quint16 port) in Server.cpp of the
> runtime.
>

Ok, I try running pgadmin4 application on Ubuntu 15.10. I extract sources of padmin4 to /home/developer/pgadmin4. 
Next, I create python virtual environment located at /home/developer/pgadmin4/venv and set all requirements from
requirements_py3.txt.
Try to run application as web:

/home/developer/pgadmin4/venv/bin/python3.4 /home/developer/pgadmin4/web/pgAdmin4.py

It's works fine.

Next, I build runtime part with Qt5, set Python path as

/home/developer/pgadmin4/venv/bin/python3.4;/home/developer/pgadmin4/venv/lib/python3.4/site-packages

and application path as

/home/developer/pgadmin4/web/

But it's not work: Failed to launch the application server, server thread exiting.

What I am doing wrong?

-- 
Best regards, Dmitry Voronin



Re: pgadmin4 and Python3

От
Neel Patel
Дата:
Hi,

As you said, PYTHONPATH is set but from the error it looks like application is not able to get the python path.
Can you please export the PYTHONPATH variable to "/home/developer/pgadmin4/venv/lib/python3.4/site-packages" and run the application from where the path is exported.

e.g.
export PYTHONPATH=/home/developer/pgadmin4/venv/lib/python3.4/site-packages

Let us know the output.

Thanks,
Neel Patel


On Tue, Jun 14, 2016 at 11:56 AM, Дмитрий Воронин <carriingfate92@yandex.ru> wrote:
11.06.2016, 20:24, "Dave Page" <dpage@pgadmin.org>:

>
>>  I want run padmin4 as desktop application. So, I compled runtime part and run it. Pgadmin4 tell me to enter Python Bin path and application path. I entered it, but it is not helpful for me.
>>  I sucessfully run pgadmin4 as web applicaion by confiugre and install requirements for Python3.
>>  Can you tell me how run pgadmin4 as desktop application more in details please?
>
> The runtime will search for pgAdmin4.py in various places that it
> expects it might find it (for example, where it would be in a Mac
> Appbundle, a Windows installation or a development tree). If you have
> it somewhere else, you can enter the directory containing pgAdmin4.py
> in the configuration (don't include the filename, just the directory
> path). This is done in Server::Init() in Server.cpp of the runtime if
> you want to look at the logic.
>
> The runtime will also do a search (albeit much smaller) for a Python
> virtual environment containing the Python dependencies for the app. If
> needed, you can set this to the site-packages directory within the
> virtual environment which will allow the runtime to find all the
> dependencies; for example, on my machine that would be
> /Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/. This
> is handled in Server::Server(quint16 port) in Server.cpp of the
> runtime.
>

Ok, I try running pgadmin4 application on Ubuntu 15.10. I extract sources of padmin4 to /home/developer/pgadmin4.
Next, I create python virtual environment located at /home/developer/pgadmin4/venv and set all requirements from requirements_py3.txt.
Try to run application as web:

/home/developer/pgadmin4/venv/bin/python3.4 /home/developer/pgadmin4/web/pgAdmin4.py

It's works fine.

Next, I build runtime part with Qt5, set Python path as

/home/developer/pgadmin4/venv/bin/python3.4;/home/developer/pgadmin4/venv/lib/python3.4/site-packages

and application path as

/home/developer/pgadmin4/web/

But it's not work: Failed to launch the application server, server thread exiting.

What I am doing wrong?

-- 
Best regards, Dmitry Voronin


--
Sent via pgadmin-support mailing list (pgadmin-support@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-support

Re: pgadmin4 and Python3

От
Дмитрий Воронин
Дата:
 
 
14.06.2016, 09:37, "Neel Patel" <neel.patel@enterprisedb.com>:
Hi,
 
As you said, PYTHONPATH is set but from the error it looks like application is not able to get the python path.
Can you please export the PYTHONPATH variable to "/home/developer/pgadmin4/venv/lib/python3.4/site-packages" and run the application from where the path is exported.
 
e.g.
export PYTHONPATH=/home/developer/pgadmin4/venv/lib/python3.4/site-packages
 
Let us know the output.
 
Thanks,
Neel Patel
 
 
Thank you for answer. It's works. But why pgadmin4 does not set PYTHONPATH after dialog?
 
But when I run pgadmin4 as desktop I see Python Exception Trace. (I use Python 3.4):
 
Traceback (most recent call last):
  File "/home/developer/pgadmin4/web/pgAdmin4.py", line 24, in <module>
    from pgadmin import create_app
  File "/home/developer/pgadmin4/web/pgadmin/__init__.py", line 13, in <module>
    from flask import Flask, abort, request, current_app
  File "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/flask/__init__.py", line 17, in <module>
    from werkzeug.exceptions import abort
  File "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/werkzeug/__init__.py", line 154, in <module>
    __import__('werkzeug.exceptions')
  File "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/werkzeug/exceptions.py", line 71, in <module>
    from werkzeug.wrappers import Response
  File "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/werkzeug/wrappers.py", line 26, in <module>
    from werkzeug.http import HTTP_STATUS_CODES, \
  File "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/werkzeug/http.py", line 26, in <module>
    from urllib2 import parse_http_list as _parse_list_header
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 2164, in _find_spec
  File "<frozen importlib._bootstrap>", line 1940, in find_spec
  File "<frozen importlib._bootstrap>", line 1914, in _get_spec
  File "<frozen importlib._bootstrap>", line 2049, in find_spec
  File "<frozen importlib._bootstrap>", line 53, in _path_join
  File "<frozen importlib._bootstrap>", line 53, in <listcomp>
TypeError: 'str' does not support the buffer interface
"Failed to launch the application server, server thread exiting."

All packages were installed from requirements_py3.txt via pip3.4 install -r requirements_py3.txt. After depends installing I  copy web/config.py to web/config_local.py and run /home/developer/pgadmin4/venv/bin/python3.4 web/setup.py for initialization
 
-- 
Best regards, Dmitry Voronin
 
Traceback (most recent call last):
  File "/home/developer/pgadmin4-1.0-beta1/web/pgAdmin4.py", line 24, in <module>
    from pgadmin import create_app
  File "/home/developer/pgadmin4-1.0-beta1/web/pgadmin/__init__.py", line 13, in <module>
    from flask import Flask, abort, request, current_app
  File "/home/developer/pgadmin4-1.0-beta1/venv/lib/python3.4/site-packages/flask/__init__.py", line 17, in <module>
    from werkzeug.exceptions import abort
  File "/home/developer/pgadmin4-1.0-beta1/venv/lib/python3.4/site-packages/werkzeug/__init__.py", line 154, in <module>
    __import__('werkzeug.exceptions')
  File "/home/developer/pgadmin4-1.0-beta1/venv/lib/python3.4/site-packages/werkzeug/exceptions.py", line 71, in <module>
    from werkzeug.wrappers import Response
  File "/home/developer/pgadmin4-1.0-beta1/venv/lib/python3.4/site-packages/werkzeug/wrappers.py", line 26, in <module>
    from werkzeug.http import HTTP_STATUS_CODES, \
  File "/home/developer/pgadmin4-1.0-beta1/venv/lib/python3.4/site-packages/werkzeug/http.py", line 26, in <module>
    from urllib2 import parse_http_list as _parse_list_header
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2222, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 2164, in _find_spec
  File "<frozen importlib._bootstrap>", line 1940, in find_spec
  File "<frozen importlib._bootstrap>", line 1914, in _get_spec
  File "<frozen importlib._bootstrap>", line 2049, in find_spec
  File "<frozen importlib._bootstrap>", line 53, in _path_join
  File "<frozen importlib._bootstrap>", line 53, in <listcomp>
TypeError: 'str' does not support the buffer interface
"Failed to launch the application server, server thread exiting."

Re: pgadmin4 and Python3

От
Dave Page
Дата:
Hi

On Tue, Jun 14, 2016 at 7:47 AM, Дмитрий Воронин
<carriingfate92@yandex.ru> wrote:
>
>
> 14.06.2016, 09:37, "Neel Patel" <neel.patel@enterprisedb.com>:
>
> Hi,
>
> As you said, PYTHONPATH is set but from the error it looks like application
> is not able to get the python path.
> Can you please export the PYTHONPATH variable to
> "/home/developer/pgadmin4/venv/lib/python3.4/site-packages" and run the
> application from where the path is exported.
>
> e.g.
> export PYTHONPATH=/home/developer/pgadmin4/venv/lib/python3.4/site-packages
>
> Let us know the output.
>
> Thanks,
> Neel Patel
>
>
>
> Thank you for answer. It's works. But why pgadmin4 does not set PYTHONPATH
> after dialog?

Laziness on my part mostly. It would require a fairly significant
amount of refactoring to restart everything after the dialog is shown,
and at the moment we just exit and let the user restart after setting
the path.

You most definitely shouldn't have to set PYTHONPATH in the environment though.

> But when I run pgadmin4 as desktop I see Python Exception Trace. (I use
> Python 3.4):
>
> Traceback (most recent call last):
>   File "/home/developer/pgadmin4/web/pgAdmin4.py", line 24, in <module>
>     from pgadmin import create_app
>   File "/home/developer/pgadmin4/web/pgadmin/__init__.py", line 13, in
> <module>
>     from flask import Flask, abort, request, current_app
>   File
> "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/flask/__init__.py",
> line 17, in <module>
>     from werkzeug.exceptions import abort
>   File
> "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/werkzeug/__init__.py",
> line 154, in <module>
>     __import__('werkzeug.exceptions')
>   File
> "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/werkzeug/exceptions.py",
> line 71, in <module>
>     from werkzeug.wrappers import Response
>   File
> "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/werkzeug/wrappers.py",
> line 26, in <module>
>     from werkzeug.http import HTTP_STATUS_CODES, \
>   File
> "/home/developer/pgadmin4/venv/lib/python3.4/site-packages/werkzeug/http.py",
> line 26, in <module>
>     from urllib2 import parse_http_list as _parse_list_header
>   File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 2222, in
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 2164, in _find_spec
>   File "<frozen importlib._bootstrap>", line 1940, in find_spec
>   File "<frozen importlib._bootstrap>", line 1914, in _get_spec
>   File "<frozen importlib._bootstrap>", line 2049, in find_spec
>   File "<frozen importlib._bootstrap>", line 53, in _path_join
>   File "<frozen importlib._bootstrap>", line 53, in <listcomp>
> TypeError: 'str' does not support the buffer interface
> "Failed to launch the application server, server thread exiting."

A fix for that issue is in testing - see
https://www.postgresql.org/message-id/CACbbB7hdN=04qpMt1MKiz2ZEM4UXzniphQN76X=5A2i3bemHLw@mail.gmail.com


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company