mssql-cli icon indicating copy to clipboard operation
mssql-cli copied to clipboard

"/usr/bin/python: No module named mssqlcli"

Open yooakim opened this issue 8 years ago • 12 comments

I've followed the installation instructions and when I try to run mssql-cli I get the subject error message.

Installation went OK so I am not sure what is wrong? I'm using Ubuntu 17.10

joakim@XPS:~$ pip install mssql-cli
Requirement already satisfied: mssql-cli in /usr/local/lib/python3.6/dist-packages
Requirement already satisfied: cli-helpers<1.0.0,>=0.2.3 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: click>=4.1 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: Pygments>=2.0 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: configobj>=5.0.6 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: future>=0.16.0 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: enum34>=1.1.6 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: wheel>=0.29.0 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: prompt-toolkit<1.1.0,>=1.0.10 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: applicationinsights>=0.11.1 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: humanize>=0.5.1 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: sqlparse<0.3.0,>=0.2.2 in /usr/local/lib/python3.6/dist-packages (from mssql-cli)
Requirement already satisfied: backports.csv>=1.0.0 in /usr/local/lib/python3.6/dist-packages (from cli-helpers<1.0.0,>=0.2.3->mssql-cli)
Requirement already satisfied: terminaltables>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from cli-helpers<1.0.0,>=0.2.3->mssql-cli)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from configobj>=5.0.6->mssql-cli)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.6/dist-packages (from prompt-toolkit<1.1.0,>=1.0.10->mssql-cli)

yooakim avatar Dec 13 '17 14:12 yooakim

My bad, it says in the docs you need to ensurfe you have the correct Pythin env setup.

yooakim avatar Dec 13 '17 14:12 yooakim

Let us know if you have any issue with Ubuntu 17.10. It's not a distro version we have tested so there may be an issue with the installation steps.

pensivebrian avatar Dec 13 '17 18:12 pensivebrian

I'm having the same problem, but on Mac OS. I'm not sure which docs you are referring to, but I cannot find anything that refers to a Python environment in the Mac OS docs. Can anyone help me?

SirRippovMaple avatar May 04 '18 16:05 SirRippovMaple

@trumpi, Can you please share the following info:

  • Commands used to install mssql-cli
  • Python3 and pip3 installed?

MrMeemus avatar May 04 '18 17:05 MrMeemus

Hi @MrMeemus

I think I've solved the problem, but I admit that I probably did it by accident since I'm not an expert with Python. It appears as though I had both Python 2 and Python 3 installed. Even worse than that, there were two versions of Python 2 installed. I have no idea how that happened.

I resolved the problem by uninstalling all the Pythons using Homebrew. I then installed python@2. I later upgraded my vim which installed Python 3 as well.

Somehow, this fixes it and I'm able to use mssql-cli.

SirRippovMaple avatar May 08 '18 11:05 SirRippovMaple

@trumpi , glad to hear! we understand that the pip route can be confusing with different platforms and their various default python and pip config. We are planning a home brew or cask brew formula in the near future to simplify this.

MrMeemus avatar May 08 '18 20:05 MrMeemus

fixing it by installing by pip2 pip2 install mssql-cli

m3asmi avatar Sep 28 '18 10:09 m3asmi

I'm totally confused. I'm also having this problem. Why are people using pip2, and python2? Does the cli not work with python3?

EvanCarroll avatar Dec 12 '18 20:12 EvanCarroll

mssql-cli supports both python 2.7 and 3.4+ and we leave it up to the user choose. For most Linux distributions, pip and python defaults to 2. I think Red Hat 8 (in beta) will be the first big distro to default to 3.

We generally see this error when multiple versions of python are installed, but pip runs from one location, and python from another. Running 'whereis python' or 'whereis pip' on the command line can be used to confirm the locations.

pensivebrian avatar Dec 12 '18 21:12 pensivebrian

I'm also having this issue. On my Mac like most Macs I think, pip and python refer to 2.x, the system-provided python. I also have Python3 installed using homebrew, so pip3 and python3 refer to that. I installed mssql-cli using pip3 and got the aforementioned issue when I tried to run it.

Note that this wasn't a case of "pip runs from one location, and python from another." Both pip and python refer to the system pip/python, I just tried to install using a different python. Maybe the issue is that you're calling out to python from your program and getting the system one?

Installing using pip (i.e. referring to python 2.7) worked, though I wasn't enthusiastic about having to sudo / modify the system-provided python.

Is this a different project from the MSSQL "command line utilities" that were released to Homebrew? https://github.com/Microsoft/homebrew-mssql-release I installed them as well, but they don't seem to contain mssql-cli. Does that mean you're still working on a homebrew package for mssql-cli?

eliot1785 avatar Feb 27 '19 22:02 eliot1785

Opening this again as I'm running into issues updating our Debian builds.

ellbosch avatar Jan 15 '20 17:01 ellbosch

I modified the mssql-cli command and changed the last line from:

python -m mssqlcli.main "$@"

to:

python3 -m mssqlcli.main "$@"

and now it appears to be running on Python3.

jakelly avatar Sep 09 '21 00:09 jakelly