Error when building Python 2 binaries from source

When trying to build Python 2 binaries from source I got this error (I know Python 2 is revoked from official repositories but I need it for some tools that still require Python 2 dependencies)

garuda-inxi:

System:
  Kernel: 6.0.7-zen1-1-zen arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=868d6417-5926-48d3-8b1a-565967682ed4 rw [email protected]
    quiet quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0
    loglevel=3
  Desktop: Cinnamon v: 5.4.12 tk: GTK v: 3.24.34 info: plank wm: Mutter
    vt: 7 dm: LightDM v: 1.32.0 Distro: Garuda Linux base: Arch Linux
Machine:
  Type: Laptop System: ASUSTeK product: X540YA v: 1.0
    serial: <superuser required>
  Mobo: ASUSTeK model: X540YA v: 1.0 serial: <superuser required>
    UEFI: American Megatrends v: X540YA.320 date: 05/15/2018
Battery:
  ID-1: BAT0 charge: 26.1 Wh (99.2%) condition: 26.3/33.3 Wh (78.9%)
    volts: 11.1 min: 11.1 model: ASUSTek X540-30 type: Li-ion serial: N/A
    status: not charging cycles: 333
CPU:
  Info: model: AMD E2-6110 APU with AMD Radeon R2 Graphics bits: 64 type: MCP
    arch: Puma level: v2 built: 2014-15 process: GF 28nm family: 0x16 (22)
    model-id: 0x30 (48) stepping: 1 microcode: 0x7030106
  Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 256 KiB
    desc: d-4x32 KiB; i-4x32 KiB L2: 2 MiB desc: 1x2 MiB
  Speed (MHz): avg: 998 high: 1000 min/max: 1000/1500 boost: disabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 998 2: 1000
    3: 998 4: 998 bogomips: 11977
  Flags: avx ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed mitigation: untrained return thunk; SMT disabled
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
    disabled, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: AMD Mullins [Radeon R2 Graphics] vendor: ASUSTeK driver: radeon
    v: kernel alternate: amdgpu arch: GCN-2 code: Sea Islands
    process: GF/TSMC 16-28nm built: 2013-17 ports: active: eDP-1
    empty: HDMI-A-1,VGA-1 bus-ID: 00:01.0 chip-ID: 1002:9852 class-ID: 0300
  Device-2: IMC Networks USB2.0 VGA UVC WebCam type: USB driver: uvcvideo
    bus-ID: 2-1.2:4 chip-ID: 13d3:5a01 class-ID: 0e02 serial: <filter>
  Display: x11 server: X.Org v: 21.1.4 driver: X: loaded: radeon
    unloaded: modesetting alternate: fbdev,vesa dri: radeonsi gpu: radeon
    display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.21x7.99")
    s-diag: 414mm (16.31")
  Monitor-1: eDP-1 mapped: eDP model: ChiMei InnoLux 0x15ca built: 2014
    res: 1366x768 hz: 60 dpi: 101 gamma: 1.2 size: 344x193mm (13.54x7.6")
    diag: 394mm (15.5") ratio: 16:9 modes: max: 1366x768 min: 640x480
  Message: Unable to show GL data. Required tool glxinfo missing.
Audio:
  Device-1: AMD Kabini HDMI/DP Audio vendor: ASUSTeK driver: snd_hda_intel
    v: kernel bus-ID: 00:01.1 chip-ID: 1002:9840 class-ID: 0403
  Device-2: AMD FCH Azalia vendor: ASUSTeK driver: snd_hda_intel v: kernel
    bus-ID: 00:14.2 chip-ID: 1022:780d class-ID: 0403
  Sound API: ALSA v: k6.0.7-zen1-1-zen running: yes
  Sound Server-1: PulseAudio v: 16.1 running: no
  Sound Server-2: PipeWire v: 0.3.59 running: yes
Network:
  Device-1: Realtek RTL8723BE PCIe Wireless Network Adapter vendor: Lite-On
    driver: rtl8723be v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1
    port: e000 bus-ID: 01:00.0 chip-ID: 10ec:b723 class-ID: 0280
  IF: wlp1s0 state: up mac: <filter>
  Device-2: Realtek RTL810xE PCI Express Fast Ethernet vendor: ASUSTeK
    driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: d000
    bus-ID: 02:00.0 chip-ID: 10ec:8136 class-ID: 0200
  IF: enp2s0 state: down mac: <filter>
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8
    bus-ID: 2-1.1:3 chip-ID: 0bda:b721 class-ID: e001 serial: <filter>
  Report: bt-adapter ID: hci0 rfk-id: 1 state: up address: <filter>
Drives:
  Local Storage: total: 238.47 GiB used: 67.24 GiB (28.2%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/sda maj-min: 8:0 model: SSD 256GB size: 238.47 GiB block-size:
    physical: 512 B logical: 512 B speed: 6.0 Gb/s type: SSD serial: <filter>
    rev: 0521 scheme: MBR
Partition:
  ID-1: / raw-size: 86.57 GiB size: 86.57 GiB (100.00%) used: 16.48 GiB
    (19.0%) fs: btrfs dev: /dev/sda4 maj-min: 8:4
  ID-2: /boot/efi raw-size: 50 MiB size: 50 MiB (99.99%) used: 29 MiB
    (58.0%) fs: ntfs dev: /dev/sda1 maj-min: 8:1
  ID-3: /home raw-size: 86.57 GiB size: 86.57 GiB (100.00%) used: 16.48 GiB
    (19.0%) fs: btrfs dev: /dev/sda4 maj-min: 8:4
  ID-4: /var/log raw-size: 86.57 GiB size: 86.57 GiB (100.00%) used: 16.48
    GiB (19.0%) fs: btrfs dev: /dev/sda4 maj-min: 8:4
  ID-5: /var/tmp raw-size: 86.57 GiB size: 86.57 GiB (100.00%) used: 16.48
    GiB (19.0%) fs: btrfs dev: /dev/sda4 maj-min: 8:4
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: zram size: 3.26 GiB used: 2.47 GiB (75.9%)
    priority: 100 dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 60.4 C mobo: N/A gpu: radeon temp: 61.0 C
  Fan Speeds (RPM): cpu: 2200
Info:
  Processes: 299 Uptime: 1d 9h 2m wakeups: 2 Memory: 3.26 GiB used: 2.59 GiB
  (79.6%) Init: systemd v: 251 default: graphical tool: systemctl
  Compilers: gcc: 12.2.0 Packages: pm: pacman pkgs: 1339 libs: 326
  tools: octopi,paru,yay Shell: Zsh v: 5.9 default: Bash v: 5.1.16
  running-in: terminator inxi: 3.3.22
Garuda (2.6.9-1):
  System install date:     2022-11-06
  Last full system update: 2022-11-07
  Is partially upgraded:   Yes
  Relevant software:       NetworkManager
  Windows dual boot:       No/Undetected
  Snapshots:               Snapper
  Failed units:            

The error I receive when I try to build Python 2 binaries from source:

Ran 54 tests in 3.793s

OK

== Tests result: FAILURE ==

371 tests OK.

1 test failed:
    test_time

23 tests skipped:
    test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl
    test_dl test_gl test_imageop test_imgfile test_kqueue
    test_linuxaudiodev test_macos test_macostools test_msilib
    test_ossaudiodev test_py3kwarn test_scriptpackages test_startfile
    test_sunaudiodev test_winreg test_winsound test_zipfile64
Those skips are all expected on linux2.

Total duration: 29 min 50 sec
Tests result: FAILURE
==> ERROR: A failure occurred in check().
    Aborting...
 -> error making: python2

Oops, I would backtrack and get your partially upgraded state resolved before troubleshooting any further. Try restoring a snapshot and then bring the snapshot up to date, then reboot and try again.

I will try to apply it and tell you if the problem is resolved because now I'm getting this error when trying to install or upgrade via pacman:

:: Running pre-transaction hooks...
(1/1) Performing snapper pre snapshots for the following configurations...
  File "/usr/share/libalpm/scripts/snap-pac", line 40
    f"--config {config} create",
                              ^

The error is cut off. Can you paste the rest of the message?

The carrot (^) is pointing to a problematic character in a config or script, which appears to be on line 40 of /usr/share/libalpm/scripts/snap-pac.

1 Like

Here it is:

:: Running pre-transaction hooks...
(1/2) Performing snapper pre snapshots for the following configurations...
  File "/usr/share/libalpm/scripts/snap-pac", line 40
    f"--config {config} create",
                              ^
SyntaxError: invalid syntax
error: command failed to execute correctly
error: failed to commit transaction (failed to run transaction hooks)
Errors occurred, no packages were upgraded.
Press enter to exit

Are you booted into a snapshot? You need to restore the snapshot, then reboot the system before you can bring it up to date.

Solved the Snap-pac error but still have errors when building Python 2 binaries:

Ran 54 tests in 3.784s

OK

== Tests result: FAILURE ==

371 tests OK.

1 test failed:
    test_time

23 tests skipped:
    test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl
    test_dl test_gl test_imageop test_imgfile test_kqueue
    test_linuxaudiodev test_macos test_macostools test_msilib
    test_ossaudiodev test_py3kwarn test_scriptpackages test_startfile
    test_sunaudiodev test_winreg test_winsound test_zipfile64
Those skips are all expected on linux2.

Total duration: 31 min 470 ms
Tests result: FAILURE

PS: I booted into a snapshot and updated the system

What is the method you are using for building the binaries?

1 Like

Did you restore the system before you update the system?

Yes I did restore the system.

1 Like

Sorry I over read it :slight_smile:

1 Like

I used yay and I also cloned it from aur.archlinux.org and launched makepkg to build it.
I got the exact same error for both methods (because basically yay clones the same package from the same source and build it)

A fellow user was running into the same problem as you and got around it using the below. I copied there post and added it below this line.

I had the same"next patch would create the file...which already exists" issue. For me, I just switched to the binary package:

pacaur -S python2-bin
6 Likes

Problem solved thanks a lot

2 Likes

Glad it worked out for you.

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.