Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opensips-cli NameError: name 'sqlalchemy' is not defined #132

Open
isweluiz opened this issue Oct 10, 2024 · 1 comment
Open

opensips-cli NameError: name 'sqlalchemy' is not defined #132

isweluiz opened this issue Oct 10, 2024 · 1 comment

Comments

@isweluiz
Copy link

isweluiz commented Oct 10, 2024

After a new build with the master code, the sqlalchemy isn't working anymore causing issue with the cli. does anyone had this issue before? I tried in Debian 10,11 and 12 and had the same issue.

dpkg -l  | grep sqlalchemy
ii  python3-sqlalchemy               1.2.18+ds1-2                all          SQL toolkit and Object Relational Mapper for Python 3
ii  python3-sqlalchemy-ext           1.2.18+ds1-2                amd64        SQL toolkit and Object Relational Mapper for Python3 - C extension
ii  python3-sqlalchemy-utils         0.32.21-1                   all          various utility functions for SQLAlchemy - Python 3.x
$opensips-cli

Welcome to OpenSIPS Command Line Interface!
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.2.0-py3.7.egg/opensipscli/db.py", line 767, in has_dialect
    sqlalchemy.create_engine('{}://'.format(dialect))
NameError: name 'sqlalchemy' is not defined

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/opensips-cli", line 4, in <module>
    __import__('pkg_resources').run_script('opensipscli==0.2.0', 'opensips-cli')
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 1446, in run_script
    exec(code, namespace, namespace)
  File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.2.0-py3.7.egg/EGG-INFO/scripts/opensips-cli", line 9, in <module>
    run_console()
  File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.2.0-py3.7.egg/EGG-INFO/scripts/opensips-cli", line 6, in run_console
    main.main()
  File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.2.0-py3.7.egg/opensipscli/main.py", line 77, in main
    shell = cli.OpenSIPSCLI(args)
  File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.2.0-py3.7.egg/opensipscli/cli.py", line 90, in __init__
    self.update_instance(cfg.current_instance)
  File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.2.0-py3.7.egg/opensipscli/cli.py", line 166, in update_instance
    excl_mod = mod.__exclude__(mod)
  File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.2.0-py3.7.egg/opensipscli/modules/database.py", line 539, in __exclude__
    return (not osdb.has_dialect(osdb.get_dialect(db_url)), None)
  File "/usr/local/lib/python3.7/dist-packages/opensipscli-0.2.0-py3.7.egg/opensipscli/db.py", line 768, in has_dialect
    except sqlalchemy.exc.NoSuchModuleError:
NameError: name 'sqlalchemy' is not defined

packages version

apt-get -y update -qq && apt-get -y install git python3 python3-pip python3-dev gcc default-libmysqlclient-dev python3-mysqldb python3-sqlalchemy python3-sqlalchemy-utils python3-openssl  libxml2-dev libxslt1-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gcc is already the newest version (4:8.3.0-1).
default-libmysqlclient-dev is already the newest version (1.0.5).
python3-openssl is already the newest version (19.0.0-1).
python3-mysqldb is already the newest version (1.3.10-2).
python3-pip is already the newest version (18.1-5).
python3-sqlalchemy-utils is already the newest version (0.32.21-1).
python3 is already the newest version (3.7.3-1).
python3-dev is already the newest version (3.7.3-1).
python3-sqlalchemy is already the newest version (1.2.18+ds1-2).
git is already the newest version (1:2.20.1-2+deb10u9).
libxml2-dev is already the newest version (2.9.4+dfsg1-7+deb10u6).
libxslt1-dev is already the newest version (1.1.32-2.2~deb10u2).
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

The commit d0add90ad1b394f628903eee34df5abb4e5de9d1 is working, after it isn't working anymore with the current packages versions.

@isweluiz
Copy link
Author

I got it fixed with the latest changes in the master/main branch defining the below static versions for sqlalchemy

SQLAlchemy==1.3.3
sqlalchemy-utils>=0.38.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant