Bug Description
The model-checker -u upgrade command fails with a FileNotFoundError because it tries to call pip directly, which doesn't exist on many systems where only pip3 is available.
Environment
- OS: macOS (Darwin 24.6.0)
- Python: 3.13
- model-checker version: 1.1.0
- Installation method: pip3 install model-checker
Steps to Reproduce
- Install model-checker:
pip3 install model-checker
- Run:
model-checker -u to upgrade
Expected Behavior
The package should upgrade successfully.
Actual Behavior
The upgrade fails with the following error:
◆ Documents ❯❯❯ model-checker -u
Upgrading package
Traceback (most recent call last):
File "/Users/nicky/Library/Python/3.13/bin/model-checker", line 7, in <module>
sys.exit(run())
~~~^^
File "/Users/nicky/Library/Python/3.13/lib/python/site-packages/model_checker/__main__.py", line 266, in run
main()
~~~~^^
File "/Users/nicky/Library/Python/3.13/lib/python/site-packages/model_checker/__main__.py", line 244, in main
subprocess.run(['pip', 'install', '--upgrade', package_name], check=True)
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.13/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 554, in run
with Popen(*popenargs, **kwargs) as process:
~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.13/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 1039, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pass_fds, cwd, env,
^^^^^^^^^^^^^^^^^^^
...<5 lines>...
gid, gids, uid, umask,
^^^^^^^^^^^^^^^^^^^^^^
start_new_session, process_group)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/python@3.13/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/subprocess.py", line 1972, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'pip'
Root Cause
The issue is in __main__.py line 244 which hardcodes 'pip' in the subprocess call:
subprocess.run(['pip', 'install', '--upgrade', package_name], check=True)
On many systems (especially macOS with Homebrew Python), only pip3 exists in the PATH, not pip.
Suggested Fix
The code should use one of these approaches:
- Use
sys.executable -m pip instead of calling pip directly:
subprocess.run([sys.executable, '-m', 'pip', 'install', '--upgrade', package_name], check=True)
- Try
pip first, fall back to pip3 if not found
- Use
shutil.which() to find the available pip command
Option 1 is the most reliable as it ensures using the same Python interpreter that's running the script.
Bug Description
The
model-checker -uupgrade command fails with a FileNotFoundError because it tries to callpipdirectly, which doesn't exist on many systems where onlypip3is available.Environment
Steps to Reproduce
pip3 install model-checkermodel-checker -uto upgradeExpected Behavior
The package should upgrade successfully.
Actual Behavior
The upgrade fails with the following error:
Root Cause
The issue is in
__main__.pyline 244 which hardcodes'pip'in the subprocess call:On many systems (especially macOS with Homebrew Python), only
pip3exists in the PATH, notpip.Suggested Fix
The code should use one of these approaches:
sys.executable -m pipinstead of callingpipdirectly:pipfirst, fall back topip3if not foundshutil.which()to find the available pip commandOption 1 is the most reliable as it ensures using the same Python interpreter that's running the script.