4

My goal is to develop Azure Functions locally with VS Code and Python. I have an Azure Functions template with Time Trigger:

import datetime
import logging

import azure.functions as func

def main(mytimer: func.TimerRequest) -> None:
    utc_timestamp = datetime.datetime.utcnow().replace(
        tzinfo=datetime.timezone.utc).isoformat()

    if mytimer.past_due:
        logging.info('The timer is past due!')

    logging.info('Python timer trigger function ran at %s', utc_timestamp)

I try to run that locally (conda environment) in VS Code with debugging and I will get the following:

> Executing task: .venv\Scripts\python -m pip install -r requirements.txt <

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting azure-functions==1.2.1 (from -r requirements.txt (line 1))
  WARNING: 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/azure-functions/
  WARNING: 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/azure-functions/
  WARNING: 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/azure-functions/
  WARNING: 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/azure-functions/
  WARNING: 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/azure-functions/
  Could not fetch URL https://pypi.org/simple/azure-functions/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/azure-functions/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  ERROR: Could not find a version that satisfies the requirement azure-functions==1.2.1 (from -r requirements.txt (line 1)) (from versions: none)
ERROR: No matching distribution found for azure-functions==1.2.1 (from -r requirements.txt (line 1))
WARNING: 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
The terminal process terminated with exit code: 1

I have added the PATH variables mentioned here

I have also found a way to install packages using --trusted-host (link here), but I don't know, how to use that in Azure Functions, because it utilizes requirements.txt. I assume, that you can't use --trusted-host in the requirements.txt.

pentti
  • 95
  • 10

1 Answers1

0

Check that you have {your_conda_env_installation_path}\Library\bin in your PATH System Environment Variable.

Thats where the DLLs are located e.g.

  • libcrypto-1_1-x64.dll
  • libssl-1_1-x64.dll

Reload your code editor. Test the fix by running venv\Scripts\python.exe

import ssl

If the modules loads without a DLL error, it should work.

meo
  • 1
  • 3
  • Problem solved! I had the "venv\Scripts\python.exe" in the virtual variables already. All I did was that I changed the order of the environment variables (I have read in some other topic, that it affects...) and reloaded my code editor. I don't know, which solved this issue because I think I have reloaded the code editor earlier also. Anyway, thanks for your help @meo ! – pentti Jun 29 '20 at 06:05
  • Please replace path with following: {your_conda_env_installation_path}/Library/bin – swed1983 Oct 27 '22 at 12:08