OpenSIPS / opensips-cli

OpenSIPS CLI tool - an interactive command line tool that can be used to control and monitor OpenSIPS servers.
GNU General Public License v3.0
84 stars 46 forks source link

opensips-cli not getting executed #113

Closed prathibhacdac closed 7 months ago

prathibhacdac commented 10 months ago

Installed opensips-cli from source. I checked the latest source from github. When I execute opensips-cli -x database create, I get the following:

File "/usr/local/bin/opensips-cli", line 4, in import('pkg_resources').run_script('opensipscli==0.2.0', 'opensips-cli') File "/usr/lib/python3.6/site-packages/pkg_resources/init.py", line 654, in run_script self.require(requires)[0].run_script(script_name, ns) File "/usr/lib/python3.6/site-packages/pkg_resources/init.py", line 1434, in run_script exec(code, namespace, namespace) File "/root/.local/lib/python3.6/site-packages/opensipscli-0.2.0-py3.6.egg/EGG-INFO/scripts/opensips-cli", line 3, in from opensipscli import main File "/root/.local/lib/python3.6/site-packages/opensipscli-0.2.0-py3.6.egg/opensipscli/main.py", line 22, in from opensipscli import cli, defaults, version File "/root/.local/lib/python3.6/site-packages/opensipscli-0.2.0-py3.6.egg/opensipscli/cli.py", line 32, in from opensipscli.modules import * File "/root/.local/lib/python3.6/site-packages/opensipscli-0.2.0-py3.6.egg/opensipscli/modules/init.py", line 24, in import(modname) File "/root/.local/lib/python3.6/site-packages/opensipscli-0.2.0-py3.6.egg/opensipscli/modules/database.py", line 23, in from opensipscli.db import ( File "/root/.local/lib/python3.6/site-packages/opensipscli-0.2.0-py3.6.egg/opensipscli/db.py", line 37, in import sqlalchemy_utils File "/root/.local/lib/python3.6/site-packages/SQLAlchemy_Utils-0.41.1-py3.6.egg/sqlalchemy_utils/init.py", line 1, in from .aggregates import aggregated # noqa File "/root/.local/lib/python3.6/site-packages/SQLAlchemy_Utils-0.41.1-py3.6.egg/sqlalchemy_utils/aggregates.py", line 374, in from .compat import _select_args, get_scalar_subquery File "/root/.local/lib/python3.6/site-packages/SQLAlchemy_Utils-0.41.1-py3.6.egg/sqlalchemy_utils/compat.py", line 7, in from importlib_metadata import metadata File "/root/.local/lib/python3.6/site-packages/importlib_metadata-6.8.0-py3.6.egg/importlib_metadata/init.py", line 6, in import zipp File "/root/.local/lib/python3.6/site-packages/zipp-3.17.0-py3.6.egg/zipp/init.py", line 9, in from .py310compat import text_encoding File "/root/.local/lib/python3.6/site-packages/zipp-3.17.0-py3.6.egg/zipp/py310compat.py", line 5 def _text_encoding(encoding, stacklevel=2, /): # pragma: no cover ^ SyntaxError: invalid syntax

3clogic-devops commented 7 months ago

getting same issue while installing opensips-cli on redhat 8.7. Kindly update

liviuchircu commented 7 months ago

Hi guys,

I specifically installed the now-deprecated Python 3.6 and managed to reproduce this exact stack trace. In my case, I was using zipp==3.17.0 (possibly from the newer Python 3.x installations present alongside the python3.6), which did not work when picked up by Python 3.6.

To fix it, I did:

$ pip3.6 uninstall zipp
Found existing installation: zipp 3.17.0
Uninstalling zipp-3.17.0:
  Would remove:
    /home/liviu/.local/lib/python3.6/site-packages/zipp-3.17.0-py3.6.egg
Proceed (Y/n)? 
  Successfully uninstalled zipp-3.17.0
$ pip3.6 install zipp
Defaulting to user installation because normal site-packages is not writeable
Collecting zipp
  Downloading zipp-3.6.0-py3-none-any.whl (5.3 kB)
Installing collected packages: zipp
Successfully installed zipp-3.6.0
$ opensips-cli
...
(opensips-cli): database create opensipscli_test
INFO: connected to DB, 'opensips' user is already created
INFO: Running standard-create.sql...
INFO: Running group-create.sql...
INFO: Running alias_db-create.sql...
INFO: Running domain-create.sql...
...

So make sure to have a clean Python 3 environment when installing the CLI, so that all of its package dependencies install together. Otherwise, by mixing them up, we could end up with all sorts of strange side-effects such as this one. Hope this helps!