Supervisor / supervisor

Supervisor process control system for Unix (supervisord)
http://supervisord.org
Other
8.33k stars 1.23k forks source link

Supervisor doesn't work after installing from codebase (version 4.3) #1622

Closed gcarabe closed 3 months ago

gcarabe commented 5 months ago

Supervisor doesn't start after installing it from codebase, I get this error:

Traceback (most recent call last):
  File "/usr/bin/supervisorctl", line 33, in <module>
    sys.exit(load_entry_point('supervisor==4.3.0.dev0', 'console_scripts', 'supervisorctl')())
  File "/usr/bin/supervisorctl", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib64/python3.9/importlib/metadata.py", line 86, in load
    module = import_module(match.group('module'))
  File "/usr/lib64/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'supervisor.supervisorctl'

After running the following commands:

sudo yum groupinstall "Development Tools"
sudo yum install python3-devel libpq git
sudo python3 -m venv /opt/supervisor
sudo /opt/supervisor/bin/pip install --upgrade pip
sudo git clone https://github.com/Supervisor/supervisor /opt/supervisor/bin/supervisor
sudo /opt/supervisor/bin/python3 /opt/supervisor/bin/supervisor/setup.py install
sudo /opt/supervisor/bin/pip install certbot-nginx multivisor[rpc]
sudo ln -sf /opt/supervisor/bin/supervisord /usr/bin/supervisord
sudo ln -sf /opt/supervisor/bin/supervisorctl /usr/bin/supervisorctl
sudo cp ./default-supervisord.conf /etc/supervisord.conf
sudo cp ./supervisord.service /lib/systemd/system/supervisord.service
sudo systemctl start supervisord
sudo systemctl enable supervisord
sudo systemctl daemon-reload

I am using default conf files. Am I missing something?

mnaberez commented 3 months ago

ModuleNotFoundError: No module named 'supervisor.supervisorctl'

Install supervisor with pip in a fresh virtual environment:

user@system sandbox % python3 -m venv venv

user@system sandbox % venv/bin/pip3 install git+https://github.com/Supervisor/supervisor
Collecting git+https://github.com/Supervisor/supervisor
  Cloning https://github.com/Supervisor/supervisor to /tmp/pip-req-build-si0e6653
  Running command git clone --filter=blob:none --quiet https://github.com/Supervisor/supervisor /tmp/pip-req-build-si0e6653
  Resolved https://github.com/Supervisor/supervisor to commit 9ee5fee61881adc227a67d2d13414597d1f4d51c
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: supervisor
  Building wheel for supervisor (pyproject.toml) ... done
  Created wheel for supervisor: filename=supervisor-4.3.0.dev0-py2.py3-none-any.whl size=320707 sha256=f10428e76d749133ad83a57ffd07baffa35c0c7ccd762187ebfc18beb920b389
  Stored in directory: /tmp/pip-ephem-wheel-cache-mwij_e5n/wheels/95/75/38/4e0c607f67e742614bd0aa32caa6cb907f125cb069ee6588af
Successfully built supervisor
Installing collected packages: supervisor
Successfully installed supervisor-4.3.0.dev0

Try to import the module shown in the error message:

user@system sandbox % ./venv/bin/python3 
Python 3.12.2 (main, Feb  6 2024, 20:19:44) [Clang 15.0.0 (clang-1500.1.0.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from supervisor import supervisorctl
>>> ^D

No error.

Try to run supervisorctl:

user@system sandbox % ./venv/bin/supervisorctl --help
supervisorctl -- control applications run by supervisord from the cmd line.

Usage: ./venv/bin/supervisorctl [options] [action [arguments]]

Options:
-c/--configuration FILENAME -- configuration file path (searches if not given)
-h/--help -- print usage message and exit
-i/--interactive -- start an interactive shell after executing commands
-s/--serverurl URL -- URL on which supervisord server is listening
     (default "http://localhost:9001").
-u/--username USERNAME -- username to use for authentication with server
-p/--password PASSWORD -- password to use for authentication with server
-r/--history-file -- keep a readline history (if readline is available)

action [arguments] -- see below

Actions are commands like "tail" or "stop".  If -i is specified or no action is
specified on the command line, a "shell" interpreting actions typed
interactively is started.  Use the action "help" to find out about available
actions.

No error.

The error message ModuleNotFoundError: No module named 'supervisor.supervisorctl' comes from the Python packaging machinery trying to import the module. It occurred before any Supervisor code was reached. This is not a bug in Supervisor. The Supervisor developers do not have enough bandwidth to help troubleshoot installations on individual systems, sorry.