ScriptEditor reset Mac error

@eirannejad

After I reset script editor on Mac, it does not load anymore even after closing or restarting pc:



the log:

Info 05/01/2024 21:07:30 [RhinoCode] Language Registered: Plain Text 1.0 (rhinocode.builtin.text)
Info 05/01/2024 21:07:30 [RhinoCode] Language Registered: JSON 1.0 (rhinocode.builtin.json)
Info 05/01/2024 21:07:30 [RhinoCode] Storage Site Registered: Local Drive (mcneel.eto.file)
Info 05/01/2024 21:07:30 [RhinoCode] Storage Site Registered: Rhino Files (mcneel.rhinoFiles.file)
Info 05/01/2024 21:07:30 [RhinoCode] Storage Site Registered: Web (mcneel.eto.http)
Info 05/01/2024 21:07:30 [RhinoCode] Rhino3D Initialized on macOS - NETCoreApp
Info 05/01/2024 21:07:30 [RhinoCode] Platform Registered: Rhinoceros 3D @ 8.6.24101.5002 (mcneel.rhino3d.rhino)
Info 05/01/2024 21:07:30 [RhinoCode] RhinoCode server starting on /var/folders/cw/q8ncmynn475fsf585cq8qg600000gn/T/CoreFxPipe_rhinocode_remotepipe_666
Info 05/01/2024 21:08:05 [RhinoCode] Language Loader Registered: mcneel.pythonnet.python@3.*
Info 05/01/2024 21:08:05 [RhinoCode] Language Loader Registered: mcneel.ironpython.python@2.*
Info 05/01/2024 21:08:05 [RhinoCode] Language Loader Registered: mcneel.roslyn.csharp@9.*
Info 05/01/2024 21:08:05 [RhinoCode] Language Loader Registered: mcneel.gh1.grasshopper@1.*
Info 05/01/2024 21:08:05 [RhinoCode] Language Loader Registered: mcneel.markdig.markdown@0.*
Info 05/01/2024 21:08:05 [RhinoCode] Parsing configs schema "https://files.mcneel.com/schemas/rhinocode/editor.schema.v1.json" in /Users/petras/.rhinocode/editor.json
Info 05/01/2024 21:08:05 [RhinoCode] Language Registered: Python 3.9.10 (mcneel.pythonnet.python)
Info 05/01/2024 21:08:05 [RhinoCode] Using existing runtime: IronPython 2.7.12/3 (x64)
Info 05/01/2024 21:08:05 [RhinoCode] Loading IronPython 2.7.12/3 runtime
Info 05/01/2024 21:08:06 [RhinoCode] Added IronPython 2.7.12 (mcneel.ironpython.python) search path: /Users/petras/Library/Application Support/McNeel/Rhinoceros/8.0/scripts
Info 05/01/2024 21:08:06 [RhinoCode] Language Registered: IronPython 2.7.12 (mcneel.ironpython.python)
Info 05/01/2024 21:08:06 [RhinoCode] Added C# 9.0 (mcneel.roslyn.csharp) search path: /Users/petras/Library/Application Support/McNeel/Rhinoceros/8.0/scripts
Info 05/01/2024 21:08:06 [RhinoCode] Language Registered: C# 9.0 (mcneel.roslyn.csharp)
Info 05/01/2024 21:08:06 [RhinoCode] Language Registered: Grasshopper 1.0 (mcneel.gh1.grasshopper)
Info 05/01/2024 21:08:06 [RhinoCode] Language Registered: Markdown 0.30.4 (mcneel.markdig.markdown)
Info 05/01/2024 21:08:08 [RhinoCode] Initializing CPython 3.9.10/41 runtime
Error 05/01/2024 21:08:08 [RhinoCode] Error Initializing Python | Access to the path '/Users/petras/.rhinocode/py39-rh8/lib/python3.9/site-packages/wood_nano/libmpfr-4.dll' is denied.
   at System.IO.FileSystem.RemoveDirectoryRecursive(String fullPath)
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonRuntime.DeleteDeployments(CPythonStartupSteps startup) in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code.Languages.PythonNet/CPythonRuntime.cs:line 399
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonRuntime.<>c__DisplayClass105_0.<InitRuntime>b__0(Access access) in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code.Languages.PythonNet/CPythonRuntime.cs:line 246
   at Rhino.Runtime.Code.Languages.Runtime.Access.Run(String id, Action`1 task) in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code/Languages/_Runtime/Runtime.cs:line 94
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonRuntime.InitRuntime(CPythonStartupSteps startup) in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code.Languages.PythonNet/CPythonRuntime.cs:line 233
   at Rhino.Runtime.Code.Languages.PythonNet.CPython`1.Start() in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code.Languages.PythonNet/CPythonLanguage.cs:line 219
Error 05/01/2024 21:08:08 [RhinoCode] [CPY001] Runtime failed to initialize (Python 3.9.10 (mcneel.pythonnet.python))
Access to the path '/Users/petras/.rhinocode/py39-rh8/lib/python3.9/site-packages/wood_nano/libmpfr-4.dll' is denied.
   at System.IO.FileSystem.RemoveDirectoryRecursive(String fullPath)
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonRuntime.DeleteDeployments(CPythonStartupSteps startup) in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code.Languages.PythonNet/CPythonRuntime.cs:line 399
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonRuntime.<>c__DisplayClass105_0.<InitRuntime>b__0(Access access) in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code.Languages.PythonNet/CPythonRuntime.cs:line 246
   at Rhino.Runtime.Code.Languages.Runtime.Access.Run(String id, Action`1 task) in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code/Languages/_Runtime/Runtime.cs:line 94
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonRuntime.InitRuntime(CPythonStartupSteps startup) in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code.Languages.PythonNet/CPythonRuntime.cs:line 233
   at Rhino.Runtime.Code.Languages.PythonNet.CPython`1.Start() in /Users/bozo/TeamCity/buildAgent/work/96e64af5b81c6f85/src4/DotNetSDK/RhinoCode/src/Rhino.Runtime.Code.Languages.PythonNet/CPythonLanguage.cs:line 219

Seems like you have placed a wood_nano folder under site-packages. The libmpfr-4.dll is loaded by a process and Rhino fails at deleting it when reinitializing the runtime.

It’s best practice not to change the runtime directories manually. You can install the wood_nano package in a separate folder outside of the runtime (see --target option on pip) and add the path to the python search paths.

1 Like

Manually deleting solves the issue.
According to your advice I will use:

pip install --target=/path/to/installation_directory package_name

Will this error happen if a package is installed via PyPi when specifying r: #packagename keyword?

I quite sure that this happens due to windows dll on Mac… which is my fault. But I am wondering if the same thing could happen for MAC .dylib?

This is actually a bit difficult to maintain. Specially on MAC.

On windows I can pip install to rhinoscripteditor and temporary work that way for development. But for MAC, it always refers to PYPI if does not find a library it won’t load even if it is install in the site-packages folder.

After some trials, I will stay to this workflow:

sudo -H /Users/petras/.rhinocode/py39-rh8/python3.9 -m pip install .

that copies files here:
/Users/petras/.rhinocode/py39-rh8/lib/python3.9/site-packages

after I deploy PYPI package I manually delete that.

If you can show a simpler method with --target it would be much appreciated, with Conda I could not make it work. I built packages locally then pip install to the directory of script editor.