[GH-ISSUE #1560] Bug: v0.7.x on Python 3.12 errors due to missing setuptools, distutils dependencies #3950

Closed
opened 2026-03-15 01:05:21 +03:00 by kerem · 1 comment
Owner

Originally created by @jvoisin on GitHub (Oct 21, 2024).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1560

(venv) $ /media/nfs/archives $ archivebox init
Traceback (most recent call last):
  File "/home/archivebox/venv/bin/archivebox", line 5, in <module>
    from archivebox.cli import main
  File "/home/archivebox/venv/lib/python3.12/site-packages/archivebox/cli/__init__.py", line 11, in <module>
    from ..config import OUTPUT_DIR, check_data_folder, check_migrations
  File "/home/archivebox/venv/lib/python3.12/site-packages/archivebox/config.py", line 33, in <module>
    import django
  File "/home/archivebox/venv/lib/python3.12/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/home/archivebox/venv/lib/python3.12/site-packages/django/utils/version.py", line 6, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
(venv) $ archivebox version
Traceback (most recent call last):
  File "/home/archivebox/venv/bin/archivebox", line 5, in <module>
    from archivebox.cli import main
  File "/home/archivebox/venv/lib/python3.12/site-packages/archivebox/cli/__init__.py", line 11, in <module>
    from ..config import OUTPUT_DIR, check_data_folder, check_migrations
  File "/home/archivebox/venv/lib/python3.12/site-packages/archivebox/config.py", line 33, in <module>
    import django
  File "/home/archivebox/venv/lib/python3.12/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/home/archivebox/venv/lib/python3.12/site-packages/django/utils/version.py", line 6, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'
(venv) $ 

The root cause seems to be that Python ≥3.12 does not come with a stdlib distutils module anymore, because distutils was deprecated in 3.10 and removed in 3.12. See PEP 632 – Deprecate distutils module.

This can be fixed by pip install setuptools, so we might want to add it to the list of ArchiveBox' dependencies.

(venv) $ archivebox version
/usr/bin/wget: unrecognized option: version
BusyBox v1.37.0 (2024-10-21 20:09:51 UTC) multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR]
        [--post-data STR | --post-file FILE] [-Y on/off]
        [-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        --header STR    Add STR (of form 'header: value') to headers
        --post-data STR Send STR using POST method
        --post-file FILE        Send FILE using POST method
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -o LOGFILE      Log messages to FILE
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy
/usr/bin/wget: unrecognized option: version
BusyBox v1.37.0 (2024-10-21 20:09:51 UTC) multi-call binary.

Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR]
        [--post-data STR | --post-file FILE] [-Y on/off]
        [-P DIR] [-U AGENT] [-T SEC] URL...

Retrieve files via HTTP or FTP

        --spider        Only check URL existence: $? is 0 if exists
        --header STR    Add STR (of form 'header: value') to headers
        --post-data STR Send STR using POST method
        --post-file FILE        Send FILE using POST method
        -c              Continue retrieval of aborted transfer
        -q              Quiet
        -P DIR          Save to DIR (default .)
        -S              Show server response
        -T SEC          Network read timeout is SEC seconds
        -O FILE         Save to FILE ('-' for stdout)
        -o LOGFILE      Log messages to FILE
        -U STR          Use STR for User-Agent header
        -Y on/off       Use proxy
0.7.1
ArchiveBox v0.7.1 Cpython Linux Linux-6.8.12-2-pve-x86_64-with x86_64
DEBUG=False IN_DOCKER=False IN_QEMU=False IS_TTY=True TZ=UTC FS_ATOMIC=True FS_REMOTE=True FS_USER=1000:1000 FS_PERMS=644 SEARCH_BACKEND=ripgrep

[i] Dependency versions:
 √  PYTHON_BINARY         v3.12.7         valid     /usr/bin/python3.12                                                         
 √  SQLITE_BINARY         v2.6.0          valid     /usr/lib/python3.12/sqlite3/dbapi2.py                                       
 √  DJANGO_BINARY         v3.1.14         valid     /home/archivebox/venv/lib/python3.12/site-packages/django/__init__.py       
 √  ARCHIVEBOX_BINARY     v0.7.1          valid     /home/archivebox/venv/bin/archivebox                                        

 X  CURL_BINARY           ?               invalid   curl                                                                        
 X  WGET_BINARY           ?               invalid   /usr/bin/wget                                                               
 X  NODE_BINARY           ?               invalid   node                                                                        
 X  SINGLEFILE_BINARY     ?               invalid   single-file                                                                 
 X  READABILITY_BINARY    ?               invalid   readability-extractor                                                       
 X  MERCURY_BINARY        ?               invalid   postlight-parser                                                            
 X  GIT_BINARY            ?               invalid   git                                                                         
 √  YOUTUBEDL_BINARY      v2024.10.07     valid     /home/archivebox/venv/bin/yt-dlp                                            
 -  CHROME_BINARY         -               disabled  None                                                                        
 X  RIPGREP_BINARY        ?               invalid   rg                                                                          

[i] Source-code locations:
 √  PACKAGE_DIR           24 files        valid     /home/archivebox/venv/lib/python3.12/site-packages/archivebox               
 √  TEMPLATES_DIR         4 files         valid     /home/archivebox/venv/lib/python3.12/site-packages/archivebox/templates     
 -  CUSTOM_TEMPLATES_DIR  -               disabled  None                                                                        

[i] Secrets locations:
 -  CHROME_USER_DATA_DIR  -               disabled  None                                                                        
 -  COOKIES_FILE          -               disabled  None                                                                        


[i] Data locations:

[!] Warning: Missing 8 recommended dependencies
    ! CURL_BINARY: curl (unable to detect version)
    ! WGET_BINARY: /usr/bin/wget (unable to detect version)
    ! NODE_BINARY: node (unable to detect version)
    ! SINGLEFILE_BINARY: single-file (unable to detect version)
      Hint: To install all packages automatically run: archivebox setup
            or to disable it and silence this warning: archivebox config --set SAVE_SINGLEFILE=False
            
    ! READABILITY_BINARY: readability-extractor (unable to detect version)
      Hint: To install all packages automatically run: archivebox setup
            or to disable it and silence this warning: archivebox config --set SAVE_READABILITY=False
            
    ! MERCURY_BINARY: postlight-parser (unable to detect version)
      Hint: To install all packages automatically run: archivebox setup
            or to disable it and silence this warning: archivebox config --set SAVE_MERCURY=False
            
    ! GIT_BINARY: git (unable to detect version)
    ! RIPGREP_BINARY: rg (unable to detect version)

(venv) $ 
Originally created by @jvoisin on GitHub (Oct 21, 2024). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1560 ```console (venv) $ /media/nfs/archives $ archivebox init Traceback (most recent call last): File "/home/archivebox/venv/bin/archivebox", line 5, in <module> from archivebox.cli import main File "/home/archivebox/venv/lib/python3.12/site-packages/archivebox/cli/__init__.py", line 11, in <module> from ..config import OUTPUT_DIR, check_data_folder, check_migrations File "/home/archivebox/venv/lib/python3.12/site-packages/archivebox/config.py", line 33, in <module> import django File "/home/archivebox/venv/lib/python3.12/site-packages/django/__init__.py", line 1, in <module> from django.utils.version import get_version File "/home/archivebox/venv/lib/python3.12/site-packages/django/utils/version.py", line 6, in <module> from distutils.version import LooseVersion ModuleNotFoundError: No module named 'distutils' (venv) $ archivebox version Traceback (most recent call last): File "/home/archivebox/venv/bin/archivebox", line 5, in <module> from archivebox.cli import main File "/home/archivebox/venv/lib/python3.12/site-packages/archivebox/cli/__init__.py", line 11, in <module> from ..config import OUTPUT_DIR, check_data_folder, check_migrations File "/home/archivebox/venv/lib/python3.12/site-packages/archivebox/config.py", line 33, in <module> import django File "/home/archivebox/venv/lib/python3.12/site-packages/django/__init__.py", line 1, in <module> from django.utils.version import get_version File "/home/archivebox/venv/lib/python3.12/site-packages/django/utils/version.py", line 6, in <module> from distutils.version import LooseVersion ModuleNotFoundError: No module named 'distutils' (venv) $ ``` The root cause seems to be that Python ≥3.12 [does not come with a stdlib distutils module anymore](https://docs.python.org/3/whatsnew/3.12.html), because distutils was deprecated in 3.10 and removed in 3.12. See [PEP 632 – *Deprecate distutils module*](https://peps.python.org/pep-0632/). This can be fixed by `pip install setuptools`, so we might want to add it to the list of ArchiveBox' dependencies. ``` (venv) $ archivebox version /usr/bin/wget: unrecognized option: version BusyBox v1.37.0 (2024-10-21 20:09:51 UTC) multi-call binary. Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR] [--post-data STR | --post-file FILE] [-Y on/off] [-P DIR] [-U AGENT] [-T SEC] URL... Retrieve files via HTTP or FTP --spider Only check URL existence: $? is 0 if exists --header STR Add STR (of form 'header: value') to headers --post-data STR Send STR using POST method --post-file FILE Send FILE using POST method -c Continue retrieval of aborted transfer -q Quiet -P DIR Save to DIR (default .) -S Show server response -T SEC Network read timeout is SEC seconds -O FILE Save to FILE ('-' for stdout) -o LOGFILE Log messages to FILE -U STR Use STR for User-Agent header -Y on/off Use proxy /usr/bin/wget: unrecognized option: version BusyBox v1.37.0 (2024-10-21 20:09:51 UTC) multi-call binary. Usage: wget [-cqS] [--spider] [-O FILE] [-o LOGFILE] [--header STR] [--post-data STR | --post-file FILE] [-Y on/off] [-P DIR] [-U AGENT] [-T SEC] URL... Retrieve files via HTTP or FTP --spider Only check URL existence: $? is 0 if exists --header STR Add STR (of form 'header: value') to headers --post-data STR Send STR using POST method --post-file FILE Send FILE using POST method -c Continue retrieval of aborted transfer -q Quiet -P DIR Save to DIR (default .) -S Show server response -T SEC Network read timeout is SEC seconds -O FILE Save to FILE ('-' for stdout) -o LOGFILE Log messages to FILE -U STR Use STR for User-Agent header -Y on/off Use proxy 0.7.1 ArchiveBox v0.7.1 Cpython Linux Linux-6.8.12-2-pve-x86_64-with x86_64 DEBUG=False IN_DOCKER=False IN_QEMU=False IS_TTY=True TZ=UTC FS_ATOMIC=True FS_REMOTE=True FS_USER=1000:1000 FS_PERMS=644 SEARCH_BACKEND=ripgrep [i] Dependency versions: √ PYTHON_BINARY v3.12.7 valid /usr/bin/python3.12 √ SQLITE_BINARY v2.6.0 valid /usr/lib/python3.12/sqlite3/dbapi2.py √ DJANGO_BINARY v3.1.14 valid /home/archivebox/venv/lib/python3.12/site-packages/django/__init__.py √ ARCHIVEBOX_BINARY v0.7.1 valid /home/archivebox/venv/bin/archivebox X CURL_BINARY ? invalid curl X WGET_BINARY ? invalid /usr/bin/wget X NODE_BINARY ? invalid node X SINGLEFILE_BINARY ? invalid single-file X READABILITY_BINARY ? invalid readability-extractor X MERCURY_BINARY ? invalid postlight-parser X GIT_BINARY ? invalid git √ YOUTUBEDL_BINARY v2024.10.07 valid /home/archivebox/venv/bin/yt-dlp - CHROME_BINARY - disabled None X RIPGREP_BINARY ? invalid rg [i] Source-code locations: √ PACKAGE_DIR 24 files valid /home/archivebox/venv/lib/python3.12/site-packages/archivebox √ TEMPLATES_DIR 4 files valid /home/archivebox/venv/lib/python3.12/site-packages/archivebox/templates - CUSTOM_TEMPLATES_DIR - disabled None [i] Secrets locations: - CHROME_USER_DATA_DIR - disabled None - COOKIES_FILE - disabled None [i] Data locations: [!] Warning: Missing 8 recommended dependencies ! CURL_BINARY: curl (unable to detect version) ! WGET_BINARY: /usr/bin/wget (unable to detect version) ! NODE_BINARY: node (unable to detect version) ! SINGLEFILE_BINARY: single-file (unable to detect version) Hint: To install all packages automatically run: archivebox setup or to disable it and silence this warning: archivebox config --set SAVE_SINGLEFILE=False ! READABILITY_BINARY: readability-extractor (unable to detect version) Hint: To install all packages automatically run: archivebox setup or to disable it and silence this warning: archivebox config --set SAVE_READABILITY=False ! MERCURY_BINARY: postlight-parser (unable to detect version) Hint: To install all packages automatically run: archivebox setup or to disable it and silence this warning: archivebox config --set SAVE_MERCURY=False ! GIT_BINARY: git (unable to detect version) ! RIPGREP_BINARY: rg (unable to detect version) (venv) $ ```
Author
Owner

@pirate commented on GitHub (Oct 21, 2024):

This is already fixed in v0.8.x and above 👍.

At this point v0.7.x is no longer getting any new fixes/features as all development is focused on the upcoming v0.8.x/v0.9.x stable release.

For users still running v0.7.x I recommend running pip install setuptools manually if you are on Python 3.12.

<!-- gh-comment-id:2427878914 --> @pirate commented on GitHub (Oct 21, 2024): This is already fixed in v0.8.x and above 👍. At this point v0.7.x is no longer getting any new fixes/features as all development is focused on the upcoming v0.8.x/v0.9.x stable release. For users still running `v0.7.x` I recommend running `pip install setuptools` manually if you are on Python 3.12.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#3950
No description provided.