Pre-commit install fails after recloning

After deleting my local copy of the pymedphys repository, I have recloned it and am attempting to run pre-commit install. When doing this, I get the following error:

pre-commit

Also, whenever I try to run something, I get errors that the modules don’t exist even though they show as installed within the virtual environment:

error

Any ideas?

Hi @rembishj,

Welcome to the PyMedPhys Discourse forum :slight_smile:.

As sort of a first port of call, what Python and poetry versions do you get when you run:

python --version
poetry --version

But I suspect given it’s saying “cannot find the file specified” I get that same error when a particular tool is not actually installed. For example boo is not installed on my system:

C:\Users\sbiggs\git\pymedphys [add-in-pyright ≡]> poetry run boo

  FileNotFoundError

  [WinError 2] The system cannot find the file specified

  at ~\.pyenv\pyenv-win\versions\3.7.9\lib\subprocess.py:1207 in _execute_child
      1203│                                          int(not close_fds),
      1204│                                          creationflags,
      1205│                                          env,
      1206│                                          os.fspath(cwd) if cwd is not None else None,
    → 1207│                                          startupinfo)
      1208│             finally:
      1209│                 # Child is launched. Close the parent's copy of those pipe
      1210│                 # handles that only the child should have open.  You need
      1211│                 # to make sure that no handles to the write end of the

I suspect the issue is that pre-commit isn’t installed within your poetry python environment. I was just about to link to the Windows contributor docs regarding how to install all the packages:

…but there is an important thing missing there. “Run poetry install within the root of the repo” should read “Run poetry install -E dev within the root of the repo”.

Would you be able to run poetry install -E dev within the repo and then see if you can install pre-commit?

If that fixes it… could you do me a huge favour :slight_smile:, would you be able to fix up the docs over at https://github.com/pymedphys/pymedphys/edit/main/lib/pymedphys/docs/howto/advanced/setup-win.rst ?

Yep, that fixed it! Thank you very much :slight_smile:

Also, did you already make the correction? Because I am seeing the correct version now. Or is there another section you would like me to change?

The issue is here I believe:

Ahh there it is. I was seeing the correct version at the bottom of the page and glanced over that one. Just corrected it and submitted a pull request!