Cannot run indico_admin/shell, missing requests - errors

Environment

Server default language (en_GB)
Indico version installed (2.3.4)
Python version used (2.7.17)
Postgres version used (9.6.17)
Operating system used (Linux Ubuntu 18.04)
Debug mode (disabled)
Basic statistics (number of events, contributions and users)

I am trying to run indico_shell to link an LDAP user to an account. However when I ran indico_shell --help or indico_admin --help, I received the following error:

1. indico_shell --help

Traceback (most recent call last):
  File "/usr/local/bin/indico_shell", line 6, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3037, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3021, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3050, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 657, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 670, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 855, in resolve
    raise DistributionNotFound(req, requirers)
**pkg_resources.DistributionNotFound: The 'requests==1.2.0' distribution was not found and is required by indico**

2. I then ran pip install requests and system indicated that requirement already satisfied:

Requirement already satisfied: requests in /usr/local/lib/python2.7/dist-packages (2.25.1)
Requirement already satisfied: chardet<5,>=3.0.2 in /usr/lib/python2.7/dist-packages (from requests) (3.0.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python2.7/dist-packages (from requests) (1.25.10)
Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests) (2020.6.20)

3. So I tried forcing pip install -I requests==1.2.0

4. Now when I run indico_shell or indico_admin I receive the following error

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2309, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python2.7/dist-packages/indico-1.2.2-py2.7.egg/indico/util/shell.py", line 39, in <module>
    from indico.web.flask.app import make_app
  File "/usr/local/lib/python2.7/dist-packages/indico-1.2.2-py2.7.egg/indico/web/flask/app.py", line 32, in <module>
    from MaKaC.common.logger import Logger
  File "/usr/local/lib/python2.7/dist-packages/indico-1.2.2-py2.7.egg/MaKaC/common/logger.py", line 266, in <module>
    Logger.initialize()
  File "/usr/local/lib/python2.7/dist-packages/indico-1.2.2-py2.7.egg/MaKaC/common/logger.py", line 228, in initialize
    cls.handlers = LoggerUtils.configFromFile(logConfFilepath, defaultArgs, filters)
  File "/usr/local/lib/python2.7/dist-packages/indico-1.2.2-py2.7.egg/MaKaC/common/logger.py", line 134, in configFromFile
    logging.config._install_loggers(cp, handlers, False)
  File "/usr/lib/python2.7/logging/config.py", line 257, in _install_loggers
    logger.addHandler(handlers[hand])
KeyError: 'celery'

– Any idea how to fix this please?

Thank you

Hi, indico_shell (and any other indico_* utils as well) is a part of legacy indico (1.2 and older)… I’d say the first issue here is that you are on a server which still has a good amount of legacy indico leftovers from many years ago… there’s a reason why we recommended people to install indico v2 on a new server/vm :wink:

Anyway, you need to su - indico to switch to the indico user and then run indico shell (without the underscore) - the indico cli has subcommands for various other things as well, and it’s the only CLI needed in v2.

You may also want to rm -rf /usr/local/lib/python2.7/dist-packages/indico* and rm /usr/local/bin/indico* to get rid of most of the legacy indico stuff that may be around. Eventually when v3 gets released I would strongly recommend doing a clean install on a new server to properly get rid of all the old leftovers.

PS: To format logs, code, etc. here in the forum, wrap it into 3-backtick fences:

```
paste
here
```

@ThiefMaster - Thank you very much for the help.