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

Error when using mssql-cli with Python 3.10 latest version #531

Open
jmoralesv opened this issue Oct 9, 2021 · 18 comments
Open

Error when using mssql-cli with Python 3.10 latest version #531

jmoralesv opened this issue Oct 9, 2021 · 18 comments

Comments

@jmoralesv
Copy link

Hi all,
I'm writing this issue because I came across an error when using mssql-cli with the latest Pyton 3.10. Installation goes fine, however, when trying to run mssql-cli to connect to a local SQL Server instance, I got this:

PS C:\Users\Jorge> mssql-cli -S . -E
Traceback (most recent call last):
  File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python310\lib\site-packages\mssqlcli\main.py", line 122, in <module>
    main()
  File "C:\Python310\lib\site-packages\mssqlcli\main.py", line 115, in main
    run_cli_with(mssqlcli_options)
  File "C:\Python310\lib\site-packages\mssqlcli\main.py", line 44, in run_cli_with
    from mssqlcli.mssql_cli import MssqlCli
  File "C:\Python310\lib\site-packages\mssqlcli\mssql_cli.py", line 14, in <module>
    from cli_helpers.tabular_output import TabularOutputFormatter
  File "C:\Python310\lib\site-packages\cli_helpers\tabular_output\__init__.py", line 11, in <module>
    from .output_formatter import format_output, TabularOutputFormatter
  File "C:\Python310\lib\site-packages\cli_helpers\tabular_output\output_formatter.py", line 10, in <module>
    from . import (delimited_output_adapter, vertical_table_adapter,
  File "C:\Python310\lib\site-packages\cli_helpers\tabular_output\tabulate_adapter.py", line 4, in <module>
    from cli_helpers.packages import tabulate
  File "C:\Python310\lib\site-packages\cli_helpers\packages\tabulate.py", line 6, in <module>
    from collections import namedtuple, Iterable
ImportError: cannot import name 'Iterable' from 'collections' (C:\Python310\lib\collections\__init__.py)

From what I understood, it looks like mssql-cli has a dependency on cli-helpers which in turn depends on some tabular packages and the one for tabulate.py can't find the Iterable type in "collections". Could this mean that the dependencies need to be updated?

I'm not a Python developer, my background is .NET, so I'm not sure how to solve this. For now I'm planning on going back to Python 3.9 which I think it could work, I just wanted to point this out.

Thanks for your help on this.

Regards,
Jorge

@jmoralesv
Copy link
Author

Hi all,
Just un update: I was able to install mssql-cli and using it correctly when using Python 3.9.7. So it looks like there is a compatibility issue between mssql-cli dependencies and Python 3.10 in Windows 10.

Regards,
Jorge

@tirkarthi
Copy link

tabulate was removed as a vendored package and added as a dependency. Perhaps you might want to upgrade cli_helpers package.

dbcli/cli_helpers@a21650d

@wangxiaoying
Copy link

tabulate was removed as a vendored package and added as a dependency. Perhaps you might want to upgrade cli_helpers package.

dbcli/cli_helpers@a21650d

This solves my issue by forcing cli-helpers to the newest version. Although there are warnings from mssql-cli about the dependency issue when updating cli-helpers.

@nicholasyin
Copy link

Hi all, Just un update: I was able to install mssql-cli and using it correctly when using Python 3.9.7. So it looks like there is a compatibility issue between mssql-cli dependencies and Python 3.10 in Windows 10.

Regards, Jorge

Yep, using Python 3.9.9 works for me too!

@jmoralesv
Copy link
Author

Hi all, I've just tried the following today to no avail:

  • Upgrade to Python 3.10.1 in Windows 10
  • Install mssql-cli with pip (I can see it uses cli-helpers version 0.2.3)
  • Force upgrading cli-helpers to latest version (2.2.0)
  • Running mssql-cli throws error

However, using Python 3.9.9 works for me.

I decided to keep Python 3.9.9 pinned in Chocolatey for now, as that is the package manager I use in Windows.

@joshuaclausen
Copy link

I hit the same thing - Python 3.10 on a Windows 10 machine got the following error:

ImportError: cannot import name 'Iterable' from 'collections' 

Installing Python 3.9.9 was the only way I could work around it.

@nicholasyin
Copy link

Are you surprised how they simply ignore this and don't want to fix it at all?

@ashb
Copy link

ashb commented Aug 1, 2022

FYI this has already been fixed in code, it's just there hasn't been a release of this module in over 2 years :/

@nicholasyin
Copy link

FYI this has already been fixed in code, it's just there hasn't been a release of this module in over 2 years :/

Wondering if this is managed by Microsoft? What happens to the famous Microsoft management?

@dkostmii
Copy link

dkostmii commented Aug 4, 2022

Tried to run SQL Server Analysis Services on Linux and realized, that there is no such option😂

Also needed plugin for Visual Studio to extract the cube. This plugin is supported up to VS 2019, so I needed to install one😌

But Microsoft is working hard on another Windows Update in the meantime🥳

@JonasKru
Copy link

JonasKru commented Nov 7, 2022

Still no support for Python 3.10? 3.11 is already out...

@nicholasyin
Copy link

Command line tools are less import in Microsoft's philosophy. lol. Unsubscribing.

@xuyuji9000
Copy link

xuyuji9000 commented Feb 20, 2023

FYI this has already been fixed in code, it's just there hasn't been a release of this module in over 2 years :/

@ashb Would you mind help pointing to the code that fixed this? if possible of course.
Thanks in advance!

@clpan
Copy link

clpan commented Mar 17, 2023

The following steps solved my problem.

pip install --upgrade cli_helpers

If that does not work, you can also upgrade tabulate:

pip install --upgrade tabulate

Also set the environment variable to your shell config file (believe you can also set it in mssqlrc but I haven't tried it):

export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true

may also need to change the 'mssql-cli' bash file line 16 to python3.

@codekip
Copy link

codekip commented Aug 3, 2023

The following steps solved my problem.

pip install --upgrade cli_helpers

If that does not work, you can also upgrade tabulate:

pip install --upgrade tabulate

Also set the environment variable to your shell config file (believe you can also set it in mssqlrc but I haven't tried it):

export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true

may also need to change the 'mssql-cli' bash file line 16 to python3.

pip install --upgrade cli_helpers worked for me on python 3.10.4

@elsonico
Copy link

I have freshly installed Ubuntu 22.04 and canät get mssql-cli working. Previously I have successfully usd pyenv to get compatible version, but now I get: "No usable version of libssl was found"

If I try to install lib ssl with pipi install ssl it fails – I believe since package is not maintained and python has ssl internally included anyway.

Iäm out of ideas, since above people seem to be able to get mssql-cli running on 3.9.x versions. I've tried now 3.9.9. 3.9.5 and 3.5.5 under pyenv and with all the same issue about libssl.

@jo7ueb
Copy link

jo7ueb commented Dec 11, 2023

Still have same problem from Ubuntu 22.04 on WSL on Windows11.
No usable version of libssl was found

@Lycan66
Copy link

Lycan66 commented Mar 22, 2024

Los siguientes pasos resolvieron mi problema.

pip install --upgrade cli_helpers

Si eso no funciona, también puedes actualizar tabular:

pip install --upgrade tabulate

También configure la variable de entorno en su archivo de configuración de Shell (creo que también puede configurarla en mssqlrc pero no lo he probado):

export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true

Es posible que también deba cambiar la línea 16 del archivo bash 'mssql-cli' a python3.

The first command worked for me in Python 3.12.2. :)
Updated cli_helpers to version 2.3.1 and it told me that it was not compatible with mssql-cli 1.0.0 (the version I have), however it worked correctly.

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