EXCEPTION: LooseVersion instance has no attribute 'version' barman

730 views
Skip to first unread message

Daniel Westermann

unread,
Dec 21, 2017, 10:49:41 AM12/21/17
to Barman, Backup and Recovery Manager for PostgreSQL
Hi,

any idea on what the issue is here?

postgres@ld9c044e:/u01/app/postgres/local/dmk/etc/ [pg101] barman -c /u01/app/postgres/local/dmk/etc/barman.conf backup ld9c030e

EXCEPTION: LooseVersion instance has no attribute 'version'

See log file for more details.

 

Barman is 2.3 against PostgreSQL 10.1


Barman log:


2017-12-21 16:44:31,406 [15912] barman.cli ERROR: LooseVersion instance has no attribute 'version'

See log file for more details.

Traceback (most recent call last):

  File "/usr/lib/python2.7/site-packages/barman/cli.py", line 1123, in main

    p.dispatch(pre_call=global_config)

  File "/usr/lib/python2.7/site-packages/argh/helpers.py", line 55, in dispatch

    return dispatch(self, *args, **kwargs)

  File "/usr/lib/python2.7/site-packages/argh/dispatching.py", line 174, in dispatch

    for line in lines:

  File "/usr/lib/python2.7/site-packages/argh/dispatching.py", line 277, in _execute_command

    for line in result:

  File "/usr/lib/python2.7/site-packages/argh/dispatching.py", line 231, in _call

    result = function(namespace_obj)

  File "/usr/lib/python2.7/site-packages/barman/cli.py", line 215, in backup

    server.backup()

  File "/usr/lib/python2.7/site-packages/barman/server.py", line 967, in backup

    self.check(strategy)

  File "/usr/lib/python2.7/site-packages/barman/server.py", line 435, in check

    self.check_postgres(check_strategy)

  File "/usr/lib/python2.7/site-packages/barman/server.py", line 559, in check_postgres

    remote_status = self.get_remote_status()

  File "/usr/lib/python2.7/site-packages/barman/remote_status.py", line 67, in get_remote_status

    self._remote_status = self.fetch_remote_status()

  File "/usr/lib/python2.7/site-packages/barman/server.py", line 881, in fetch_remote_status

    result.update(archiver.get_remote_status())

  File "/usr/lib/python2.7/site-packages/barman/remote_status.py", line 67, in get_remote_status

    self._remote_status = self.fetch_remote_status()

  File "/usr/lib/python2.7/site-packages/barman/wal_archiver.py", line 657, in fetch_remote_status

    elif "9.2" < pg_version <= pgreceivexlog_version:

  File "/usr/lib64/python2.7/distutils/version.py", line 296, in __cmp__

    return cmp(self.version, other.version)

AttributeError: LooseVersion instance has no attribute 'version'




Thx in advance

Daniel



Marco Nenciarini

unread,
Dec 21, 2017, 11:05:06 AM12/21/17
to pgba...@googlegroups.com
Hi,

Il 21/12/17 16:49, Daniel Westermann ha scritto:
> Hi,
>
> any idea on what the issue is here?
>
> postgres@ld9c044e:/u01/app/postgres/local/dmk/etc/ [pg101] barman -c
> /u01/app/postgres/local/dmk/etc/barman.conf backup ld9c030e
>
> EXCEPTION: LooseVersion instance has no attribute 'version'
>
> See log file for more details.
>

This issue looks like a dependency error. Can I know which version of
distutils and/or setuptools is installed in that environment?

Can you describe what OS, Distribution and Barman installation method
you used?

Regards,
Marco

--
Marco Nenciarini - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
marco.ne...@2ndQuadrant.it | www.2ndQuadrant.it

signature.asc

Daniel Westermann

unread,
Dec 21, 2017, 11:33:57 AM12/21/17
to Barman, Backup and Recovery Manager for PostgreSQL
Hi Marco ,

the OS is RHEL7.4. We installed barman from rpm (https://sourceforge.net/projects/pgbarman/files/2.3/barman-2.3-1.el7.noarch.rpm).
As I am not anymore onsite I requested the other information as:

  • rpm -qa | grep distutils
  • rpm -qa | grep setuptools
Thanks,
Daniel
marco.nenciarini@2ndQuadrant.it | www.2ndQuadrant.it

Daniel Westermann

unread,
Dec 21, 2017, 12:07:56 PM12/21/17
to Barman, Backup and Recovery Manager for PostgreSQL
Verified on my test env. Steps to reproduce:


postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101] sudo yum localinstall barman-2.3-1.el7.noarch.rpm
Loaded plugins: fastestmirror
Examining barman-2.3-1.el7.noarch.rpm: barman-2.3-1.el7.noarch
Marking barman-2.3-1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package barman.noarch 0:2.3-1.el7 will be installed
--> Processing Dependency: python-argh >= 0.21.2 for package: barman-2.3-1.el7.noarch
Loading mirror speeds from cached hostfile
 * base: mirror.switch.ch
 * extras: mirror.switch.ch
 * updates: mirror.switch.ch
--> Processing Dependency: python-psycopg2 >= 2.4.2 for package: barman-2.3-1.el7.noarch
--> Processing Dependency: rsync >= 3.0.4 for package: barman-2.3-1.el7.noarch
--> Processing Dependency: python-argcomplete for package: barman-2.3-1.el7.noarch
--> Processing Dependency: python-dateutil for package: barman-2.3-1.el7.noarch
--> Running transaction check
---> Package barman.noarch 0:2.3-1.el7 will be installed
--> Processing Dependency: python-argh >= 0.21.2 for package: barman-2.3-1.el7.noarch
--> Processing Dependency: python-argcomplete for package: barman-2.3-1.el7.noarch
---> Package python-dateutil.noarch 0:1.5-7.el7 will be installed
---> Package python-psycopg2.x86_64 0:2.5.1-3.el7 will be installed
--> Processing Dependency: libpq.so.5()(64bit) for package: python-psycopg2-2.5.1-3.el7.x86_64
---> Package rsync.x86_64 0:3.0.9-18.el7 will be installed
--> Running transaction check
---> Package barman.noarch 0:2.3-1.el7 will be installed
--> Processing Dependency: python-argh >= 0.21.2 for package: barman-2.3-1.el7.noarch
--> Processing Dependency: python-argcomplete for package: barman-2.3-1.el7.noarch
---> Package postgresql-libs.x86_64 0:9.2.23-3.el7_4 will be installed
--> Finished Dependency Resolution
Error: Package: barman-2.3-1.el7.noarch (/barman-2.3-1.el7.noarch)
           Requires: python-argh >= 0.21.2
Error: Package: barman-2.3-1.el7.noarch (/barman-2.3-1.el7.noarch)
           Requires: python-argcomplete
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest



postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101] wget http://dl.fedoraproject.org/pub/epel/7Server/x86_64/Packages/p/python-argcomplete-1.7.0-1.el7.noarch.rpm
--2017-12-21 17:54:32--  http://dl.fedoraproject.org/pub/epel/7Server/x86_64/Packages/p/python-argcomplete-1.7.0-1.el7.noarch.rpm
Resolving dl.fedoraproject.org (dl.fedoraproject.org)... 209.132.181.23, 209.132.181.24, 209.132.181.25
Connecting to dl.fedoraproject.org (dl.fedoraproject.org)|209.132.181.23|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 49736 (49K) [application/x-rpm]
Saving to: ‘python-argcomplete-1.7.0-1.el7.noarch.rpm’

100%[==================================================================>] 49,736      99.3KB/s   in 0.5s  

2017-12-21 17:54:33 (99.3 KB/s) - ‘python-argcomplete-1.7.0-1.el7.noarch.rpm’ saved [49736/49736]

postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101] sudo yum localinstall python-argcomplete-1.7.0-1.el7.noarch.rpm
Loaded plugins: fastestmirror
Examining python-argcomplete-1.7.0-1.el7.noarch.rpm: python-argcomplete-1.7.0-1.el7.noarch
Marking python-argcomplete-1.7.0-1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package python-argcomplete.noarch 0:1.7.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package                  Arch         Version           Repository                                    Size
============================================================================================================
Installing:
 python-argcomplete       noarch       1.7.0-1.el7       /python-argcomplete-1.7.0-1.el7.noarch       187 k

Transaction Summary
============================================================================================================
Install  1 Package

Total size: 187 k
Installed size: 187 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-argcomplete-1.7.0-1.el7.noarch                                                    1/1
  Verifying  : python-argcomplete-1.7.0-1.el7.noarch                                                    1/1

Installed:
  python-argcomplete.noarch 0:1.7.0-1.el7                                                                  

Complete!
postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101]





postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101] wget https://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/python-argh-0.23.0-1.rhel7.noarch.rpm
--2017-12-21 17:58:42--  https://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/python-argh-0.23.0-1.rhel7.noarch.rpm
Resolving yum.postgresql.org (yum.postgresql.org)... 174.143.35.196, 2001:4800:1501:1::196
Connecting to yum.postgresql.org (yum.postgresql.org)|174.143.35.196|:443... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/python-argh-0.23.0-1.rhel7.noarch.rpm [following]
--2017-12-21 17:58:44--  http://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-7-x86_64/python-argh-0.23.0-1.rhel7.noarch.rpm
Resolving download.postgresql.org (download.postgresql.org)... 204.145.124.244, 87.238.57.227, 217.196.149.55, ...
Connecting to download.postgresql.org (download.postgresql.org)|204.145.124.244|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 33664 (33K) [application/x-redhat-package-manager]
Saving to: ‘python-argh-0.23.0-1.rhel7.noarch.rpm’

100%[==================================================================>] 33,664       157KB/s   in 0.2s  

2017-12-21 17:58:45 (157 KB/s) - ‘python-argh-0.23.0-1.rhel7.noarch.rpm’ saved [33664/33664]

postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101] sudo yum localinstall python-argh-0.23.0-1.rhel7.noarch.rpm
Loaded plugins: fastestmirror
Examining python-argh-0.23.0-1.rhel7.noarch.rpm: python-argh-0.23.0-1.rhel7.noarch
Marking python-argh-0.23.0-1.rhel7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package python-argh.noarch 0:0.23.0-1.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package             Arch           Version                Repository                                  Size
============================================================================================================
Installing:
 python-argh         noarch         0.23.0-1.rhel7         /python-argh-0.23.0-1.rhel7.noarch         116 k

Transaction Summary
============================================================================================================
Install  1 Package

Total size: 116 k
Installed size: 116 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-argh-0.23.0-1.rhel7.noarch                                                        1/1
  Verifying  : python-argh-0.23.0-1.rhel7.noarch                                                        1/1

Installed:
  python-argh.noarch 0:0.23.0-1.rhel7                                                                      

Complete!
postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101]


postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101] sudo yum localinstall barman-2.3-1.el7.noarch.rpm
Loaded plugins: fastestmirror
Examining barman-2.3-1.el7.noarch.rpm: barman-2.3-1.el7.noarch
Marking barman-2.3-1.el7.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package barman.noarch 0:2.3-1.el7 will be installed
--> Processing Dependency: python-psycopg2 >= 2.4.2 for package: barman-2.3-1.el7.noarch
Loading mirror speeds from cached hostfile
 * base: mirror.switch.ch
 * extras: mirror.switch.ch
 * updates: mirror.switch.ch
--> Processing Dependency: rsync >= 3.0.4 for package: barman-2.3-1.el7.noarch
--> Processing Dependency: python-dateutil for package: barman-2.3-1.el7.noarch
--> Running transaction check
---> Package python-dateutil.noarch 0:1.5-7.el7 will be installed
---> Package python-psycopg2.x86_64 0:2.5.1-3.el7 will be installed
--> Processing Dependency: libpq.so.5()(64bit) for package: python-psycopg2-2.5.1-3.el7.x86_64
---> Package rsync.x86_64 0:3.0.9-18.el7 will be installed
--> Running transaction check
---> Package postgresql-libs.x86_64 0:9.2.23-3.el7_4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================
 Package                  Arch            Version                   Repository                         Size
============================================================================================================
Installing:
 barman                   noarch          2.3-1.el7                 /barman-2.3-1.el7.noarch          1.4 M
Installing for dependencies:
 postgresql-libs          x86_64          9.2.23-3.el7_4            updates                           234 k
 python-dateutil          noarch          1.5-7.el7                 base                               85 k
 python-psycopg2          x86_64          2.5.1-3.el7               base                              132 k
 rsync                    x86_64          3.0.9-18.el7              base                              360 k

Transaction Summary
============================================================================================================
Install  1 Package (+4 Dependent packages)

Total size: 2.2 M
Total download size: 810 k
Installed size: 3.5 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): python-dateutil-1.5-7.el7.noarch.rpm                                          |  85 kB  00:00:00    
(2/4): python-psycopg2-2.5.1-3.el7.x86_64.rpm                                        | 132 kB  00:00:00    
(3/4): postgresql-libs-9.2.23-3.el7_4.x86_64.rpm                                     | 234 kB  00:00:01    
(4/4): rsync-3.0.9-18.el7.x86_64.rpm                                                 | 360 kB  00:00:01    
------------------------------------------------------------------------------------------------------------
Total                                                                       537 kB/s | 810 kB  00:00:01    
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-dateutil-1.5-7.el7.noarch                                                         1/5
  Installing : postgresql-libs-9.2.23-3.el7_4.x86_64                                                    2/5
  Installing : python-psycopg2-2.5.1-3.el7.x86_64                                                       3/5
  Installing : rsync-3.0.9-18.el7.x86_64                                                                4/5
  Installing : barman-2.3-1.el7.noarch                                                                  5/5
  Verifying  : barman-2.3-1.el7.noarch                                                                  1/5
  Verifying  : rsync-3.0.9-18.el7.x86_64                                                                2/5
  Verifying  : python-psycopg2-2.5.1-3.el7.x86_64                                                       3/5
  Verifying  : postgresql-libs-9.2.23-3.el7_4.x86_64                                                    4/5
  Verifying  : python-dateutil-1.5-7.el7.noarch                                                         5/5

Installed:
  barman.noarch 0:2.3-1.el7                                                                                

Dependency Installed:
  postgresql-libs.x86_64 0:9.2.23-3.el7_4                 python-dateutil.noarch 0:1.5-7.el7               
  python-psycopg2.x86_64 0:2.5.1-3.el7                    rsync.x86_64 0:3.0.9-18.el7                      

Complete!
postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101]
postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101]


postgres@pgbarman:/u01/app/postgres/local/dmk/contrib/ [pg101] barman -v
2.3 Barman by 2ndQuadrant (www.2ndQuadrant.com)


postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101] cat barman.d/pg101.conf
[pg101]
description =  "PostgreSQL 10.1 server"
conninfo = host=192.168.22.99 port=5441 user=postgres dbname=postgres
backup_method = postgres
backup_directory = /u90/backup/pg101
streaming_conninfo = host=192.168.22.99 port=5441 user=barman dbname=postgres
streaming_wals_directory = /u90/backup/pg101
streaming_archiver = on
slot_name = barman

postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101]
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101] vi barman.d/pg101.conf
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101] echo $PGHOME
/u01/app/postgres/product/10/db_1/
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101] vi barman.d/pg101.conf
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101] echo $PGHOME^C
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101]
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101]
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101]
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101]
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101]
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101]
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101] cat barman.conf
; Barman, Backup and Recovery Manager for PostgreSQL
; http://www.pgbarman.org/ - http://www.2ndQuadrant.com/
;
; Main configuration file

[barman]
; System user
barman_user = postgres

; Directory of configuration files. Place your sections in separate files with .conf extension
; For example place the 'main' server section in /etc/barman.d/main.conf
configuration_files_directory = /u01/app/postgres/local/dmk/etc/barman.d

; Main directory
barman_home = /u90/backup

; Locks directory - default: %(barman_home)s
barman_lock_directory = /u01/app/postgres/local/dmk/etc/

; Log location
log_file = /u01/app/postgres/local/dmk/log/barman.log

; Log level (see https://docs.python.org/3/library/logging.html#levels)
log_level = INFO

; Default compression level: possible values are None (default), bzip2, gzip, pigz, pygzip or pybzip2
compression = gzip

; Pre/post backup hook scripts
;pre_backup_script = env | grep ^BARMAN
;pre_backup_retry_script = env | grep ^BARMAN
;post_backup_retry_script = env | grep ^BARMAN
;post_backup_script = env | grep ^BARMAN

; Pre/post archive hook scripts
;pre_archive_script = env | grep ^BARMAN
;pre_archive_retry_script = env | grep ^BARMAN
;post_archive_retry_script = env | grep ^BARMAN
;post_archive_script = env | grep ^BARMAN

; Global retention policy (REDUNDANCY or RECOVERY WINDOW) - default empty
retention_policy = RECOVERY WINDOW OF 4 WEEKS

; Global bandwidth limit in KBPS - default 0 (meaning no limit)
;bandwidth_limit = 4000

; Immediate checkpoint for backup command - default false
;immediate_checkpoint = false

; Enable network compression for data transfers - default false
;network_compression = false

; Number of retries of data copy during base backup after an error - default 0
;basebackup_retry_times = 0

; Number of seconds of wait after a failed copy, before retrying - default 30
;basebackup_retry_sleep = 30

; Maximum execution time, in seconds, per server
; for a barman check command - default 30
;check_timeout = 30

; Time frame that must contain the latest backup date.
; If the latest backup is older than the time frame, barman check
; command will report an error to the user.
; If empty, the latest backup is always considered valid.
; Syntax for this option is: "i (DAYS | WEEKS | MONTHS)" where i is an
; integer > 0 which identifies the number of days | weeks | months of
; validity of the latest backup for this check. Also known as 'smelly backup'.
;last_backup_maximum_age =

; Minimum number of required backups (redundancy)
;minimum_redundancy = 1

postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101] cat barman.d/pg101.conf
[pg101]
description =  "PostgreSQL 10.1 server"
conninfo = host=192.168.22.99 port=5441 user=postgres dbname=postgres
backup_method = postgres
backup_directory = /u90/backup/pg101
streaming_conninfo = host=192.168.22.99 port=5441 user=barman dbname=postgres
streaming_wals_directory = /u90/backup/pg101
streaming_archiver = on
slot_name = barman
path_prefix="/u01/app/postgres/product/10/db_1/"
postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101]



postgres@pgbarman:/u01/app/postgres/local/dmk/etc/ [pg101] barman check pg101
Server pg101 (WARNING: disabled):
    WAL archive: FAILED (please make sure WAL shipping is setup)

Daniel Westermann

unread,
Jan 11, 2018, 9:19:48 AM1/11/18
to Barman, Backup and Recovery Manager for PostgreSQL
Hi Marco ,

any hints?

Regards
Daniel
Reply all
Reply to author
Forward
0 new messages