# Python environment corruption

**URL:** <https://discourse.mcneel.com/t/python-environment-corruption/201844>\
**Category:** Scripting\
**Tags:** windows\
**Created:** [March 23, 2025, 3:01pm UTC](https://discourse.mcneel.com/t/python-environment-corruption/201844 "2025-03-23T15:01:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![matinkabiri](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/matinkabiri/32/525033_2.png) [@matinkabiri](https://discourse.mcneel.com/u/matinkabiri)\
**Post date:** [March 23, 2025, 3:01pm UTC](https://discourse.mcneel.com/t/python-environment-corruption/201844/1 "2025-03-23T15:01:58Z")

</div>

Hi everyone,

I’m using **Rhino version 8.16.25042.13001** with **Python 3**. I only installed two additional libraries: **numpy** and **matplotlib**.

I was fixing a legacy code that was passed down from my colleagues. But my Grasshopper crashed. I have tried the following steps to resolve the issue:

- Removed this folder C:\Users\MATIN.rhinocode\py39-rh8\site-envs\default\_askjdhei
- Renamed the folder to default
- Uninstalled Rhino using Revo Uninstaller.
- Deleted all folders related to Rhino.
- Reinstalled Rhino.

Despite these steps, I’m still facing problems. I have attached the `.gh` file of the plugin (little side project), the file contains all the code I’m using to develop the plugin—nothing external to the code inside the GHA file.

Below is a snippet of the code we used to use to load matplotlib that might be the reason why.

```python
# requirements: matplotlib
import locale
locale.setlocale(locale.LC_ALL, "en-US")

```

The error I’m getting is:

```auto
Error running script (ExecuteException): Environment "default" is corrupted due to a possible package installation failure

```

Now, no Python code runs, even after reinstalling Rhino. I’ve also included the crash dump and the recovery file. I’m not sure what the problem is, so please only open the files if you’re confident about the potential fix.

Any help or guidance would be greatly appreciated!

Thanks in advance.

* * *

Feel free to adjust any details as needed before posting.  
[RhinoCrashDump.gh](https://discourse.mcneel.com/uploads/short-url/q2j1shCBD7XlYrb9n1hxpbKHaEH.gh) (132.9 KB)  
[back gh2.gh](https://discourse.mcneel.com/uploads/short-url/98NfSIzT9z9GR1rgonpzwimfkxs.gh) (136.7 KB)

---

<div class="post-metadata">

**Author:** ![matinkabiri](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/matinkabiri/32/525033_2.png) [@matinkabiri](https://discourse.mcneel.com/u/matinkabiri)\
**Post date:** [March 24, 2025, 2:05pm UTC](https://discourse.mcneel.com/t/python-environment-corruption/201844/2 "2025-03-24T14:05:27Z")

</div>

I found the fix, and it was much simpler than I expected!

### How to Fix It:

1. Open **Script Editor** in Rhino.
2. Go to **Tools** \> **Advanced**.
3. Select **Reset Python 3 (CPython) Runtime** this is the option you need.

Big thanks to @eirannejad

For more details, check out this guide:  
[**Rhino - Python Package Environments**](https://developer.rhino3d.com/guides/scripting/advanced-pyvenvs/?utm_source=chatgpt.com#site-packages)

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/477962_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [March 24, 2025, 4:19pm UTC](https://discourse.mcneel.com/t/python-environment-corruption/201844/3 "2025-03-24T16:19:52Z")

</div>

Perfect. You found the solution before I even see this thread 👏

This normally happens when there is a conflict in package install. ScriptEditor assumes the environment is corrupt since `pip` might have deleted some files and failed at deleting other files and leave an invalid environment

---

<div class="post-metadata">

**Author:** ![polforeman](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/polforeman/32/474040_2.png) [@polforeman](https://discourse.mcneel.com/u/polforeman)\
**Post date:** [May 13, 2025, 4:41pm UTC](https://discourse.mcneel.com/t/python-environment-corruption/201844/4 "2025-05-13T16:41:27Z")

</div>

This solution worked fine, but I was first confused since a similar process in the Grasshopper (not Rhino!) ScriptEditor didn’t do anything. Just in case someone tries it in the wrong ScriptEditor like I just did 🙂

---

<div class="post-metadata">

**Author:** ![porterfield.aaron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/porterfield.aaron/32/479214_2.png) [@porterfield.aaron](https://discourse.mcneel.com/u/porterfield.aaron)\
**Post date:** [August 7, 2025, 11:01am UTC](https://discourse.mcneel.com/t/python-environment-corruption/201844/5 "2025-08-07T11:01:19Z")

</div>

Hi Ehsan,

I dont see a Tools\>Advanced tab in the script editor. Under Tools there is “Reload Python 3” but that does not seem to fix the corrupt environment problem.

---

<div class="post-metadata">

**Author:** ![porterfield.aaron](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/porterfield.aaron/32/479214_2.png) [@porterfield.aaron](https://discourse.mcneel.com/u/porterfield.aaron)\
**Post date:** [August 7, 2025, 11:24am UTC](https://discourse.mcneel.com/t/python-environment-corruption/201844/6 "2025-08-07T11:24:54Z")

</div>

Sorry @eirannejad my fault for not reading carefully. It is in the Rhino Script Editor. 🤦

---

<div class="post-metadata">

**Author:** ![ShynnSup](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/shynnsup/32/767220_2.png) [@ShynnSup](https://discourse.mcneel.com/u/ShynnSup)\
**Post date:** [May 13, 2026, 9:08pm UTC](https://discourse.mcneel.com/t/python-environment-corruption/201844/7 "2026-05-13T21:08:28Z")

</div>

This fixed the issue, but then when I made change to the script it again happened.. what is going on?

`Error building script: Environment “default” is corrupted due to a possible package installation failure`

I am simply importing ‘math’
