InvenTree icon indicating copy to clipboard operation
InvenTree copied to clipboard

Unknown command: collectplugins

Open inscrut opened this issue 8 months ago • 4 comments

Deployment Method

  • [ ] Installer
  • [ ] Docker Development
  • [ ] Docker Production
  • [x] Bare metal Development
  • [x] Bare metal Production
  • [ ] Digital Ocean image
  • [ ] Other (please provide a link Steps to Reproduce

Describe the problem*

Installing required python packages from '/home/inventree/src/config/plugins.txt'
2026-03-11 02:43:32,032 DEBUG Loading SECRET_KEY from '/home/inventree/src/config/secret_key.txt'
2026-03-11 02:43:32,033 DEBUG {'event': 'Configuring database backend:', 'timestamp': '2026-03-11T07:43:32.033656Z', 'logger': 'inventree', 'level': 'debug'}
2026-03-11 02:43:32,033 INFO {'event': 'DB_ENGINE: django.db.backends.postgresql', 'timestamp': '2026-03-11T07:43:32.033846Z', 'logger': 'inventree', 'level': 'info'}
2026-03-11 02:43:32,034 INFO {'event': 'DB_NAME: invneo', 'timestamp': '2026-03-11T07:43:32.033981Z', 'logger': 'inventree', 'level': 'info'}
2026-03-11 02:43:32,034 INFO {'event': 'DB_HOST: db.test.dmz', 'timestamp': '2026-03-11T07:43:32.034102Z', 'logger': 'inventree', 'level': 'info'}
**Unknown command: 'collectplugins'**
Type 'manage.py help' for usage.
Exception ignored in: <function PackBasedObjectStore.__del__ at 0x7b80878e3880>
Traceback (most recent call last):
  File "/home/inventree/env/lib/python3.12/site-packages/dulwich/object_store.py", line 1020, in __del__
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <function Pack.__del__ at 0x7b8087b90c20>
Traceback (most recent call last):
  File "/home/inventree/env/lib/python3.12/site-packages/dulwich/pack.py", line 4154, in __del__
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <function PackData.__del__ at 0x7b8087b77240>
Traceback (most recent call last):
  File "/home/inventree/env/lib/python3.12/site-packages/dulwich/pack.py", line 1879, in __del__
ImportError: sys.meta_path is None, Python is likely shutting down
ERROR: InvenTree command failed: 'python3 manage.py collectplugins'
- Refer to the error messages in the log above for more information

manage.py:

(env) inventree@inventreetemp:~/src/src/backend/InvenTree$ ./manage.py help
2026-03-11 03:49:50,494 DEBUG Loading SECRET_KEY from '/home/inventree/src/config/secret_key.txt'
2026-03-11 03:49:50,496 DEBUG {'event': 'Configuring database backend:', 'timestamp': '2026-03-11T08:49:50.495976Z', 'logger': 'inventree', 'level': 'debug'}
2026-03-11 03:49:50,496 INFO {'event': 'DB_ENGINE: django.db.backends.postgresql', 'timestamp': '2026-03-11T08:49:50.496138Z', 'logger': 'inventree', 'level': 'info'}
2026-03-11 03:49:50,496 INFO {'event': 'DB_NAME: invneo', 'timestamp': '2026-03-11T08:49:50.496232Z', 'logger': 'inventree', 'level': 'info'}
2026-03-11 03:49:50,496 INFO {'event': 'DB_HOST: db.test.dmz', 'timestamp': '2026-03-11T08:49:50.496312Z', 'logger': 'inventree', 'level': 'info'}

Type 'manage.py help <subcommand>' for help on a specific subcommand.

Available subcommands:

[django]
    check
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    loaddata
    makemessages
    makemigrations
    migrate
    optimizemigration
    runserver
    sendtestemail
    shell
    showmigrations
    sqlflush
    sqlmigrate
    sqlsequencereset
    squashmigrations
    startapp
    startproject
    test
    testserver
Note that only Django core commands are listed as settings are not properly configured (error: No module named 'psycopg2').
Exception ignored in: <function PackBasedObjectStore.__del__ at 0x73e91d0d3880>
Traceback (most recent call last):
  File "/home/inventree/env/lib/python3.12/site-packages/dulwich/object_store.py", line 1020, in __del__
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <function Pack.__del__ at 0x73e91d098c20>
Traceback (most recent call last):
  File "/home/inventree/env/lib/python3.12/site-packages/dulwich/pack.py", line 4154, in __del__
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <function PackData.__del__ at 0x73e91d2f3240>
Traceback (most recent call last):
  File "/home/inventree/env/lib/python3.12/site-packages/dulwich/pack.py", line 1879, in __del__
ImportError: sys.meta_path is None, Python is likely shutting down

(env) inventree@inventreetemp:~/src/src/backend/InvenTree$ pip install psycopg2-binary

after that, invoke update will work.

May be need add psycopg2 in req.txt ?

Steps to Reproduce

useradd -m -d /home/inventree -s /bin/bash inventree
usermod -aG sudo inventree
su - inventree
sudo apt update
sudo apt-get install python3 python3-dev python3-pip python3-invoke python3-venv git gcc g++ gettext gnupg poppler-utils libpango-1.0-0 libpangoft2-1.0-0 libjpeg-dev webp
cd ~/
git clone https://github.com/inventree/inventree src
python3 -m venv env
source ./env/bin/activate
pip install --upgrade --ignore-installed invoke
pip3 install psycopg pgcli
cd src/
nano config/config.yaml
nano /home/inventree/src/config/admin_password.txt
mkdir -p /home/inventree/data/media
mkdir -p /home/inventree/data/static
mkdir -p /home/inventree/data/backup
sudo apt-get install postgresql-client
sudo -u postgres psql

CREATE USER invneo WITH PASSWORD '1234';

CREATE DATABASE invneo OWNER invneo;

GRANT ALL PRIVILEGES ON DATABASE invneo TO invneo;


GRANT ALL ON SCHEMA public TO invneo;

ALTER SCHEMA public OWNER TO invneo;

\q
invoke install --skip-plugins
cd /home/inventree/src

invoke update --skip-backup --no-frontend
invoke update

inscrut avatar Mar 11 '26 09:03 inscrut

https://docs.inventree.org/en/latest/start/install/

May be update this manual? Not all cli command present in this manual.

For example, add fast info about fix default config.yaml:

database:
  ENGINE: postgresql
  NAME: 
  USER: 
  PASSWORD: 
  HOST: 
  PORT: 5432

...

site_url: 'http://ip/dns:8000'

...

admin_url: 'admin'
admin_user: admin
admin_email: 
admin_password_file:

...

plugins_enabled: True
plugin_noinstall: False
plugin_file: '/home/inventree/src/config/plugins.txt'
plugin_dir: '/home/inventree/plugins/'

...

trusted_origins:
   - 'http://localhost'
   - 'http://ip/dns'
   - 'https://localhost'
   - 'http://*.localhost'


...

cors:
  allow_all: true
  allow_credentials: true

  whitelist:
    - 'http://localhost'
    - 'http://ip dns'
    - 'https://localhost'
    - 'http://*.localhost'


...

# MEDIA_ROOT is the local filesystem location for storing uploaded files
media_root: '/home/inventree/data/media'

# STATIC_ROOT is the local filesystem location for storing static files
static_root: '/home/inventree/data/static'

# INVENTREE_BACKUP_DIR is the local filesystem location for storing backups
backup_dir: '/home/inventree/data/backup'

...

inscrut avatar Mar 11 '26 09:03 inscrut

Have you followed the install instructions for bare-metal?

https://docs.inventree.org/en/stable/start/install/#install-postgresql

You will need to install the required postgres connectors

SchrodingersGat avatar Mar 16 '26 09:03 SchrodingersGat

just running

sudo apt-get install postgresql postgresql-contrib libpq-dev

before doing invoke install worked for me

the lines

GRANT ALL ON SCHEMA public TO myuser;
ALTER SCHEMA public OWNER TO myuser;

are also important to get it to work but aren't in the documentation

TimBilliet avatar Mar 18 '26 16:03 TimBilliet

just running

sudo apt-get install postgresql postgresql-contrib libpq-dev

before doing invoke install worked for me

the lines

GRANT ALL ON SCHEMA public TO myuser;
ALTER SCHEMA public OWNER TO myuser;

are also important to get it to work but aren't in the documentation

sudo apt-get install postgresql postgresql-contrib libpq-dev

In my solution, postgresql server was installed in external server, and

pip install psycopg2-binary

fix this problem

And

GRANT ALL ON SCHEMA public TO myuser; ALTER SCHEMA public OWNER TO myuser;

very important

need update documentation, add more information about 'bare metal'

inscrut avatar Mar 18 '26 18:03 inscrut