zatosource / zato

ESB, SOA, REST, APIs and Cloud Integrations in Python
https://zato.io
GNU Affero General Public License v3.0
1.1k stars 239 forks source link

Installing Zato 3.2 with python 3.8 on Centos 8 #1166

Closed m3nowak closed 2 years ago

m3nowak commented 3 years ago

Hello,

I've been trying to install zato 3.2 on Centos 8 with python 3.8. Unfortunately, installation performed according to https://zato.io/docs/3.2/admin/guide/install/rhel.html results in installation of python 3.6, which is then used as an interpreter for zato. Even if I install python 3.8 beforehand, yum installs version 3.6 anyway. Is there any way to force python version without resorting to installation from source code? Or can we hope for separate RPM releases for python 3.6 and 3.8?

Thanks.

dsuch commented 3 years ago

Hello,

this is an interesting use case but I am not sure how to tackle it today.

On the one hand, the RPM is generally geared towards users of RHEL which, as a whole, prefer to use what the system comes with.

On the other hand, I understand the need to use a newer Python version and in such cases people usually prefer to use Ubuntu which is on par with RHEL these days in terms of long term support but comes with newer versions of packages.

Installing from source is always an option to consider. When you install an .rpm or .deb you are merely installing a pre-compiled git clone under a virtualenv instance.

You can also build your own .rpm or .deb package using a specific version of Python.

Finally, soon, you will be able to use natively Zato under Windows and that will support the latest versions of Python as well.

I am not sure what your preferences are?

Regards.

m3nowak commented 3 years ago

Hi,

Official CentOS (and probably RHEL) repositories contain python several python versions: 3.6, 3.8 and 3.9. From what I understand, python 3.6 is installed because it is the default 'python3' option. My main concern is running zato on supported python version and support of 3.6 ends in December. I also want to use some of the "new" language features such as dataclasses. Building 3 packages for each python version seems to be the best solution in my opinion. Also using RPM installation generally is simpler than repository install and, from my experience, those installations have fewer problems. I will try to modify the build process and will submit PR if successful, but I cannot make any promises.

Regards.

dsuch commented 3 years ago

When you say that CentOS repositories contain packages for Python 3.8 or newer, do you mean default repositories that are available right after installing the OS, as it is available via https://centos.org, without enabling CodeReady of its equivalent under CentOS? If so, can you tell what the name of the repository is?

To build an .rpm package, the build-zato.sh script is invoked as such:

$ ./build-zato.sh support/3.2 python3 3.2

It is the second option - here it is python3 - that points to an executable to use to build the package and apparently under RHEL 8 the "python3" command is an alias to "python36".

If python38 was available through default channels under RHEL and CentOS, I would see no issues with rebuilding the package to settle on 3.8 instead of 3.6.

The only matter is the availability of the package, if it can be installed without the need for extra repositories.

I have checked it under RHEL 8.4 and it looks it is. Does the same hold for CentOS?

$ sudo yum info python38
Name         : python38
Version      : 3.8.6
Release      : 3.module+el8.4.0+9579+e9717e18
Architecture : x86_64
Size         : 79 k
Source       : python38-3.8.6-3.module+el8.4.0+9579+e9717e18.src.rpm
Repository   : rhel-8-appstream-rhui-rpms
m3nowak commented 3 years ago

Yes, python3.8 is available in default CentOS repos, but it requires enabling python38 module stream. Fortunately using "yum install python38" does that for you.

xxx@localhost ~/Dev> podman run -it --rm centos:8
[root@a28c663f1f0d /]# yum info python38
Failed to set locale, defaulting to C.UTF-8
CentOS Linux 8 - AppStream                                4.5 MB/s | 8.8 MB     00:01    
CentOS Linux 8 - BaseOS                                   5.0 MB/s | 6.5 MB     00:01    
CentOS Linux 8 - Extras                                    17 kB/s |  10 kB     00:00    
Available Packages
Name         : python38
Version      : 3.8.6
Release      : 3.module_el8.4.0+665+abc3a503
Architecture : x86_64
Size         : 79 k
Source       : python38-3.8.6-3.module_el8.4.0+665+abc3a503.src.rpm
Repository   : appstream
Summary      : Interpreter of the Python programming language
URL          : https://www.python.org/
License      : Python
Description  : Python is an accessible, high-level, dynamically typed, interpreted
             : programming language, designed with an emphasis on code readability.
             : It includes an extensive standard library, and has a vast ecosystem of
             : third-party libraries.
             : 
             : The python38 package provides the "python3" executable: the reference
             : interpreter for the Python language, version 3.
             : The majority of its standard library is provided in the python38-libs
             : package, which should be installed automatically along with python38.
             : The remaining parts of the Python standard library are broken out into the
             : python38-tkinter and python38-test packages, which may need to be installed
             : separately.
             : 
             : Documentation for Python is provided in the python38-docs package.
             : 
             : Packages containing additional libraries for Python are generally named
             : with the "python38-" prefix.
             : 
             : For the unversioned "python" executable, see manual page
             : "unversioned-python".

[root@a28c663f1f0d /]# yum install python38
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:00:17 ago on Thu Sep  9 17:36:28 2021.
Dependencies resolved.
==========================================================================================
 Package                   Arch   Version                                 Repo       Size
==========================================================================================
Installing:
 python38                  x86_64 3.8.6-3.module_el8.4.0+665+abc3a503     appstream  79 k
Installing dependencies:
 python38-libs             x86_64 3.8.6-3.module_el8.4.0+665+abc3a503     appstream 8.3 M
 python38-pip-wheel        noarch 19.3.1-1.module_el8.4.0+647+0ba99ce8    appstream 1.2 M
 python38-setuptools-wheel noarch 41.6.0-4.module_el8.4.0+647+0ba99ce8    appstream 304 k
Installing weak dependencies:
 python38-pip              noarch 19.3.1-1.module_el8.4.0+647+0ba99ce8    appstream 1.9 M
 python38-setuptools       noarch 41.6.0-4.module_el8.4.0+647+0ba99ce8    appstream 667 k
Enabling module streams:
 python38                         3.8                                                    

Transaction Summary
==========================================================================================
Install  6 Packages

Total download size: 12 M
Installed size: 45 M
dsuch commented 3 years ago

Thank you, that looks good. As long as yum handles all the dependencies itself, that will work.

If there are no obstacles along the way, I should be able to follow up within a few weeks with a confirmation that this is done.

In the meantime, I recommend that you build your own .rpm using the build-zato.sh script I linked to earlier.

dsuch commented 2 years ago

I am writing to let you know that, due to other commitments, I will not able to work on this ticket in the nearest time.

Per one of the comments above, please build an RPM for Python 3.8 using the scripts from zato-build.

dsuch commented 2 years ago

This is done - Zato 3.2 now requires Python 3.8 under RHEL / CentOS 8.x - https://zato.io/docs/admin/guide/install/rhel.html