EnergySystemsModellingLab / MUSE_OS

Welcome to the MUSE-OS repository
https://muse-os.readthedocs.io/en/latest/
GNU General Public License v3.0
22 stars 8 forks source link

Pre-commit hooks fail to run (possibly Windows specific) [BUG] #260

Closed tsmbland closed 1 week ago

tsmbland commented 2 months ago

Describe the bug

I'm having issues running the pre-commit hooks on my windows machine.

To Reproduce

I run the following steps:

python -m venv .venv
.venv/scripts/Activate.ps1
pip install -e .[dev,doc]
pip install pre-commit
pre-commit install
pre-commit run --all-files

And get the following error at the final step:

[INFO] Installing environment for https://github.com/timothycrosley/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\tbland\\.cache\\pre-commit\\repoetiij17o\\py_env-default\\Scripts\\python.EXE', '-mpip', 'install', '.', 'toml')
return code: 1
stdout:
    Processing c:\users\tbland\.cache\pre-commit\repoetiij17o
      Installing build dependencies: started
      Installing build dependencies: finished with status 'error'
stderr:
    WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
      error: subprocess-exited-with-error

      pip subprocess to install build dependencies did not run successfully.
      exit code: 1

      [9 lines of output]
      WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
      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/poetry-core/
      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/poetry-core/
      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/poetry-core/
      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/poetry-core/
      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/poetry-core/
      Could not fetch URL https://pypi.org/simple/poetry-core/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/poetry-core/ (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 poetry-core>=1.0.0 (from versions: none)
      ERROR: No matching distribution found for poetry-core>=1.0.0
      [end of output]

      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error

    pip subprocess to install build dependencies did not run successfully.
    exit code: 1

    See above for output.

    note: This error originates from a subprocess, and is likely not a problem with pip.
Check the log at C:\Users\tbland\.cache\pre-commit\pre-commit.log

It's worth noting that everything works fine if I try this on my mac with the same python version, so it seems to be a windows specific problem

UPDATE:

Expected behavior

Pre-commit hooks should install, run and pass

Context

Please, complete the following to better understand the system you are using to run MUSE.

tsmbland commented 1 week ago

This seems to work now after the upgrade to 3.12