I relatively often experience that Python breaks when I use it in Grasshopper.
It’s extremely frustrating because I have to reinstall packages again. And then it may happen again next time I need to install a missing package.
packages are installed through the python component with #r: matplotlib for example
See this log
Info 12/15/2025 13:13:57 [RhinoCode] Installing "networkx"
Info 12/15/2025 13:13:57 [RhinoCode] Running process: C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\python.exe -I -m pip --isolated --disable-pip-version-check install --target "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\site-envs\default-XtRtGpEC" --progress-bar off --upgrade --no-warn-script-location --retries 5 --timeout 15 "networkx"
Info 12/15/2025 13:14:03 [RhinoCode] Running process: C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\python.exe -I -m pip --isolated --disable-pip-version-check list --path "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\site-envs\default-XtRtGpEC" --format freeze
Info 12/15/2025 13:14:04 [RhinoCode] Collecting networkx
Using cached networkx-3.2.1-py3-none-any.whl.metadata (5.2 kB)
Using cached networkx-3.2.1-py3-none-any.whl (1.6 MB)
Installing collected packages: networkx
Successfully installed networkx-3.2.1
Info 12/15/2025 13:14:17 [RhinoCode] Installing "FPDF"
Info 12/15/2025 13:14:17 [RhinoCode] Running process: C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\python.exe -I -m pip --isolated --disable-pip-version-check install --target "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\site-envs\default-XtRtGpEC" --progress-bar off --upgrade --no-warn-script-location --retries 5 --timeout 15 "FPDF"
Info 12/15/2025 13:14:18 [RhinoCode] Running process: C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\python.exe -I -m pip --isolated --disable-pip-version-check list --path "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\site-envs\default-XtRtGpEC" --format freeze
Info 12/15/2025 13:14:18 [RhinoCode] Collecting FPDF
Using cached fpdf-1.7.2-py2.py3-none-any.whl
Installing collected packages: FPDF
Successfully installed FPDF-1.7.2
Info 12/15/2025 13:14:27 [RhinoCode] Installing "matplotlib"
Info 12/15/2025 13:14:27 [RhinoCode] Running process: C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\python.exe -I -m pip --isolated --disable-pip-version-check install --target "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\site-envs\default-XtRtGpEC" --progress-bar off --upgrade --no-warn-script-location --retries 5 --timeout 15 "matplotlib"
Error 12/15/2025 13:14:45 [RhinoCode] Process exited with code 2
Error 12/15/2025 13:14:45 [RhinoCode] pip install error | Collecting matplotlib
Using cached matplotlib-3.9.4-cp39-cp39-win_amd64.whl.metadata (11 kB)
Collecting contourpy>=1.0.1 (from matplotlib)
Using cached contourpy-1.3.0-cp39-cp39-win_amd64.whl.metadata (5.4 kB)
Collecting cycler>=0.10 (from matplotlib)
Using cached cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)
Collecting fonttools>=4.22.0 (from matplotlib)
Downloading fonttools-4.60.2-cp39-cp39-win_amd64.whl.metadata (115 kB)
Collecting kiwisolver>=1.3.1 (from matplotlib)
Using cached kiwisolver-1.4.7-cp39-cp39-win_amd64.whl.metadata (6.4 kB)
Collecting numpy>=1.23 (from matplotlib)
Using cached numpy-2.0.2-cp39-cp39-win_amd64.whl.metadata (59 kB)
Collecting packaging>=20.0 (from matplotlib)
Using cached packaging-25.0-py3-none-any.whl.metadata (3.3 kB)
Collecting pillow>=8 (from matplotlib)
Using cached pillow-11.3.0-cp39-cp39-win_amd64.whl.metadata (9.2 kB)
Collecting pyparsing>=2.3.1 (from matplotlib)
Using cached pyparsing-3.2.5-py3-none-any.whl.metadata (5.0 kB)
Collecting python-dateutil>=2.7 (from matplotlib)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting importlib-resources>=3.2.0 (from matplotlib)
Using cached importlib_resources-6.5.2-py3-none-any.whl.metadata (3.9 kB)
Collecting zipp>=3.1.0 (from importlib-resources>=3.2.0->matplotlib)
Using cached zipp-3.23.0-py3-none-any.whl.metadata (3.6 kB)
Collecting six>=1.5 (from python-dateutil>=2.7->matplotlib)
Using cached six-1.17.0-py2.py3-none-any.whl.metadata (1.7 kB)
Using cached matplotlib-3.9.4-cp39-cp39-win_amd64.whl (7.8 MB)
Using cached contourpy-1.3.0-cp39-cp39-win_amd64.whl (211 kB)
Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)
Downloading fonttools-4.60.2-cp39-cp39-win_amd64.whl (1.5 MB)
Using cached importlib_resources-6.5.2-py3-none-any.whl (37 kB)
Using cached kiwisolver-1.4.7-cp39-cp39-win_amd64.whl (55 kB)
Using cached numpy-2.0.2-cp39-cp39-win_amd64.whl (15.9 MB)
Using cached packaging-25.0-py3-none-any.whl (66 kB)
Using cached pillow-11.3.0-cp39-cp39-win_amd64.whl (7.0 MB)
Using cached pyparsing-3.2.5-py3-none-any.whl (113 kB)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Using cached six-1.17.0-py2.py3-none-any.whl (11 kB)
Using cached zipp-3.23.0-py3-none-any.whl (10 kB)
Installing collected packages: zipp, six, pyparsing, pillow, packaging, numpy, kiwisolver, fonttools, cycler, python-dateutil, importlib-resources, contourpy, matplotlib
Successfully installed contourpy-1.3.0 cycler-0.12.1 fonttools-4.60.2 importlib-resources-6.5.2 kiwisolver-1.4.7 matplotlib-3.9.4 numpy-2.0.2 packaging-25.0 pillow-11.3.0 pyparsing-3.2.5 python-dateutil-2.9.0.post0 six-1.17.0 zipp-3.23.0
ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\site-packages\pip\_internal\cli\base_command.py", line 107, in _run_wrapper
status = _inner_run()
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\site-packages\pip\_internal\cli\base_command.py", line 98, in _inner_run
return self.run(options, args)
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\site-packages\pip\_internal\cli\req_command.py", line 85, in wrapper
return func(self, options, args)
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\site-packages\pip\_internal\commands\install.py", line 520, in run
self._handle_target_dir(
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\site-packages\pip\_internal\commands\install.py", line 575, in _handle_target_dir
shutil.rmtree(target_item_dir)
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\shutil.py", line 749, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\shutil.py", line 622, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\shutil.py", line 627, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "C:\Users\timoharboe-zollner\.rhinocode\py39-rh8\lib\shutil.py", line 625, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\timoharboe-zollner\\.rhinocode\\py39-rh8\\site-envs\\default-XtRtGpEC\\numpy\\linalg\\_umath_linalg.cp39-win_amd64.pyd'
Info 12/15/2025 13:27:48 [RhinoCode] Stubs already exist for System.ValueTuple, Version=8.0.0.0