linuxserver / docker-diskover

A Docker container for the Diskover space mapping application
GNU General Public License v3.0
76 stars 16 forks source link

[BUG] ModuleNotFoundError: No module named 'distutils' #64

Closed Fvvp closed 2 months ago

Fvvp commented 2 months ago

Is there an existing issue for this?

Current Behavior

docker exec -u abc -it diskover python3 /app/diskover/diskover.py -i diskover-my_index_name /data

returns the following:

/app/diskover/diskover.py:920: SyntaxWarning: invalid escape sequence '\ '
  print("""\u001b[31;1m
Traceback (most recent call last):
  File "/app/diskover/diskover.py", line 34, in <module>
    from diskover_elasticsearch import elasticsearch_connection, \
  File "/app/diskover/diskover_elasticsearch.py", line 25, in <module>
    from diskover_helpers import config, load_plugins
  File "/app/diskover/diskover_helpers.py", line 39, in <module>
    from diskover_db import db_getconfig
  File "/app/diskover/diskover_db.py", line 24, in <module>
    from distutils.util import strtobool
ModuleNotFoundError: No module named 'distutils'

which can be traced to app/diskover/diskover_db.py at the start of the file:

import os
import sys
import sqlite3
import json
import confuse
from distutils.util import strtobool   # <<<here
from config_defaults import conf

because of that elasticsearch crawler cannot be created and diskover cannot be used.

Expected Behavior

in prelminary testing, editing app/diskover/diskover_db.py with the following code allowed things to go on

import os
import sys
import sqlite3
import json
import confuse
#from distutils.util import strtobool

# Custom implementation of strtobool via llama-3.1-sonar-large-128k-online
def strtobool(value: str) -> bool:
    """Convert a string to a boolean value."""
    value = value.lower()
    if value in ("y", "yes", "on", "1", "true", "t"):
        return True
    elif value in ("n", "no", "off", "0", "false", "f"):
        return False
    else:
        raise ValueError("Invalid boolean value")

from config_defaults import conf

(...)

now docker exec -u abc -it diskover python3 /app/diskover/diskover.py -i diskover-my_index_name /data returns the output below and diskover webui SEEMS to be working as expected.


/app/diskover/diskover.py:920: SyntaxWarning: invalid escape sequence '\ '
  print("""\u001b[31;1m

            _ _     _
           | (_)   | |
         __| |_ ___| | _______   _____ _ __
        / _` | / __| |/ / _ \ \ / / _ \ '__| /)___(\
       | (_| | \__ \   < (_) \ V /  __/ |    (='.'=)
        \__,_|_|___/_|\_\___/ \_/ \___|_|   (\")_(\")

            "Bringing light to the darkness."
            v2.3.0 community edition (ce)
            https://diskoverdata.com

/lsiopy/lib/python3.12/site-packages/elasticsearch/connection/base.py:208: ElasticsearchWarning: Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/security-minimal-setup.html to enable security.
  warnings.warn(message, category=ElasticsearchWarning)
2024-09-14 16:57:49,711 - diskover - WARNING - Index diskover-my_index_name already exists, not crawling, use -f to overwrite.

Steps To Reproduce

  1. deploy linuxserver/docker-diskover with image: lscr.io/linuxserver/diskover:latest
  2. after everything is running, run at cli docker exec -u abc -it diskover python3 /app/diskover/diskover.py -i diskover-my_index_name /data

Environment

- OS:
- How docker service was installed:

CPU architecture

x86-64

Docker creation

version: '2'
services:
  diskover:
    image: lscr.io/linuxserver/diskover:latest
    container_name: diskover
    environment:
      - PUID=1000
      - PGID=100
      - TZ=America/New_York
      - ES_HOST=elasticsearch
      - ES_PORT=9200
    volumes:
      - ./diskover/config:/config
      - ./diskover/data:/data
     # - ./data/messingaround/app/diskover:/app/diskover
    ports:
      - 80:80
    mem_limit: 4096m
    restart: unless-stopped
    depends_on:
      - elasticsearch
  elasticsearch:
    container_name: elasticsearch
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.22
    environment:
      - discovery.type=single-node
      - xpack.security.enabled=false
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    depends_on:
      - elasticsearch-helper
    restart: unless-stopped
  elasticsearch-helper:
    image: alpine
    command: sh -c "sysctl -w vm.max_map_count=262144"
    privileged: true

volumes:
    esdata:

Container logs

(...)
Linuxserver.io version: v2.3.0-ls167
Build-date: 2024-09-12T11:10:38+00:00
───────────────────────────────────────

using keys found in /config/keys
[custom-init] No custom files found, skipping...
[ls.io-init] done.
github-actions[bot] commented 2 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.