[GH-ISSUE #1008] Bug: Failed to install python packages: a bytes-like object is required, not 'str' #2143

Closed
opened 2026-03-01 17:56:49 +03:00 by kerem · 5 comments
Owner

Originally created by @junpet on GitHub (Jul 30, 2022).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1008

Describe the bug

Tried to run docker-compose run archivebox init --setup and got Failed to install python packages: a bytes-like object is required, not 'str'.

[+] Installing enabled ArchiveBox dependencies automatically...

    Installing YOUTUBEDL_BINARY automatically using pip...
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: youtube_dl in /usr/local/lib/python3.10/site-packages (2021.12.17)
WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
[X] Failed to install python packages: a bytes-like object is required, not 'str'
ERROR: 1

Steps to reproduce

  1. Used the following docker-compose.yml.
services:
  archivebox:
    image: archivebox/archivebox
    container_name: archivebox
    restart: always
    command: server --quick-init 0.0.0.0:8000
    env_file:
      - archivebox.env
    volumes:
      - archivebox-data:/data
    networks:
      - traefik2-network
    labels:
      - "traefik.enable=true"
      ## HTTP Routers
      - "traefik.http.routers.archivebox-rtr.entrypoints=https"
      - "traefik.http.routers.archivebox-rtr.rule=Host(`ab.$CLOUDFLARE_DOMAINNAME`)"
      - "traefik.http.routers.archivebox-rtr.tls=true"
      ## Middlewares
      - "traefik.http.routers.archivebox-rtr.middlewares=no-auth-chain@file"
      ## HTTP Services
      - "traefik.http.routers.archivebox-rtr.service=archivebox-svc"
      - "traefik.http.services.archivebox-svc.loadbalancer.server.port=8000"

volumes:
  archivebox-data:
    driver: local-persist
    driver_opts:
      mountpoint: ${DOCKER_VOLUMES}/archivebox

networks:
  traefik2-network:
    external: true

Content of archivebox.env:

SUBMIT_ARCHIVE_DOT_ORG=False
OUTPUT_PERMISSIONS=755
ONLY_NEW=False
TIMEOUT=120
SAVE_TITLE=True
SAVE_FAVICON=True
SAVE_WGET=False
SAVE_WARC=False
SAVE_PDF=True
SAVE_SCREENSHOT=False
SAVE_DOM=False
SAVE_SINGLEFILE=True
SAVE_READABILITY=True
SAVE_MERCURY=False
SAVE_GIT=False
SAVE_MEDIA=False
SAVE_ARCHIVE_DOT_ORG=False
USE_COLOR=True
PUBLIC_INDEX=False
PUBLIC_SNAPSHOTS=False
PUBLIC_ADD_VIEW=False
TIME_ZONE=Europe/Brussels
  1. Run docker-compose run archivebox init --setup.
  2. Got the following output:
[+] Installing enabled ArchiveBox dependencies automatically...

    Installing YOUTUBEDL_BINARY automatically using pip...
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: youtube_dl in /usr/local/lib/python3.10/site-packages (2021.12.17)
WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
[X] Failed to install python packages: a bytes-like object is required, not 'str'
ERROR: 1

Screenshots or log output

[+] Installing enabled ArchiveBox dependencies automatically...

    Installing YOUTUBEDL_BINARY automatically using pip...
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: youtube_dl in /usr/local/lib/python3.10/site-packages (2021.12.17)
WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
[X] Failed to install python packages: a bytes-like object is required, not 'str'
ERROR: 1

ArchiveBox version

ArchiveBox v0.6.3
Cpython Linux Linux-5.10.0-15-amd64-x86_64-with-glibc2.31 x86_64
IN_DOCKER=True DEBUG=False IS_TTY=True TZ=UTC SEARCH_BACKEND_ENGINE=ripgrep

[i] Dependency versions:
 √  ARCHIVEBOX_BINARY     v0.6.3          valid     /usr/local/bin/archivebox                                                   
 √  PYTHON_BINARY         v3.10.4         valid     /usr/local/bin/python3.10                                                   
 √  DJANGO_BINARY         v3.1.14         valid     /usr/local/lib/python3.10/site-packages/django/bin/django-admin.py          
 √  CURL_BINARY           v7.74.0         valid     /usr/bin/curl                                                               
 -  WGET_BINARY           -               disabled  /usr/bin/wget                                                               
 √  NODE_BINARY           v17.9.0         valid     /usr/bin/node                                                               
 √  SINGLEFILE_BINARY     v0.3.16         valid     /node/node_modules/single-file/cli/single-file                              
 √  READABILITY_BINARY    v0.0.2          valid     /node/node_modules/readability-extractor/readability-extractor              
 -  MERCURY_BINARY        -               disabled  /node/node_modules/@postlight/mercury-parser/cli.js                         
 -  GIT_BINARY            -               disabled  /usr/bin/git                                                                
 -  YOUTUBEDL_BINARY      -               disabled  /usr/local/bin/yt-dlp                                                       
 √  CHROME_BINARY         v101.0.4951.41  valid     /usr/bin/chromium                                                           
 √  RIPGREP_BINARY        v12.1.1         valid     /usr/bin/rg                                                                 

[i] Source-code locations:
 √  PACKAGE_DIR           24 files        valid     /app/archivebox                                                             
 √  TEMPLATES_DIR         4 files         valid     /app/archivebox/templates                                                   
 -  CUSTOM_TEMPLATES_DIR  -               disabled                                                                              

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

[i] Data locations:
 √  OUTPUT_DIR            5 files         valid     /data                                                                       
 √  SOURCES_DIR           0 files         valid     ./sources                                                                   
 √  LOGS_DIR              1 files         valid     ./logs                                                                      
 √  ARCHIVE_DIR           0 files         valid     ./archive                                                                   
 √  CONFIG_FILE           81.0 Bytes      valid     ./ArchiveBox.conf                                                           
 √  SQL_INDEX             204.0 KB        valid     ./index.sqlite3   
Originally created by @junpet on GitHub (Jul 30, 2022). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1008 #### Describe the bug Tried to run `docker-compose run archivebox init --setup` and got `Failed to install python packages: a bytes-like object is required, not 'str'`. ```logs [+] Installing enabled ArchiveBox dependencies automatically... Installing YOUTUBEDL_BINARY automatically using pip... Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: youtube_dl in /usr/local/lib/python3.10/site-packages (2021.12.17) WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available. You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command. [X] Failed to install python packages: a bytes-like object is required, not 'str' ERROR: 1 ``` #### Steps to reproduce 1. Used the following `docker-compose.yml`. ```yml services: archivebox: image: archivebox/archivebox container_name: archivebox restart: always command: server --quick-init 0.0.0.0:8000 env_file: - archivebox.env volumes: - archivebox-data:/data networks: - traefik2-network labels: - "traefik.enable=true" ## HTTP Routers - "traefik.http.routers.archivebox-rtr.entrypoints=https" - "traefik.http.routers.archivebox-rtr.rule=Host(`ab.$CLOUDFLARE_DOMAINNAME`)" - "traefik.http.routers.archivebox-rtr.tls=true" ## Middlewares - "traefik.http.routers.archivebox-rtr.middlewares=no-auth-chain@file" ## HTTP Services - "traefik.http.routers.archivebox-rtr.service=archivebox-svc" - "traefik.http.services.archivebox-svc.loadbalancer.server.port=8000" volumes: archivebox-data: driver: local-persist driver_opts: mountpoint: ${DOCKER_VOLUMES}/archivebox networks: traefik2-network: external: true ``` Content of `archivebox.env`: ```conf SUBMIT_ARCHIVE_DOT_ORG=False OUTPUT_PERMISSIONS=755 ONLY_NEW=False TIMEOUT=120 SAVE_TITLE=True SAVE_FAVICON=True SAVE_WGET=False SAVE_WARC=False SAVE_PDF=True SAVE_SCREENSHOT=False SAVE_DOM=False SAVE_SINGLEFILE=True SAVE_READABILITY=True SAVE_MERCURY=False SAVE_GIT=False SAVE_MEDIA=False SAVE_ARCHIVE_DOT_ORG=False USE_COLOR=True PUBLIC_INDEX=False PUBLIC_SNAPSHOTS=False PUBLIC_ADD_VIEW=False TIME_ZONE=Europe/Brussels ``` 2. Run `docker-compose run archivebox init --setup`. 3. Got the following output: ```logs [+] Installing enabled ArchiveBox dependencies automatically... Installing YOUTUBEDL_BINARY automatically using pip... Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: youtube_dl in /usr/local/lib/python3.10/site-packages (2021.12.17) WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available. You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command. [X] Failed to install python packages: a bytes-like object is required, not 'str' ERROR: 1 ``` #### Screenshots or log output ```logs [+] Installing enabled ArchiveBox dependencies automatically... Installing YOUTUBEDL_BINARY automatically using pip... Defaulting to user installation because normal site-packages is not writeable Requirement already satisfied: youtube_dl in /usr/local/lib/python3.10/site-packages (2021.12.17) WARNING: You are using pip version 22.0.4; however, version 22.2.1 is available. You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command. [X] Failed to install python packages: a bytes-like object is required, not 'str' ERROR: 1 ``` #### ArchiveBox version <!-- Run the `archivebox version` command locally then copy paste the result here: --> ```logs ArchiveBox v0.6.3 Cpython Linux Linux-5.10.0-15-amd64-x86_64-with-glibc2.31 x86_64 IN_DOCKER=True DEBUG=False IS_TTY=True TZ=UTC SEARCH_BACKEND_ENGINE=ripgrep [i] Dependency versions: √ ARCHIVEBOX_BINARY v0.6.3 valid /usr/local/bin/archivebox √ PYTHON_BINARY v3.10.4 valid /usr/local/bin/python3.10 √ DJANGO_BINARY v3.1.14 valid /usr/local/lib/python3.10/site-packages/django/bin/django-admin.py √ CURL_BINARY v7.74.0 valid /usr/bin/curl - WGET_BINARY - disabled /usr/bin/wget √ NODE_BINARY v17.9.0 valid /usr/bin/node √ SINGLEFILE_BINARY v0.3.16 valid /node/node_modules/single-file/cli/single-file √ READABILITY_BINARY v0.0.2 valid /node/node_modules/readability-extractor/readability-extractor - MERCURY_BINARY - disabled /node/node_modules/@postlight/mercury-parser/cli.js - GIT_BINARY - disabled /usr/bin/git - YOUTUBEDL_BINARY - disabled /usr/local/bin/yt-dlp √ CHROME_BINARY v101.0.4951.41 valid /usr/bin/chromium √ RIPGREP_BINARY v12.1.1 valid /usr/bin/rg [i] Source-code locations: √ PACKAGE_DIR 24 files valid /app/archivebox √ TEMPLATES_DIR 4 files valid /app/archivebox/templates - CUSTOM_TEMPLATES_DIR - disabled [i] Secrets locations: - CHROME_USER_DATA_DIR - disabled - COOKIES_FILE - disabled [i] Data locations: √ OUTPUT_DIR 5 files valid /data √ SOURCES_DIR 0 files valid ./sources √ LOGS_DIR 1 files valid ./logs √ ARCHIVE_DIR 0 files valid ./archive √ CONFIG_FILE 81.0 Bytes valid ./ArchiveBox.conf √ SQL_INDEX 204.0 KB valid ./index.sqlite3 ```
kerem 2026-03-01 17:56:49 +03:00
Author
Owner

@pirate commented on GitHub (Jul 30, 2022):

In docker you don't need to run --setup, docker-compose run archivebox init is enough.

<!-- gh-comment-id:1200237717 --> @pirate commented on GitHub (Jul 30, 2022): In docker you don't need to run `--setup`, `docker-compose run archivebox init` is enough.
Author
Owner

@junpet commented on GitHub (Jul 30, 2022):

Thanks. Maybe the readme.md file shoud be fiexed.
image

<!-- gh-comment-id:1200244234 --> @junpet commented on GitHub (Jul 30, 2022): Thanks. Maybe the readme.md file shoud be fiexed. ![image](https://user-images.githubusercontent.com/3465278/181925169-e4619434-8b9f-4b4d-8821-fe8cbf1b4112.png)
Author
Owner

@pirate commented on GitHub (Jul 31, 2022):

I'm actually going to re-open this because this issue shouldn't happen even in docker, it's a sign that there's a b'...' or missing .decode() somewhere.

<!-- gh-comment-id:1200351712 --> @pirate commented on GitHub (Jul 31, 2022): I'm actually going to re-open this because this issue shouldn't happen even in docker, it's a sign that there's a `b'...'` or missing `.decode()` somewhere.
Author
Owner

@dcalano commented on GitHub (Aug 3, 2023):

Hey, just following up on this issue. Is this still a problem or has the issue been resolved?

<!-- gh-comment-id:1663890767 --> @dcalano commented on GitHub (Aug 3, 2023): Hey, just following up on this issue. Is this still a problem or has the issue been resolved?
Author
Owner

@pirate commented on GitHub (Aug 3, 2023):

Should be resolved 👍

<!-- gh-comment-id:1664166218 --> @pirate commented on GitHub (Aug 3, 2023): Should be resolved 👍
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#2143
No description provided.