6

Recently, I just try to connect my SQL Server in python. So I just download the .whl file from "http://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql". in cmd windows, I use the following command:

pip install some-package.whl

My pc is window 64bit, I tried all the .whl files in the following. http://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql

pymssql‑1.0.3‑cp27‑none‑win32.whl
pymssql‑2.1.3‑cp27‑cp27m‑win32.whl
pymssql‑2.1.3‑cp27‑cp27m‑win_amd64.whl
pymssql‑2.1.3‑cp34‑cp34m‑win32.whl
pymssql‑2.1.3‑cp34‑cp34m‑win_amd64.whl
pymssql‑2.1.3‑cp35‑cp35m‑win32.whl
pymssql‑2.1.3‑cp35‑cp35m‑win_amd64.whl
pymssql‑2.1.3‑cp36‑cp36m‑win32.whl
pymssql‑2.1.3‑cp36‑cp36m‑win_amd64.whl

But failed to install, with the error message, the .whl file is not supported in this system. what should I do. Can somebody help me.

Machavity
  • 30,841
  • 27
  • 92
  • 100
Wang Jijun
  • 326
  • 4
  • 10

5 Answers5

6

The simplest procedure that helped me is:

Step 1: Open cmd as an administrator

Step 2: Type python and press Enter

You will get something like this enter image description here

Here, you can see your Python version and the CPU Architecture

Step 3: Go on https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql and select .whl file that support both, python version and also the CPU architecture. i.e. the supported file for me will be pymssql‑2.2.2‑cp39‑cp39‑win_amd64.whl where cp39 means the python version that is 3.9 in my case, and amd64 is the CPU architecture.

Step 4: Go the folder where you have downloaded the required file and in the address bar type cmd or you can open cmd as an admin and move to the download directoryenter image description here

Step 5: Copy name of the required downloaded file along with extension and Run the following command

pip install pymssql‑2.2.2‑cp39‑cp39‑win_amd64.whl

That's all. You can use this method for any file from this website. This method is working for me perfectly

ARHAM RUMI
  • 441
  • 5
  • 11
2

I faced the same issue. It goes with version of Python installed on your system if it is 32 bit Python Version or 64 bit Python.

So cp36 as I have python 3.6 and win32 as Python is 32 bit according to my system.

I worked for me.

I hope this helps.

Prasad
  • 21
  • 2
1

whl naming structure:

{distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl

in your case you need to know your python --version (python tag cp27 for python2.7 etc) and your cpu architecture .

E.Big
  • 723
  • 6
  • 15
0

Faced the same issue, All you need to do is change the name of your whl file:

Change up to the installed python distribution Then none for the python version and any for the platform

Should be something like pymssql‑2.1.3‑cp3‑none‑eny.whl

Reegan Miranda
  • 2,879
  • 6
  • 43
  • 55
Benda
  • 151
  • 1
  • 6
  • That might fool `pip` into installing the wheel file, but it offers no guarantee that the installed package will actually work. The different wheel files are offered precisely because they are compiled against different versions of CPython. – Gord Thompson Jul 24 '19 at 12:58
0

You can do this using packaging.

pip install packaging

You can use this simple function compatible_wheels I wrote using packaging to filter out for the compatible wheels for your system:

from packaging.tags import sys_tags


def parse_tag(wheel_filename):
    """
    Example:
        >>> parse_tag('pymssql-2.2.1-cp36-cp36m-manylinux2010_i686.whl')
        'cp36-cp36m-manylinux2010_i686'
    """
    return '-'.join(wheel_filename.split('-')[2:])[:-4]


def compatible_wheels(wheel_filenames):
    tags = [str(tag) for tag in sys_tags()]
    return [
        f
        for f in wheel_filenames
        if parse_tag(f) in tags
    ]

Example usage

>>> wheel_filenames = [
    'pymssql-2.2.1-cp36-cp36m-manylinux2010_i686.whl',
    'pymssql-2.2.1-cp36-cp36m-manylinux2014_i686.whl',
    'pymssql-2.2.1-cp37-cp37m-manylinux1_i686.whl',
    'pymssql-2.2.1-cp39-cp39-manylinux2014_i686.whl',
    'pymssql-2.2.1-cp37-cp37m-win32.whl',
    'pymssql-2.2.1-cp36-cp36m-manylinux_2_24_x86_64.whl',
    'pymssql-2.2.1-cp37-cp37m-manylinux2010_x86_64.whl',
    'pymssql-2.2.1-cp37-cp37m-manylinux2014_i686.whl',
    'pymssql-2.2.1-cp38-cp38-manylinux2014_i686.whl',
    'pymssql-2.2.1-cp36-cp36m-manylinux_2_24_i686.whl',
    'pymssql-2.2.1-cp38-cp38-macosx_10_14_x86_64.whl',
    'pymssql-2.2.1-cp38-cp38-manylinux2014_x86_64.whl',
    'pymssql-2.2.1-cp38-cp38-win_amd64.whl',
    'pymssql-2.2.1-cp39-cp39-win32.whl',
    'pymssql-2.2.1-cp39-cp39-manylinux_2_24_x86_64.whl',
    'pymssql-2.2.1-cp39-cp39-win_amd64.whl',
    'pymssql-2.2.1-cp39-cp39-manylinux2014_x86_64.whl',
    'pymssql-2.2.1-cp38-cp38-manylinux2010_x86_64.whl',
    'pymssql-2.2.1-cp38-cp38-manylinux_2_24_x86_64.whl',
    'pymssql-2.2.1-cp38-cp38-win32.whl',
    'pymssql-2.2.1-cp39-cp39-manylinux2010_i686.whl',
    'pymssql-2.2.1-cp39-cp39-manylinux_2_24_i686.whl',
    'pymssql-2.2.1-cp37-cp37m-macosx_10_14_x86_64.whl',
    'pymssql-2.2.1-cp37-cp37m-manylinux2010_i686.whl',
    'pymssql-2.2.1-cp38-cp38-manylinux1_i686.whl',
    'pymssql-2.2.1-cp38-cp38-manylinux_2_24_i686.whl',
    'pymssql-2.2.1-cp37-cp37m-manylinux2014_x86_64.whl',
    'pymssql-2.2.1-cp36-cp36m-manylinux2010_x86_64.whl',
    'pymssql-2.2.1-cp39-cp39-manylinux1_x86_64.whl',
    'pymssql-2.2.1-cp36-cp36m-manylinux1_x86_64.whl',
    'pymssql-2.2.1-cp37-cp37m-manylinux1_x86_64.whl',
    'pymssql-2.2.1-cp39-cp39-manylinux1_i686.whl',
    'pymssql-2.2.1-cp36-cp36m-manylinux1_i686.whl',
    'pymssql-2.2.1-cp36-cp36m-manylinux2014_x86_64.whl',
    'pymssql-2.2.1-cp37-cp37m-manylinux_2_24_i686.whl',
    'pymssql-2.2.1-cp37-cp37m-manylinux_2_24_x86_64.whl',
    'pymssql-2.2.1-cp37-cp37m-win_amd64.whl',
    'pymssql-2.2.1-cp38-cp38-manylinux2010_i686.whl',
    'pymssql-2.2.1-cp38-cp38-manylinux1_x86_64.whl',
    'pymssql-2.2.1-cp39-cp39-macosx_10_14_x86_64.whl',
    'pymssql-2.2.1-cp39-cp39-manylinux2010_x86_64.whl',
]

>>> compatible_wheels(wheel_filenames)
['pymssql-2.2.1-cp39-cp39-manylinux_2_24_x86_64.whl', 'pymssql-2.2.1-cp39-cp39-manylinux2014_x86_64.whl', 'pymssql-2.2.1-cp39-cp39-manylinux1_x86_64.whl', 'pymssql-2.2.1-cp39-cp39-manylinux2010_x86_64.whl']

# Note: I get the above output because I am using Linux. You may be getting the wheels for windows accordingly based on your system.
chaitan94
  • 2,153
  • 1
  • 18
  • 19