You are not logged in.

#1 2026-08-24 09:12:07

drankinatty
Member
From: Nacogdoches, Texas
Registered: 2009-04-24
Posts: 110
Website

[SOLVED] Update broke scons: ModuleNotFoundError: pkg_resources

All,

  I'm stuck on the update for the AUR mongodb44 package after the last update. I suspected a simple rebuild would be all that was needed as there were no breaking changes from boost 1.92 apparent in the package, but a rebuild would be required to pull in the new .so version.

  However I ran head-long into a scons/python problem that prevents the build from starting due to not finding a needed module using the old pkg_resources syntax. I am not a python programmer and scons is a bit like witchcraft, so I'm a bit stuck. The build error is:

==> Starting build()...
scons: Reading SConscript files ...
ModuleNotFoundError: No module named 'pkg_resources':
  File "/build/mongodb44/src/mongo-r4.4.29/SConstruct", line 19:
    from pkg_resources import parse_version
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Build failed, check /home/david/arch/pkg/chroot/david/build

  Okay, great, the line complained about is attempting to pull in a parse_version module:

from pkg_resources import parse_version

  That looks pretty simple, but the pkg_resources Migration Guide isn't quite verbose enough to get me over the hump. How do I implement a replacement for the code above so it works with the new pkg_resources.parse_version (or the like). I know this wants to accomplish the pkg_resources.parse_version (I think), but how do you translate from old to new?

  Something to point me in the right direction would be greatly appreciated.

Last edited by drankinatty (2026-08-27 06:39:44)


David C. Rankin, J.D.,P.E.

Offline

#2 2026-08-24 21:12:52

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,401

Re: [SOLVED] Update broke scons: ModuleNotFoundError: pkg_resources

It seems there is a 4.4.31 release, have you tried that one ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2026-08-24 23:07:55

loqs
Member
Registered: 2014-03-06
Posts: 19,055

Re: [SOLVED] Update broke scons: ModuleNotFoundError: pkg_resources

diff --git a/SConstruct b/SConstruct
index b65c61dc..c262a31a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -16,7 +16,7 @@ import textwrap
 import uuid
 from glob import glob
 
-from pkg_resources import parse_version
+from packaging.version import parse as parse_version
 
 import SCons
 
diff --git a/buildscripts/linter/runner.py b/buildscripts/linter/runner.py
index 623a3c42..33649e42 100644
--- a/buildscripts/linter/runner.py
+++ b/buildscripts/linter/runner.py
@@ -10,7 +10,7 @@ import site
 import subprocess
 import sys
 import threading
-import pkg_resources
+import packaging.version
 
 from . import base
 
@@ -33,7 +33,7 @@ def _check_version(linter, cmd_path, args):
                 decoded_output, stderr)
 
         pattern = r"\b(?:(%s) )?(?P<version>\S+)\b" % (linter.cmd_name)
-        required_version = pkg_resources.parse_version(linter.required_version)
+        required_version = packaging.version.parse(linter.required_version)
 
         match = re.search(pattern, decoded_output)
         if match:
@@ -41,7 +41,7 @@ def _check_version(linter, cmd_path, args):
         else:
             found_version = '0.0'
 
-        if pkg_resources.parse_version(found_version) < required_version:
+        if packaging.version.parse(found_version) < required_version:
             logging.info(
                 "Linter %s has wrong version for '%s'. Expected >= '%s',"
                 "Standard Output:\n'%s'\nStandard Error:\n%s", linter.cmd_name, cmd,
diff --git a/site_scons/site_tools/ccache.py b/site_scons/site_tools/ccache.py
index 2a894919..227f992b 100644
--- a/site_scons/site_tools/ccache.py
+++ b/site_scons/site_tools/ccache.py
@@ -26,7 +26,7 @@ import re
 import subprocess
 
 import SCons
-from pkg_resources import parse_version
+from packaging.version import parse as parse_version
 
 # This is the oldest version of ccache that offers support for -gsplit-dwarf
 _ccache_version_min = parse_version("3.2.3")
diff --git a/site_scons/site_tools/icecream.py b/site_scons/site_tools/icecream.py
index f9e436eb..df612f2a 100644
--- a/site_scons/site_tools/icecream.py
+++ b/site_scons/site_tools/icecream.py
@@ -25,7 +25,7 @@ import re
 import subprocess
 import urllib
 
-from pkg_resources import parse_version
+from packaging.version import parse as parse_version
 
 import SCons
 

Last edited by loqs (2026-08-24 23:18:28)

Offline

#4 2026-08-26 05:08:21

drankinatty
Member
From: Nacogdoches, Texas
Registered: 2009-04-24
Posts: 110
Website

Re: [SOLVED] Update broke scons: ModuleNotFoundError: pkg_resources

Oh, you may be my savior. I'll boot into my Arch build in clean chroot install, give it a try and report back. Thank You! And @Lone_wolf, will update and give that a go as well. Thank you too!

I'll report back. This should get me over the finish line, but with python and scons, I've leaned to never say never.

Last edited by drankinatty (2026-08-27 06:40:17)


David C. Rankin, J.D.,P.E.

Offline

#5 2026-08-27 04:24:09

drankinatty
Member
From: Nacogdoches, Texas
Registered: 2009-04-24
Posts: 110
Website

Re: [SOLVED] Update broke scons: ModuleNotFoundError: pkg_resources

The SConstruct patch worked flawlessly, and 4.4-31 builds all the way to the end (some hour plus continual compile), but then fails on final link with a ld terminated with signal  9 [Killed]. What! There are no errors prior to that. Literally, it is just wrapping up the final LTO link with the following and then rolls over dead:

g++ @/tmp/tmpaefq41t1.lnk
Generating build/07c20a8e/mongo/transport/message_compressor_options_client_gen.cpp
g++ -o build/07c20a8e/mongo/shell/shell_options.o -c -Woverloaded-virtual -Wno-c++20-compat -Wno-cpp -Wno-interference-size -Wno-class-memaccess -Wno-template-body -Wpessimizing-move -Wredundant-move -Wno-maybe-uninitialized -Wno-exceptions -fsized-deallocation -Wno-defaulted-function-deleted -std=c++17 -ffp-contract=off -fno-omit-frame-pointer -fno-strict-aliasing -fasynchronous-unwind-tables -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Wno-sign-compare -Wno-lto-type-mismatch -O0 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-unused-but-set-variable -Wno-missing-braces -flto -fno-builtin-memcmp -DSAFEINT_USE_INTRINSICS=0 -D_XOPEN_SOURCE=700 -D_GNU_SOURCE -DBOOST_THREAD_VERSION=5 -DBOOST_THREAD_USES_DATETIME -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -DBOOST_ENABLE_ASSERT_DEBUG_HANDLER -DBOOST_LOG_NO_SHORTHAND_NAMES -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_WITHOUT_THREAD_ATTR -DBOOST_LOG_DYN_LINK -DABSL_FORCE_ALIGNED_ACCESS -Isrc/third_party/SafeInt -Isrc/third_party/fmt/dist/include -Isrc/third_party/abseil-cpp-master/abseil-cpp -Ibuild/07c20a8e -Isrc src/mongo/shell/shell_options.cpp
g++ -o build/07c20a8e/mongo/shell/shell_utils_extended.o -c -Woverloaded-virtual -Wno-c++20-compat -Wno-cpp -Wno-interference-size -Wno-class-memaccess -Wno-template-body -Wpessimizing-move -Wredundant-move -Wno-maybe-uninitialized -Wno-exceptions -fsized-deallocation -Wno-defaulted-function-deleted -std=c++17 -ffp-contract=off -fno-omit-frame-pointer -fno-strict-aliasing -fasynchronous-unwind-tables -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Wno-sign-compare -Wno-lto-type-mismatch -O0 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-unused-but-set-variable -Wno-missing-braces -flto -fno-builtin-memcmp -DSAFEINT_USE_INTRINSICS=0 -D_XOPEN_SOURCE=700 -D_GNU_SOURCE -DBOOST_THREAD_VERSION=5 -DBOOST_THREAD_USES_DATETIME -DBOOST_SYSTEM_NO_DEPRECATED -DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS -DBOOST_ENABLE_ASSERT_DEBUG_HANDLER -DBOOST_LOG_NO_SHORTHAND_NAMES -DBOOST_LOG_USE_NATIVE_SYSLOG -DBOOST_LOG_WITHOUT_THREAD_ATTR -DBOOST_LOG_DYN_LINK -DABSL_FORCE_ALIGNED_ACCESS -Isrc/third_party/SafeInt -Isrc/third_party/fmt/dist/include -Isrc/third_party/abseil-cpp-master/abseil-cpp -Ibuild/07c20a8e -Isrc src/mongo/shell/shell_utils_extended.cpp
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
scons: *** [build/07c20a8e/mongo/mongos] Error 1
scons: building terminated because of errors.
build/07c20a8e/mongo/mongos failed: Error 1
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Build failed, check /home/david/arch/chroot/david/build

It's bad enough to have to suss out identified errors, it's quite another to have to find unidentified errors. AARGH, that's frustrating!

Okay, I found it -- my canary is starving? oom-killer to blame

Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:10 2pi rtkit-daemon[1008]: The canary thread is apparently starving. Taking action.
Aug 26 22:59:10 2pi at-spi2-registryd[976]: Disabling unresponsive app with pid 907
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:10 2pi rtkit-daemon[1008]: Demoting known real-time threads.
Aug 26 22:59:10 2pi systemd[1]: makechrootpkg-mongodb44.build.185431.scope: The kernel OOM killer killed some processes in this unit.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:10 2pi rtkit-daemon[1008]: Demoted 0 threads.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: warn_alloc: 104682 callbacks suppressed
Aug 26 22:59:12 2pi kernel: Backgro.kSource: page allocation failure: order:0, mode:0x40cc0(GFP_KERNEL|__GFP_COMP), nodemask=(null),cpuset=system.slice,mems_allowed=0
Aug 26 22:59:12 2pi kernel: CPU: 1 UID: 980 PID: 2286 Comm: Backgro.kSource Not tainted 7.1.9-arch1-2 #1 PREEMPT(full)  1dcb44188b0ac1c68b4b4adc32aedf169215449b
Aug 26 22:59:12 2pi kernel: Hardware name: Dell Inc. OptiPlex 360                 /0T656F, BIOS A07 06/18/2012
Aug 26 22:59:12 2pi kernel: Call Trace:
Aug 26 22:59:12 2pi kernel:  <TASK>
Aug 26 22:59:12 2pi kernel:  dump_stack_lvl+0x5d/0x80
Aug 26 22:59:12 2pi kernel:  warn_alloc+0x171/0x1e0
Aug 26 22:59:12 2pi kernel:  __alloc_pages_slowpath.constprop.0+0x728/0x1170
Aug 26 22:59:12 2pi kernel:  __alloc_frozen_pages_noprof+0x31e/0x380
Aug 26 22:59:12 2pi kernel:  alloc_pages_mpol+0xb2/0x160
Aug 26 22:59:12 2pi kernel:  folio_alloc_mpol_noprof+0x14/0x40
Aug 26 22:59:12 2pi kernel:  swap_cache_alloc_folio+0x8b/0xe0
Aug 26 22:59:12 2pi kernel:  shrink_memcg_cb+0xe2/0x300
Aug 26 22:59:12 2pi kernel:  ? __pfx_shrink_memcg_cb+0x10/0x10
Aug 26 22:59:12 2pi kernel:  __list_lru_walk_one+0xe2/0x220
Aug 26 22:59:12 2pi kernel:  list_lru_walk_one+0x10/0x20
Aug 26 22:59:12 2pi kernel:  zswap_shrinker_scan+0x64/0xb0
Aug 26 22:59:12 2pi kernel:  do_shrink_slab+0x154/0x3b0
Aug 26 22:59:12 2pi kernel:  shrink_slab+0x2ad/0x400
Aug 26 22:59:12 2pi kernel:  shrink_one+0xe8/0x210
Aug 26 22:59:12 2pi kernel:  shrink_node+0xa90/0xcc0
Aug 26 22:59:12 2pi kernel:  do_try_to_free_pages+0xac/0x490
Aug 26 22:59:12 2pi kernel:  try_to_free_pages+0xfb/0x240
Aug 26 22:59:12 2pi kernel:  __alloc_pages_slowpath.constprop.0+0x837/0x1170
Aug 26 22:59:12 2pi kernel:  __alloc_frozen_pages_noprof+0x31e/0x380
Aug 26 22:59:12 2pi kernel:  alloc_pages_mpol+0xb2/0x160
Aug 26 22:59:12 2pi kernel:  folio_alloc_noprof+0x54/0xa0
Aug 26 22:59:12 2pi kernel:  __filemap_get_folio_mpol+0x1e3/0x320
Aug 26 22:59:12 2pi kernel:  filemap_fault+0x2f8/0x1340
Aug 26 22:59:12 2pi kernel:  __do_fault+0x34/0x170
Aug 26 22:59:12 2pi kernel:  do_fault+0x3ec/0x5f0
Aug 26 22:59:12 2pi kernel:  ? __pte_offset_map+0x1b/0x100
Aug 26 22:59:12 2pi kernel:  __handle_mm_fault+0x967/0xf80
Aug 26 22:59:12 2pi kernel:  handle_mm_fault+0xed/0x2c0
Aug 26 22:59:12 2pi kernel:  do_user_addr_fault+0x23b/0x730
Aug 26 22:59:12 2pi kernel:  exc_page_fault+0x90/0x1f0
Aug 26 22:59:12 2pi kernel:  asm_exc_page_fault+0x26/0x30
Aug 26 22:59:12 2pi kernel: RIP: 0033:0x562843e63b0e
Aug 26 22:59:12 2pi kernel: Code: Unable to access opcode bytes at 0x562843e63ae4.
Aug 26 22:59:12 2pi kernel: RSP: 002b:00007f6bf62b78d8 EFLAGS: 00010246
Aug 26 22:59:12 2pi kernel: RAX: 000001a0415f0d9a RBX: 00007f6bf7d65ce0 RCX: 000001a0415f00e2
Aug 26 22:59:12 2pi kernel: RDX: 0000000000000000 RSI: 000001a0415f0d9a RDI: 00007f6bf62b7870
Aug 26 22:59:12 2pi kernel: RBP: 00007f6bf62b7900 R08: 00226ea2cb97fef8 R09: 0000000000000000
Aug 26 22:59:12 2pi kernel: R10: 00007f6bfc828000 R11: 000000000a9a988e R12: 0000000000000021
Aug 26 22:59:12 2pi kernel: R13: 00007fff55ffdd90 R14: 0000000000000002 R15: 00007fff55ffde97
Aug 26 22:59:12 2pi kernel:  </TASK>
Aug 26 22:59:12 2pi kernel: Mem-Info:
Aug 26 22:59:12 2pi kernel: active_anon:440434 inactive_anon:450359 isolated_anon:0
                             active_file:30 inactive_file:82 isolated_file:0
                             unevictable:20532 dirty:0 writeback:38
                             slab_reclaimable:10641 slab_unreclaimable:18212
                             mapped:14782 shmem:24062 pagetables:7222
                             sec_pagetables:0 bounce:0
                             kernel_misc_reclaimable:0
                             free:22 free_pcp:103 free_cma:0
Aug 26 22:59:12 2pi kernel: Node 0 active_anon:1761736kB inactive_anon:1801436kB active_file:120kB inactive_file:328kB unevictable:82128kB isolated(anon):0kB isolated(file):0kB mapped:59128kB dirty:0kB writeback:152kB shmem:96248kB shmem_thp:0kB shmem_pmdmapped:0kB anon_thp:0kB kernel_stack:5392kB pagetables:28888kB sec_pagetables:0kB all_unreclaimable? no Balloon:0kB gpu_active:0kB gpu_reclaim:0kB
Aug 26 22:59:12 2pi kernel: Node 0 DMA free:20kB boost:0kB min:264kB low:328kB high:392kB reserved_highatomic:0KB free_highatomic:0KB active_anon:7276kB inactive_anon:7336kB active_file:0kB inactive_file:0kB unevictable:0kB writepending:144kB zspages:0kB present:15992kB managed:15360kB mlocked:0kB bounce:0kB free_pcp:120kB local_pcp:0kB free_cma:0kB
Aug 26 22:59:12 2pi kernel: lowmem_reserve[]: 0 2931 3817 3817 3817
Aug 26 22:59:12 2pi kernel: Node 0 DMA32 free:0kB boost:116296kB min:167988kB low:180908kB high:193828kB reserved_highatomic:0KB free_highatomic:0KB active_anon:1506988kB inactive_anon:1345084kB active_file:112kB inactive_file:92kB unevictable:0kB writepending:20kB zspages:70476kB present:3118440kB managed:3001856kB mlocked:0kB bounce:0kB free_pcp:52kB local_pcp:8kB free_cma:0kB
Aug 26 22:59:12 2pi kernel: lowmem_reserve[]: 0 0 886 886 886
Aug 26 22:59:12 2pi kernel: Node 0 Normal free:68kB boost:35148kB min:50772kB low:54676kB high:58580kB reserved_highatomic:0KB free_highatomic:0KB active_anon:247428kB inactive_anon:449012kB active_file:20kB inactive_file:224kB unevictable:82128kB writepending:0kB zspages:20448kB present:983040kB managed:907504kB mlocked:0kB bounce:0kB free_pcp:240kB local_pcp:20kB free_cma:0kB
Aug 26 22:59:12 2pi kernel: lowmem_reserve[]: 0 0 0 0 0
Aug 26 22:59:12 2pi kernel: Node 0 DMA: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 0kB
Aug 26 22:59:12 2pi kernel: Node 0 DMA32: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 0kB
Aug 26 22:59:12 2pi kernel: Node 0 Normal: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 0kB
Aug 26 22:59:12 2pi kernel: Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=2048kB
Aug 26 22:59:12 2pi kernel: 78648 total pagecache pages
Aug 26 22:59:12 2pi kernel: 38175 pages in swap cache
Aug 26 22:59:12 2pi kernel: Free swap  = 156kB
Aug 26 22:59:12 2pi kernel: Total swap = 1249164kB
Aug 26 22:59:12 2pi kernel: 1029368 pages RAM
Aug 26 22:59:12 2pi kernel: 0 pages HighMem/MovableOnly
Aug 26 22:59:12 2pi kernel: 48188 pages reserved
Aug 26 22:59:12 2pi kernel: 0 pages cma reserved
Aug 26 22:59:12 2pi kernel: 0 pages hwpoisoned
Aug 26 22:59:12 2pi kernel: Memory cgroup min protection 0kB -- low protection 0kB
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: Purging GPU memory, 0 pages freed, 0 pages still pinned, 4185 pages left available.
Aug 26 22:59:12 2pi kernel: cc1plus invoked oom-killer: gfp_mask=0x140dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO|__GFP_COMP), order=0, oom_score_adj=0

Seems as our GNU-C compiler keeps getting bigger and the LTO demands keep growing, they are outpacing what older machines can support. This was a test box anyway, an old Core2-Duo with 4G. I guess I'll need to disable LTO to build there.

I've got an i-5 CoffeeLake with 32G to build on as well, so it looks like if I want LTO, I'll have to build there.

Thank you two for your help! I'll leave this open overnight and then swing back and mark it [Solved] -- just in case you have some additional pearls of wisdom on the oom ld issue I should consider and try.

Thank you again!

Last edited by drankinatty (2026-08-27 04:25:02)


David C. Rankin, J.D.,P.E.

Offline

Board footer

Powered by FluxBB