TSQL using Python for market basket analysis ModuleNotFoundError: apyori

  • Apologies if this is the wrong forum as its really python but need to run from TSQL so have a SQL dataset to pass in, not a CSV file, so am hoping this is a common issue and an easy solution.

    I have installed Python as a SQL feature, and can do the simple microsoft few lines of code to provide its running ok.

    However for market basket analysis, it looks like I need the apriori algorithm and it is not one of the ones already installed as I get the error  ModuleNotFoundError: No module named 'apyori'

    And when I try "pip install apriori" I get the "pip is configured for with location that require TLS/SSL SSL module in python is not available" and cannot see how to proceed.

     

  • Is this really the exact error: "pip is configured for with location that require TLS/SSL SSL module in python is not available" ?

    It does not make grammatical sense.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Hi Phil, sorry for typo's,

    The actual TSQL error from this line "from apyori import apriori" is

    Msg 39004, Level 16, State 20, Line 63

    A 'Python' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.

    Msg 39019, Level 16, State 2, Line 63

    An external script error occurred:

    Error in execution. Check the output for more information.

    Traceback (most recent call last):

    File "<string>", line 5, in <module>

    File "C:\ProgramData\MSSQLSERVER\Temp-PY\Appcontainer1\A718FAC4-51F2-406F-8B31-D1D7A933E185\sqlindb_0.py", line 35, in transform

    from apyori import apriori

    ModuleNotFoundError: No module named 'apyori'

    SqlSatelliteCall error: Error in execution. Check the output for more information.

    STDOUT message(s) from external script:

    SqlSatelliteCall function failed. Please see the console output for more information.

    Traceback (most recent call last):

    File "C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\PYTHON_SERVICES\lib\site-packages\revoscalepy\computecontext\RxInSqlServer.py", line 605, in rx_sql_satellite_call

    rx_native_call("SqlSatelliteCall", params)

    File "C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\PYTHON_SERVICES\lib\site-packages\revoscalepy\RxSerializable.py", line 375, in rx_native_call

    ret = px_call(functionname, params)

    RuntimeError: revoscalepy function failed.

    And the actual error message when trying to install that apyori from cmd is this

    C:\Program Files\Microsoft SQL Server\150\PYTHON_SERVER\Scripts>pip install apyori

    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    Collecting apyori

    Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/apyori/

    Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/apyori/

    Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/apyori/

    Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/apyori/

    Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/apyori/

    Could not fetch URL https://pypi.org/simple/apyori/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/apyori/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

    Could not find a version that satisfies the requirement apyori (from versions: )

    No matching distribution found for apyori

    pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

    Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

  • Did you follow the instructions here when attempting the library install?

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • yes and lots of others but to no avail, I'll try to attack it in a different way.

     

    thanks

     

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply