[jira] [Commented] (PROTON-2550) [python-binding] setup.py install does not create module directory when using --prefix
[ https://issues.apache.org/jira/browse/PROTON-2550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17542639#comment-17542639 ] Jiri Daněk commented on PROTON-2550: Maybe add {{--single-version-externally-managed}} to setup.py execution. It helped in the router with a similar problem, https://github.com/skupperproject/skupper-router/commit/d92f53e923ed7b9fd06070513309d31888a5610b > [python-binding] setup.py install does not create module directory when using > --prefix > -- > > Key: PROTON-2550 > URL: https://issues.apache.org/jira/browse/PROTON-2550 > Project: Qpid Proton > Issue Type: Bug > Components: python-binding >Reporter: Kim van der Riet >Assignee: Andrew Stitcher >Priority: Major > > After building proton, installing the python bindings using the generated > *{{setup.py}}* does not create all of the necessary directories when used > with the *{{--prefix}}* option. In particular, a directory using the module > name *{{proton}}* is missing. > The following install command from the cmake build directory: > {noformat} > $ export PYTHONPATH=/tmp/lib64/python3.10/site-packages > $ cd python/dist/ > $ python setup.py install --prefix /tmp > $ ls -l /tmp/lib64/python3.10/site-packages/ > total 3 > -rw-rw-r--. 1 kvdr kvdr 57 May 26 11:58 easy-install.pth > drwxrwxr-x. 5 kvdr kvdr 160 May 26 11:58 > python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg > {noformat} > produces a single {{python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg}} > directory (and a {{easy-install.pth}} file if the {{PYTHONPATH}} is set prior > to the install). > This is insufficient to use module proton, even with the PYTHONPATH set: > {noformat} > $ cd ~ # Exit from dist directory which contains python install artifacts > $ echo $PYTHONPATH > /tmp/lib64/python3.10/site-packages > $ python > >>> import proton > Traceback (most recent call last): > File "", line 1, in > ModuleNotFoundError: No module named 'proton' > >>> > {noformat} > However, a workaround exists by adding a symbolic link *{{proton}}* pointing > to the .egg directory: > {noformat} > $ cd /tmp/lib64/python3.10/site-packages/ > $ ln -s python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg proton > $ cd ~ # Exit from dist directory which contains python install artifacts > $ python > >>> import proton > >>> proton.__path__ > _NamespacePath(['/tmp/lib64/python3.10/site-packages/proton']) > {noformat} -- This message was sent by Atlassian Jira (v8.20.7#820007) - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[jira] [Commented] (PROTON-2550) [python-binding] setup.py install does not create module directory when using --prefix
[ https://issues.apache.org/jira/browse/PROTON-2550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17542634#comment-17542634 ] Kim van der Riet commented on PROTON-2550: -- The success of the system install may lie in the easy-install.pth file that is created in the site-packages directory. According to the Python documentation[1], the contents of this file are added to sys.path: {quote}It starts by constructing up to four directories from a head and a tail part. For the head part, it uses {{sys.prefix}} and {{{}sys.exec_prefix{}}}; empty heads are skipped. For the tail part, it uses the empty string and then {{lib/site-packages}} (on Windows) or {{lib/pythonX.Y/site-packages}} and then {{lib/site-python}} (on Unix and Macintosh). For each of the distinct head-tail combinations, it sees if it refers to an existing directory, and if so, adds it to sys.path and also inspects the newly added path for configuration files. A path configuration file is a file whose name has the form name.pth and exists in one of the four directories mentioned above; its contents are additional items (one per line) to be added to sys.path. Non-existing items are never added to sys.path, and no check is made that the item refers to a directory rather than a file. No item is added to sys.path more than once. Blank lines and lines beginning with # are skipped. Lines starting with import (followed by space or tab) are executed. {quote} I notice that the path tail combinations for Unix do not include {{{}lib64{}}}, only {{{}lib{}}}. I wonder if this is contributing to the failure to find the {{.pth}} file for local installs. For that matter, it would not work for system installs either. [1] [https://docs.python.org/2/library/site.html] > [python-binding] setup.py install does not create module directory when using > --prefix > -- > > Key: PROTON-2550 > URL: https://issues.apache.org/jira/browse/PROTON-2550 > Project: Qpid Proton > Issue Type: Bug > Components: python-binding >Reporter: Kim van der Riet >Assignee: Andrew Stitcher >Priority: Major > > After building proton, installing the python bindings using the generated > *{{setup.py}}* does not create all of the necessary directories when used > with the *{{--prefix}}* option. In particular, a directory using the module > name *{{proton}}* is missing. > The following install command from the cmake build directory: > {noformat} > $ export PYTHONPATH=/tmp/lib64/python3.10/site-packages > $ cd python/dist/ > $ python setup.py install --prefix /tmp > $ ls -l /tmp/lib64/python3.10/site-packages/ > total 3 > -rw-rw-r--. 1 kvdr kvdr 57 May 26 11:58 easy-install.pth > drwxrwxr-x. 5 kvdr kvdr 160 May 26 11:58 > python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg > {noformat} > produces a single {{python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg}} > directory (and a {{easy-install.pth}} file if the {{PYTHONPATH}} is set prior > to the install). > This is insufficient to use module proton, even with the PYTHONPATH set: > {noformat} > $ cd ~ # Exit from dist directory which contains python install artifacts > $ echo $PYTHONPATH > /tmp/lib64/python3.10/site-packages > $ python > >>> import proton > Traceback (most recent call last): > File "", line 1, in > ModuleNotFoundError: No module named 'proton' > >>> > {noformat} > However, a workaround exists by adding a symbolic link *{{proton}}* pointing > to the .egg directory: > {noformat} > $ cd /tmp/lib64/python3.10/site-packages/ > $ ln -s python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg proton > $ cd ~ # Exit from dist directory which contains python install artifacts > $ python > >>> import proton > >>> proton.__path__ > _NamespacePath(['/tmp/lib64/python3.10/site-packages/proton']) > {noformat} -- This message was sent by Atlassian Jira (v8.20.7#820007) - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org
[jira] [Commented] (PROTON-2550) [python-binding] setup.py install does not create module directory when using --prefix
[ https://issues.apache.org/jira/browse/PROTON-2550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17542585#comment-17542585 ] Kim van der Riet commented on PROTON-2550: -- I did a check on what happens if the install is used without the *{{--prefix}}* option. In this case, the identical directory structure is created in {*}{{/usr/local/lib64}}{*}. And with no *{{PYTHONPATH}}* set, python finds the proton module ok: {noformat} $ unset PYTHONPATH $ cd python/dist/ $ python setup.py install # Tried non-root install first ... The following error occurred while trying to add or remove files in the installation directory: [Errno 13] Permission denied: '/usr/local/lib64/python3.10' ... $ sudo python setup.py install ... $ ll /usr/local/lib64/python3.10/site-packages/ total 8 -rw-r--r--. 1 root root 57 May 26 12:36 easy-install.pth drwxr-xr-x. 5 root root 4096 May 26 12:36 python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg $ cd ~ # Exit from dist directory which contains python install artifacts $ python >>> import proton >>> proton.__path__ ['/usr/local/lib64/python3.10/site-packages/python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg/proton'] >>> {noformat} So it seems that a local install does not work with a PYTHONPATH set, but with system install which uses the same directory structure in a system location, python finds the proton directory within the .egg directory. What are we missing? How do we make local installs work? > [python-binding] setup.py install does not create module directory when using > --prefix > -- > > Key: PROTON-2550 > URL: https://issues.apache.org/jira/browse/PROTON-2550 > Project: Qpid Proton > Issue Type: Bug > Components: python-binding >Reporter: Kim van der Riet >Assignee: Andrew Stitcher >Priority: Major > > After building proton, installing the python bindings using the generated > *{{setup.py}}* does not create all of the necessary directories when used > with the *{{--prefix}}* option. In particular, a directory using the module > name *{{proton}}* is missing. > The following install command from the cmake build directory: > {noformat} > $ export PYTHONPATH=/tmp/lib64/python3.10/site-packages > $ cd python/dist/ > $ python setup.py install --prefix /tmp > $ ls -l /tmp/lib64/python3.10/site-packages/ > total 3 > -rw-rw-r--. 1 kvdr kvdr 57 May 26 11:58 easy-install.pth > drwxrwxr-x. 5 kvdr kvdr 160 May 26 11:58 > python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg > {noformat} > produces a single {{python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg}} > directory (and a {{easy-install.pth}} file if the {{PYTHONPATH}} is set prior > to the install). > This is insufficient to use module proton, even with the PYTHONPATH set: > {noformat} > $ cd ~ # Exit from dist directory which contains python install artifacts > $ echo $PYTHONPATH > /tmp/lib64/python3.10/site-packages > $ python > >>> import proton > Traceback (most recent call last): > File "", line 1, in > ModuleNotFoundError: No module named 'proton' > >>> > {noformat} > However, a workaround exists by adding a symbolic link *{{proton}}* pointing > to the .egg directory: > {noformat} > $ cd /tmp/lib64/python3.10/site-packages/ > $ ln -s python_qpid_proton-0.38.0.dev0-py3.10-linux-x86_64.egg proton > $ cd ~ # Exit from dist directory which contains python install artifacts > $ python > >>> import proton > >>> proton.__path__ > _NamespacePath(['/tmp/lib64/python3.10/site-packages/proton']) > {noformat} -- This message was sent by Atlassian Jira (v8.20.7#820007) - To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org