nextcloud / llm

A Nextcloud app that packages a large language model (Llama2 / GPT4All Falcon)
24 stars 2 forks source link

[Bug]: llm traceback: No module named 'langchain' #10

Closed 2Bornot2BequalsFF closed 1 year ago

2Bornot2BequalsFF commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

Starting Nextcloud Assistent with local LLM installed (Status: Model downloaded successfully, App installed, selected Model Llama2 7B; Python executable executed successfully and setip works) Enter a free prompt

Every job fails.

System log entry:

Traceback (most recent call last): File "/var/www/html/nextcloud/apps/llm/src-py/index.py", line 3, in from chains.formalize import FormalizeChain File "/var/www/html/nextcloud/apps/llm/src-py/chains/formalize.py", line 2, in from langchain import BasePromptTemplate, PromptTemplate ModuleNotFoundError: No module named 'langchain'

Nextcloud release: 27.1.2 RC1

Steps to reproduce

  1. Install Nextcloud Assistent, local LLM, download LLM
  2. Run Nextcloud Assitent (stars icon at the top right)
  3. Request a free prompt and ask for something.

Expected behavior

Jobs should finish correctly

Installation method

Community Manual installation with Archive

Nextcloud Server version

27

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "192.168.123.9",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "27.1.2.0",
        "overwrite.cli.url": "http:\/\/192.168.123.9",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpport": "25",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "DE",
        "updater.release.channel": "beta",
        "maintenance": false,
        "loglevel": 2,
        "enable_previews": false,
        "filelocking.enabled": true,
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "memchache.local": "\\OC\\Memcache\\APCu"
    }
}

List of activated Apps

Enabled:
  - activity: 2.19.0
  - assistant: 1.0.1
  - bruteforcesettings: 2.7.0
  - circles: 27.0.1
  - cloud_federation_api: 1.10.0
  - comments: 1.17.0
  - contactsinteraction: 1.8.0
  - dav: 1.27.0
  - deck: 1.11.0
  - drawio: 2.1.2
  - federatedfilesharing: 1.17.0
  - federation: 1.17.0
  - files: 1.22.0
  - files_bpm: 1.2.0
  - files_mindmap: 0.0.29
  - files_pdfviewer: 2.8.0
  - files_reminders: 1.0.0
  - files_rightclick: 1.6.0
  - files_sharing: 1.19.0
  - files_trashbin: 1.17.0
  - files_versions: 1.20.0
  - firstrunwizard: 2.16.0
  - forms: 3.3.1
  - integration_openai: 1.0.13
  - llm: 1.0.1
  - logreader: 2.12.0
  - lookup_server_connector: 1.15.0
  - nextcloud_announcements: 1.16.0
  - notifications: 2.15.0
  - oauth2: 1.15.1
  - password_policy: 1.17.0
  - photos: 2.3.0
  - privacy: 1.11.0
  - provisioning_api: 1.17.0
  - recommendations: 1.6.0
  - related_resources: 1.2.0
  - richdocuments: 8.2.0
  - richdocumentscode: 23.5.402
  - serverinfo: 1.17.0
  - settings: 1.9.0
  - sharebymail: 1.17.0
  - spreed: 17.1.1
  - stt_whisper: 1.0.6
  - support: 1.10.0
  - survey_client: 1.15.0
  - systemtags: 1.17.0
  - text: 3.8.0
  - theming: 2.2.0
  - twofactor_backupcodes: 1.16.0
  - updatenotification: 1.17.0
  - user_status: 1.7.0
  - viewer: 2.1.0
  - weather_status: 1.7.0
  - workflowengine: 2.9.0
Disabled:
  - admin_audit: 1.17.0
  - dashboard: 7.7.0 (installed 7.7.0)
  - encryption: 2.15.0
  - files_external: 1.19.0
  - suspicious_login: 5.0.0
  - twofactor_totp: 9.0.0
  - user_ldap: 1.17.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

Fehler  PHP Undefined variable $notificationActionLabel at /var/www/html/nextcloud/apps/assistant/lib/Listener/TaskFailedListener.php#46        2023-10-03T16:10:02+0200
Warnung llm Traceback (most recent call last): File "/var/www/html/nextcloud/apps/llm/src-py/index.py", line 3, in <module> from chains.formalize import FormalizeChain File "/var/www/html/nextcloud/apps/llm/src-py/chains/formalize.py", line 2, in <module> from langchain import BasePromptTemplate, PromptTemplate ModuleNotFoundError: No module named 'langchain'       2023-10-03T16:10:02+0200
Fehler  PHP Undefined variable $notificationActionLabel at /var/www/html/nextcloud/apps/assistant/lib/Listener/TaskFailedListener.php#46        2023-10-03T15:20:03+0200
Warnung llm Traceback (most recent call last): File "/var/www/html/nextcloud/apps/llm/src-py/index.py", line 3, in <module> from chains.formalize import FormalizeChain File "/var/www/html/nextcloud/apps/llm/src-py/chains/formalize.py", line 2, in <module> from langchain import BasePromptTemplate, PromptTemplate ModuleNotFoundError: No module named 'langchain'       2023-10-03T15:20:03+0200
Fehler  PHP Undefined variable $notificationActionLabel at /var/www/html/nextcloud/apps/assistant/lib/Listener/TaskFailedListener.php#46        2023-10-03T15:20:03+0200
Warnung llm Traceback (most recent call last): File "/var/www/html/nextcloud/apps/llm/src-py/index.py", line 3, in <module> from chains.formalize import FormalizeChain File "/var/www/html/nextcloud/apps/llm/src-py/chains/formalize.py", line 2, in <module> from langchain import BasePromptTemplate, PromptTemplate ModuleNotFoundError: No module named 'langchain'       2023-10-03T15:20:03+0200
Fehler  PHP Undefined variable $notificationActionLabel at /var/www/html/nextcloud/apps/assistant/lib/Listener/TaskFailedListener.php#46        2023-10-03T15:00:04+0200
Warnung llm Traceback (most recent call last): File "/var/www/html/nextcloud/apps/llm/src-py/index.py", line 3, in <module> from chains.formalize import FormalizeChain File "/var/www/html/nextcloud/apps/llm/src-py/chains/formalize.py", line 2, in <module> from langchain import BasePromptTemplate, PromptTemplate ModuleNotFoundError: No module named 'langchain'       2023-10-03T15:00:04+0200
Fehler  PHP Undefined variable $notificationActionLabel at /var/www/html/nextcloud/apps/assistant/lib/Listener/TaskFailedListener.php#46        2023-10-03T15:00:03+0200
Warnung llm Traceback (most recent call last): File "/var/www/html/nextcloud/apps/llm/src-py/index.py", line 3, in <module> from chains.formalize import FormalizeChain File "/var/www/html/nextcloud/apps/llm/src-py/chains/formalize.py", line 2, in <module> from langchain import BasePromptTemplate, PromptTemplate ModuleNotFoundError: No module named 'langchain'       2023-10-03T15:00:03+0200

Additional info

Nextcloud 27.1.2 RC 1

jjqoie commented 1 year ago

Have the same problem - use nextcloud docker compose for apache (Nextcloud Hub 6 (27.1.1)) Try to installing langchain via pip3 install langchain which fails and complain "This environment is externally managed..."

thanks best regards Jochen

marcelklehr commented 1 year ago

Which docker container are you using? You do need python-venv in the container, which may not be there in the default images. I've just successfully installed the app on the 27.1.1-apache container with

apt update && apt install python3.11-venv
php occ app:enable llm

on the alpine things inevitably fail, for lots of reasons. (one of them being that poetry wants to build some native python modules)

jjqoie commented 1 year ago

thx for your reply

my dockerfile is based on nextcloud:27-apache which has installed NEXTCLOUD_VERSION 27.1.1

FROM nextcloud:27-apache

RUN apt-get update && apt-get install -y procps smbclient && rm -rf /var/lib/apt/lists/ RUN echo '0 4 php -f /var/www/html/occ preview:pre-generate' >> /var/spool/cron/crontabs/www-data

COPY mpm_prefork.conf /etc/apache2/mods-enabled/

COPY my.cnf /etc/mysql/

I will add python3.11-venv to the image and redeploy - let's see...

jjqoie commented 1 year ago

grafik

worked thanks

marcelklehr commented 1 year ago

Yay, glad it works now :)