vitabaks / postgresql_cluster

PostgreSQL High-Availability Cluster (based on "Patroni" and DCS "etcd" or "consul"). Automating with Ansible.
MIT License
1.29k stars 352 forks source link

Add support for Ubuntu 24.04 #642

Open vitabaks opened 2 weeks ago

vitabaks commented 2 weeks ago

Add support for Ubuntu 24.04

Postponed. There is a problem with the compatibility of the pip requirements with Python 3.12

fatal: [10.172.0.20]: FAILED! => {"changed": false, "cmd": ["/usr/bin/pip3", "install", "--trusted-host=pypi.python.org", "--trusted-host=pypi.org", "--trusted-host=files.pythonhosted.org", "-r", "/tmp/requirements.txt"], "msg": "stdout: Collecting urllib3>=1.25.9 (from -r /tmp/requirements.txt (line 1))\n  Downloading urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)\nCollecting boto3 (from -r /tmp/requirements.txt (line 2))\n  Downloading boto3-1.34.92-py3-none-any.whl.metadata (6.6 kB)\nRequirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 3)) (6.0.1)\nCollecting requests>=2.25.1 (from -r /tmp/requirements.txt (line 4))\n  Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)\nRequirement already satisfied: six>=1.7 in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 5)) (1.16.0)\nCollecting python-etcd<0.5,>=0.4.3 (from -r /tmp/requirements.txt (line 6))\n  Downloading python-etcd-0.4.5.tar.gz (37 kB)\n  Preparing metadata (setup.py): started\n  Preparing metadata (setup.py): finished with status 'error'\n\n:stderr:   error: subprocess-exited-with-error\n  \n  × python setup.py egg_info did not run successfully.\n  │ exit code: 1\n  ╰─> [11 lines of output]\n      Traceback (most recent call last):\n        File \"<string>\", line 2, in <module>\n        File \"<pip-setuptools-caller>\", line 14, in <module>\n        File \"/usr/local/lib/python3.12/dist-packages/setuptools/__init__.py\", line 16, in <module>\n          import setuptools.version\n        File \"/usr/local/lib/python3.12/dist-packages/setuptools/version.py\", line 1, in <module>\n          import pkg_resources\n        File \"/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py\", line 2191, in <module>\n          register_finder(pkgutil.ImpImporter, find_on_path)\n                          ^^^^^^^^^^^^^^^^^^^\n      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?\n      [end of output]\n  \n  note: This error originates from a subprocess, and is likely not a problem with pip.\nerror: metadata-generation-failed\n\n× Encountered error while generating package metadata.\n╰─> See above for output.\n\nnote: This is an issue with the package mentioned above, not pip.\nhint: See above for details.\n"}
vitabaks commented 2 weeks ago

The python-etcd-0.4.5 and ydiff-1.3 packages are not compatible with Python 3.12

root@pgnode01:/# pip3 install -r /tmp/requirements.txt 
Collecting urllib3>=1.25.9 (from -r /tmp/requirements.txt (line 1))
  Using cached urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting boto3 (from -r /tmp/requirements.txt (line 2))
  Using cached boto3-1.34.92-py3-none-any.whl.metadata (6.6 kB)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 3)) (6.0.1)
Collecting requests>=2.25.1 (from -r /tmp/requirements.txt (line 4))
  Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: six>=1.7 in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 5)) (1.16.0)
Collecting python-etcd<0.5,>=0.4.3 (from -r /tmp/requirements.txt (line 6))
  Using cached python-etcd-0.4.5.tar.gz (37 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "/usr/local/lib/python3.12/dist-packages/setuptools/__init__.py", line 16, in <module>
          import setuptools.version
        File "/usr/local/lib/python3.12/dist-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py", line 2191, in <module>
          register_finder(pkgutil.ImpImporter, find_on_path)
                          ^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
Collecting urllib3>=1.25.9 (from -r /tmp/requirements.txt (line 1))
  Using cached urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting boto3 (from -r /tmp/requirements.txt (line 2))
  Using cached boto3-1.34.92-py3-none-any.whl.metadata (6.6 kB)
Requirement already satisfied: PyYAML in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 3)) (6.0.1)
Collecting requests>=2.25.1 (from -r /tmp/requirements.txt (line 4))
  Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Requirement already satisfied: six>=1.7 in /usr/lib/python3/dist-packages (from -r /tmp/requirements.txt (line 5)) (1.16.0)
Collecting python-consul>=0.7.1 (from -r /tmp/requirements.txt (line 6))
  Downloading python_consul-1.1.0-py2.py3-none-any.whl.metadata (11 kB)
Collecting click>=4.1 (from -r /tmp/requirements.txt (line 7))
  Downloading click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
Collecting prettytable>=0.7 (from -r /tmp/requirements.txt (line 8))
  Downloading prettytable-3.10.0-py3-none-any.whl.metadata (30 kB)
Collecting python-dateutil (from -r /tmp/requirements.txt (line 9))
  Downloading python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting psutil>=2.0.0 (from -r /tmp/requirements.txt (line 10))
  Downloading psutil-5.9.8-cp36-abi3-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (21 kB)
Collecting ydiff>=1.2.0 (from -r /tmp/requirements.txt (line 11))
  Downloading ydiff-1.3.tar.gz (74 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 74.1/74.1 kB 1.8 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [11 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "/usr/local/lib/python3.12/dist-packages/setuptools/__init__.py", line 16, in <module>
          import setuptools.version
        File "/usr/local/lib/python3.12/dist-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/usr/local/lib/python3.12/dist-packages/pkg_resources/__init__.py", line 2191, in <module>
          register_finder(pkgutil.ImpImporter, find_on_path)
                          ^^^^^^^^^^^^^^^^^^^
      AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.
rcknr commented 2 weeks ago

Could this be helpful? It looks like in 24.04 you are forced to create a virtual environment. By the way, the bug you referenced here was caused by a related problem: version conflicts between Python packages installed by apt and pip. It appears to be fixed.

vitabaks commented 1 week ago

Perhaps we will switch from pip to rpm/deb (patroni_installation_method) by default for patroni packages.