Rhino 8 Python 3 issue with multiple scripts

Hi @eirannejad

I encounter a bug where I have to restart Rhino when I want to run different scripts in Rhino 8 with Python 3.

Here is what I load in one script:

"""
NOTE:
DOWNLOAD DIRECTLY
"""

# -*- coding: utf-8 -*-

#! python3
# r: requests
# r: rasterio
# r: numpy
# r: charset_normalizer

import requests
import rasterio
import numpy
import charset_normalizer
import io
import os
import time

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
import System
import System.Collections.Generic

# Large script here...

And it runs fine multiple times with out issues, but if I try to run another script I get this odd error that doesn’t give much info:

if I restart Rhino 8 I can run the other script, multiple times, but then not the first one. So I restart Rhino a lot


Do you have any idea on what can cause this?
Unfortunately I can not share the script :confused:

Ok, so clicking the green tag and then the icon for the logger under it shows this code:

RhinoCodeLog

Info 30.04.2024 08.50.23 [RhinoCode] Language Registered: Plain Text 1.0 (rhinocode.builtin.text)
Info 30.04.2024 08.50.23 [RhinoCode] Language Registered: JSON 1.0 (rhinocode.builtin.json)
Info 30.04.2024 08.50.23 [RhinoCode] Storage Site Registered: Local Drive (mcneel.eto.file)
Info 30.04.2024 08.50.23 [RhinoCode] Storage Site Registered: Rhino Files (mcneel.rhinoFiles.file)
Info 30.04.2024 08.50.23 [RhinoCode] Storage Site Registered: Web (mcneel.eto.http)
Info 30.04.2024 08.50.23 [RhinoCode] Rhino3D Initialized on Windows - NETCoreApp
Info 30.04.2024 08.50.23 [RhinoCode] Platform Registered: Rhinoceros 3D @ 8.6.24101.5001 (mcneel.rhino3d.rhino)
Info 30.04.2024 08.50.23 [RhinoCode] RhinoCode server starting on \.\pipe\rhinocode_remotepipe_26992
Info 30.04.2024 08.50.23 [RhinoCode] Language Loader Registered: mcneel.pythonnet.python@3.*
Info 30.04.2024 08.50.23 [RhinoCode] Language Loader Registered: mcneel.ironpython.python@2.*
Info 30.04.2024 08.50.23 [RhinoCode] Language Loader Registered: mcneel.roslyn.csharp@9.*
Info 30.04.2024 08.50.23 [RhinoCode] Language Loader Registered: mcneel.gh1.grasshopper@1.*
Info 30.04.2024 08.50.23 [RhinoCode] Language Loader Registered: mcneel.markdig.markdown@0.*
Info 30.04.2024 08.50.24 [RhinoCode] Using existing runtime: CPython 3.9.10/41 (x64)
Info 30.04.2024 08.50.24 [RhinoCode] Initializing CPython 3.9.10/41 runtime
Info 30.04.2024 08.50.24 [RhinoCode] Deploying python packages
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “site-interop.zip”
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “utils.zip”
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “pylint-2.10.2-py3-none-any.whl”
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “pyflakes-2.4.0-py2.py3-none-any.whl”
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “pycodestyle-2.8.0-py2.py3-none-any.whl”
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “jedi-0.19.2-py2.py3-none-any.whl”
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “black-21.8b0-py3-none-any.whl”
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “pywin32-302-cp39-cp39-win_amd64.whl”
Info 30.04.2024 08.50.24 [RhinoCode] Deploying package from “psutil-5.9.1-cp39-cp39-win_amd64.whl”
Info 30.04.2024 08.50.24 [RhinoCode] Saving CPython runtime configs
Info 30.04.2024 08.50.24 [RhinoCode] PYTHONHOME: \?\C:\Users\mail.rhinocode\py39-rh8
Info 30.04.2024 08.50.24 [RhinoCode] PYTHONPATH:
Info 30.04.2024 08.50.24 [RhinoCode] Loading CPython engine from C:\Users\mail.rhinocode\py39-rh8\McNeel.Python39.Runtime.dll
Info 30.04.2024 08.50.24 [RhinoCode] Python default locale is ‘nb_NO.cp1252’
Info 30.04.2024 08.50.24 [RhinoCode] Python current locale is ‘Norwegian BokmĂ„l_Norway.1252’
Info 30.04.2024 08.50.24 [RhinoCode] Adding search path C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO (from C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO\distutils-precedence.pth)
Info 30.04.2024 08.50.24 [RhinoCode] Adding search path C:\Users\mail.rhinocode\py39-rh8\site-envs\rename default-R5RTqLa5 (from C:\Users\mail.rhinocode\py39-rh8\site-envs\rename default-R5RTqLa5\distutils-precedence.pth)
Info 30.04.2024 08.50.24 [RhinoCode] Adding search path C:\Users\mail.rhinocode\py39-rh8\lib\site-packages (from C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\distutils-precedence.pth)
Info 30.04.2024 08.50.24 [RhinoCode] Adding search path C:\Users\mail.rhinocode\py39-rh8\site-support\win32 (from C:\Users\mail.rhinocode\py39-rh8\site-support\pywin32.pth)
Info 30.04.2024 08.50.24 [RhinoCode] Adding search path C:\Users\mail.rhinocode\py39-rh8\site-support\win32\lib (from C:\Users\mail.rhinocode\py39-rh8\site-support\pywin32.pth)
Info 30.04.2024 08.50.24 [RhinoCode] Adding search path C:\Users\mail.rhinocode\py39-rh8\site-support\Pythonwin (from C:\Users\mail.rhinocode\py39-rh8\site-support\pywin32.pth)
Info 30.04.2024 08.50.24 [RhinoCode] Adding search path C:\Users\mail.rhinocode\py39-rh8\site-support (from C:\Users\mail.rhinocode\py39-rh8\site-support\pywin32.pth)
Info 30.04.2024 08.50.24 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check list --format freeze
Info 30.04.2024 08.50.24 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check list --path “C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO” --format freeze
Info 30.04.2024 08.50.24 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check list --path “C:\Users\mail.rhinocode\py39-rh8\site-envs\rename default-R5RTqLa5” --format freeze
Info 30.04.2024 08.50.24 [RhinoCode] Building stubs for platform “Rhinoceros 3D @ 8.6.24101.5001 (mcneel.rhino3d.rhino)” references
Info 30.04.2024 08.50.24 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check list --path “C:\Users\mail.rhinocode\py39-rh8\site-support” --format freeze
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Threading.Tasks.Parallel, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Windows.Forms, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Drawing.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Drawing.Common, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Eto, Version=2.7.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Eto, Version=2.7.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for RhinoCommon, Version=8.6.24101.5001
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Rhino.UI, Version=8.6.24101.5001
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Grasshopper, Version=8.6.24101.5001
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for GH_IO, Version=8.6.24101.5001
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Private.CoreLib, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.InteropServices, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Text.Encoding.CodePages, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Loader, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for mscorlib, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Collections, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Collections.Concurrent, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Threading, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.Win32.SystemEvents, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.TraceSource, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Drawing, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Drawing.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Xaml, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.ComponentModel.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Private.Uri, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Drawing.Common, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Extensions, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.Debug, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.CompilerServices.VisualC, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.Win32.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Collections.NonGeneric, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.ObjectModel, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Windows.Forms, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Threading.Thread, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Windows.Forms.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Collections.Specialized, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Configuration.ConfigurationManager, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.Process, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Memory, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Xml.ReaderWriter, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Private.Xml, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.WebClient, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.ComponentModel.EventBasedAsync, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Text.Encoding.Extensions, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.ComponentModel.TypeConverter, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.Win32.Registry, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Linq, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Collections.Immutable, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.FileSystem.Watcher, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Threading.Overlapped, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Core, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.ComponentModel, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Linq.Expressions, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.Packaging, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.Requests, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.WebHeaderCollection, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Threading.ThreadPool, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Windows.Extensions, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Text.RegularExpressions, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Numerics.Vectors, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Resources.Extensions, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Serialization, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Serialization.Xml, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Private.DataContractSerialization, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.StackTrace, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Reflection.Metadata, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Reflection.Emit.Lightweight, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Reflection.Emit.ILGeneration, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security.Cryptography, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Reflection.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Xml, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Xml.XmlSerializer, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Serialization.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Serialization.Formatters, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.MemoryMappedFiles, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.Pipes, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security.AccessControl, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security.Principal.Windows, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.Http, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.ServiceModel, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.ServiceModel.Syndication, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.Tracing, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.WebProxy, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.DiagnosticSource, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.Security, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.ServicePoint, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.Quic, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.Sockets, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.NameResolution, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security.Claims, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security.Cryptography.ProtectedData, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Numerics, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Numerics, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Data, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Data.Common, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security.Permissions, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.FileVersionInfo, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.NetworkInformation, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Management, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.ServiceModel.Primitives, Version=4.9.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Private.ServiceModel, Version=4.9.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.EventLog, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Reflection.Emit, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Web, Version=4.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Web.HttpUtility, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Windows.Controls.Ribbon, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.Scripting, Version=1.3.1.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.CodeDom, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.Dynamic, Version=1.3.1.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Resources.ResourceManager, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.FileSystem, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.InteropServices.RuntimeInformation, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Console, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.Contracts, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.TextWriterTraceListener, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.Compression.Brotli, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.Compression, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.Compression.ZipFile, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.FileSystem.DriveInfo, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.IO.IsolatedStorage, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Linq.Queryable, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Linq.Parallel, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.HttpListener, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.Mail, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.Ping, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.WebSockets.Client, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Net.WebSockets, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Reflection.DispatchProxy, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Resources.Writer, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Serialization.Json, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Threading.Tasks.Parallel, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Transactions.Local, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Xml.XDocument, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Private.Xml.Linq, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Xml.XPath.XDocument, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Xml.XPath, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Text.Json, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Text.Encodings.Web, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.CSharp, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Runtime.Intrinsics, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Diagnostics.Tools, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security.Cryptography.Primitives, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for System.Security.Cryptography.Algorithms, Version=7.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.VisualBasic, Version=10.1.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.VisualBasic.Core, Version=12.0.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.CodeAnalysis.CSharp, Version=4.6.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.CodeAnalysis, Version=4.6.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Stubs already exist for Microsoft.CodeAnalysis.VisualBasic, Version=4.6.0.0
Info 30.04.2024 08.50.24 [RhinoCode] Starting up python language server
Info 30.04.2024 08.50.25 [RhinoCode] Running async process: C:\Users\mail.rhinocode\py39-rh8\python.exe utils\pyminilsp_server.py
Info 30.04.2024 08.50.25 [RhinoCode] Preparing python auto-completion cache
Error 30.04.2024 08.50.25 [RhinoCode] Error calling OnRuntimeReady | Traceback (most recent call last):
File “file:///C:/Users/mail/.rhinocode/stage/tk3l24v0.15k”, line 72, in
AttributeError: attribute is read-only
Info 30.04.2024 08.50.25 [RhinoCode] Added Python 3.9.10 (mcneel.pythonnet.python) search path: C:\Users\mail\AppData\Roaming\McNeel\Rhinoceros\8.0\scripts
Info 30.04.2024 08.50.25 [RhinoCode] Language Registered: Python 3.9.10 (mcneel.pythonnet.python)
Info 30.04.2024 08.50.25 [RhinoCode] Using existing runtime: IronPython 2.7.12/3 (x64)
Info 30.04.2024 08.50.25 [RhinoCode] Loading IronPython 2.7.12/3 runtime
Info 30.04.2024 08.50.25 [RhinoCode] Stubs already exist for System.Diagnostics.PerformanceCounter, Version=7.0.0.0
Info 30.04.2024 08.50.25 [RhinoCode] Stubs already exist for System.IO.Ports, Version=7.0.0.0
Info 30.04.2024 08.50.25 [RhinoCode] Stubs already exist for System.Threading.AccessControl, Version=7.0.0.0
Info 30.04.2024 08.50.25 [RhinoCode] Added IronPython 2.7.12 (mcneel.ironpython.python) search path: C:\Users\mail\AppData\Roaming\McNeel\Rhinoceros\8.0\scripts
Info 30.04.2024 08.50.25 [RhinoCode] Language Registered: IronPython 2.7.12 (mcneel.ironpython.python)
Info 30.04.2024 08.50.25 [RhinoCode] Added C# 9.0 (mcneel.roslyn.csharp) search path: C:\Users\mail\AppData\Roaming\McNeel\Rhinoceros\8.0\scripts
Info 30.04.2024 08.50.25 [RhinoCode] Language Registered: C# 9.0 (mcneel.roslyn.csharp)
Info 30.04.2024 08.50.25 [RhinoCode] Language Registered: Grasshopper 1.0 (mcneel.gh1.grasshopper)
Info 30.04.2024 08.50.25 [RhinoCode] Language Registered: Markdown 0.30.4 (mcneel.markdig.markdown)
Info 30.04.2024 08.50.25 [RhinoCode] Installing “imageio, owslib, charset_normalizer”
Info 30.04.2024 08.50.25 [RhinoCode] Uninstalling “imageio”
Info 30.04.2024 08.50.25 [RhinoCode] Uninstalling “owslib”
Info 30.04.2024 08.50.25 [RhinoCode] Uninstalling “charset_normalizer”
Info 30.04.2024 08.50.25 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target “C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO” --progress-bar off --upgrade --no-warn-script-location --retries 0 --timeout 1 “imageio” “owslib” “charset_normalizer”
Info 30.04.2024 08.50.37 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check list --path “C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO” --format freeze
Info 30.04.2024 08.50.37 [RhinoCode] Collecting imageio
Using cached imageio-2.34.1-py3-none-any.whl.metadata (4.9 kB)
Collecting owslib
Using cached OWSLib-0.30.0-py2.py3-none-any.whl.metadata (6.7 kB)
Collecting charset_normalizer
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl.metadata (34 kB)
Collecting numpy (from imageio)
Using cached numpy-1.26.4-cp39-cp39-win_amd64.whl.metadata (61 kB)
Collecting pillow>=8.3.2 (from imageio)
Using cached pillow-10.3.0-cp39-cp39-win_amd64.whl.metadata (9.4 kB)
Collecting lxml (from owslib)
Using cached lxml-5.2.1-cp39-cp39-win_amd64.whl.metadata (3.5 kB)
Collecting python-dateutil>=1.5 (from owslib)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl.metadata (8.4 kB)
Collecting pytz (from owslib)
Using cached pytz-2024.1-py2.py3-none-any.whl.metadata (22 kB)
Collecting pyyaml (from owslib)
Using cached PyYAML-6.0.1-cp39-cp39-win_amd64.whl.metadata (2.1 kB)
Collecting requests>=1.0 (from owslib)
Using cached requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting six>=1.5 (from python-dateutil>=1.5->owslib)
Using cached six-1.16.0-py2.py3-none-any.whl.metadata (1.8 kB)
Collecting idna<4,>=2.5 (from requests>=1.0->owslib)
Using cached idna-3.7-py3-none-any.whl.metadata (9.9 kB)
Collecting urllib3<3,>=1.21.1 (from requests>=1.0->owslib)
Using cached urllib3-2.2.1-py3-none-any.whl.metadata (6.4 kB)
Collecting certifi>=2017.4.17 (from requests>=1.0->owslib)
Using cached certifi-2024.2.2-py3-none-any.whl.metadata (2.2 kB)
Using cached imageio-2.34.1-py3-none-any.whl (313 kB)
Using cached OWSLib-0.30.0-py2.py3-none-any.whl (222 kB)
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl (100 kB)
Using cached pillow-10.3.0-cp39-cp39-win_amd64.whl (2.5 MB)
Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Using cached lxml-5.2.1-cp39-cp39-win_amd64.whl (3.8 MB)
Using cached numpy-1.26.4-cp39-cp39-win_amd64.whl (15.8 MB)
Using cached pytz-2024.1-py2.py3-none-any.whl (505 kB)
Using cached PyYAML-6.0.1-cp39-cp39-win_amd64.whl (152 kB)
Using cached certifi-2024.2.2-py3-none-any.whl (163 kB)
Using cached idna-3.7-py3-none-any.whl (66 kB)
Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Using cached urllib3-2.2.1-py3-none-any.whl (121 kB)
Installing collected packages: pytz, urllib3, six, pyyaml, pillow, numpy, lxml, idna, charset_normalizer, certifi, requests, python-dateutil, imageio, owslib
Successfully installed certifi-2024.2.2 charset_normalizer-3.3.2 idna-3.7 imageio-2.34.1 lxml-5.2.1 numpy-1.26.4 owslib-0.30.0 pillow-10.3.0 python-dateutil-2.9.0.post0 pytz-2024.1 pyyaml-6.0.1 requests-2.31.0 six-1.16.0 urllib3-2.2.1

Info 30.04.2024 08.50.52 [RhinoCode] Stubs already exist for System.Xml.Linq, Version=4.0.0.0
Info 30.04.2024 08.51.00 [RhinoCode] Installing “charset_normalizer”
Info 30.04.2024 08.51.00 [RhinoCode] Uninstalling “charset_normalizer”
Info 30.04.2024 08.51.00 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target “C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO” --progress-bar off --upgrade --no-warn-script-location --retries 0 --timeout 1 “charset_normalizer”
Error 30.04.2024 08.51.01 [RhinoCode] Process exited with code 2
Error 30.04.2024 08.51.01 [RhinoCode] pip install error | Collecting charset_normalizer
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl.metadata (34 kB)
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl (100 kB)
Installing collected packages: charset_normalizer
Successfully installed charset_normalizer-3.3.2

ERROR: Exception:
Traceback (most recent call last):
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\cli\base_command.py”, line 180, in exc_logging_wrapper
status = run_func(*args)
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\cli\req_command.py”, line 245, in wrapper
return func(self, options, args)
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\commands\install.py”, line 510, in run
self._handle_target_dir(
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\commands\install.py”, line 565, in _handle_target_dir
shutil.rmtree(target_item_dir)
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 749, in rmtree
return _rmtree_unsafe(path, onerror)
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 627, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 625, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Ingen tilgang: ‘C:\Users\mail\.rhinocode\py39-rh8\site-envs\default-jYSimVZO\charset_normalizer\md.cp39-win_amd64.pyd’

Info 30.04.2024 08.51.02 [RhinoCode] Installing “charset_normalizer”
Info 30.04.2024 08.51.02 [RhinoCode] Uninstalling “charset_normalizer”
Info 30.04.2024 08.51.02 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target “C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO” --progress-bar off --upgrade --no-warn-script-location --retries 0 --timeout 1 “charset_normalizer”
Error 30.04.2024 08.51.03 [RhinoCode] Process exited with code 2
Error 30.04.2024 08.51.03 [RhinoCode] pip install error | Collecting charset_normalizer
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl.metadata (34 kB)
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl (100 kB)
Installing collected packages: charset_normalizer
Successfully installed charset_normalizer-3.3.2

ERROR: Exception:
Traceback (most recent call last):
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\cli\base_command.py”, line 180, in exc_logging_wrapper
status = run_func(*args)
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\cli\req_command.py”, line 245, in wrapper
return func(self, options, args)
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\commands\install.py”, line 510, in run
self._handle_target_dir(
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\commands\install.py”, line 565, in _handle_target_dir
shutil.rmtree(target_item_dir)
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 749, in rmtree
return _rmtree_unsafe(path, onerror)
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 627, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 625, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Ingen tilgang: ‘C:\Users\mail\.rhinocode\py39-rh8\site-envs\default-jYSimVZO\charset_normalizer\md.cp39-win_amd64.pyd’

Info 30.04.2024 08.51.11 [RhinoCode] Installing “charset_normalizer”
Info 30.04.2024 08.51.11 [RhinoCode] Uninstalling “charset_normalizer”
Info 30.04.2024 08.51.11 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target “C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO” --progress-bar off --upgrade --no-warn-script-location --retries 0 --timeout 1 “charset_normalizer”
Error 30.04.2024 08.51.13 [RhinoCode] Process exited with code 2
Error 30.04.2024 08.51.13 [RhinoCode] pip install error | Collecting charset_normalizer
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl.metadata (34 kB)
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl (100 kB)
Installing collected packages: charset_normalizer
Successfully installed charset_normalizer-3.3.2

ERROR: Exception:
Traceback (most recent call last):
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\cli\base_command.py”, line 180, in exc_logging_wrapper
status = run_func(*args)
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\cli\req_command.py”, line 245, in wrapper
return func(self, options, args)
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\commands\install.py”, line 510, in run
self._handle_target_dir(
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\commands\install.py”, line 565, in _handle_target_dir
shutil.rmtree(target_item_dir)
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 749, in rmtree
return _rmtree_unsafe(path, onerror)
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 627, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 625, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Ingen tilgang: ‘C:\Users\mail\.rhinocode\py39-rh8\site-envs\default-jYSimVZO\charset_normalizer\md.cp39-win_amd64.pyd’

Info 30.04.2024 08.51.19 [RhinoCode] Parsing configs schema “https://files.mcneel.com/schemas/rhinocode/editor.schema.v1.json” in C:\Users\mail.rhinocode\editor.json
Info 30.04.2024 08.53.37 [RhinoCode] Installing “charset_normalizer”
Info 30.04.2024 08.53.37 [RhinoCode] Uninstalling “charset_normalizer”
Info 30.04.2024 08.53.37 [RhinoCode] Running process: C:\Users\mail.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target “C:\Users\mail.rhinocode\py39-rh8\site-envs\default-jYSimVZO” --progress-bar off --upgrade --no-warn-script-location --retries 0 --timeout 1 “charset_normalizer”
Error 30.04.2024 08.53.38 [RhinoCode] Process exited with code 2
Error 30.04.2024 08.53.38 [RhinoCode] pip install error | Collecting charset_normalizer
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl.metadata (34 kB)
Using cached charset_normalizer-3.3.2-cp39-cp39-win_amd64.whl (100 kB)
Installing collected packages: charset_normalizer
Successfully installed charset_normalizer-3.3.2

ERROR: Exception:
Traceback (most recent call last):
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\cli\base_command.py”, line 180, in exc_logging_wrapper
status = run_func(*args)
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\cli\req_command.py”, line 245, in wrapper
return func(self, options, args)
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\commands\install.py”, line 510, in run
self._handle_target_dir(
File “C:\Users\mail.rhinocode\py39-rh8\lib\site-packages\pip_internal\commands\install.py”, line 565, in _handle_target_dir
shutil.rmtree(target_item_dir)
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 749, in rmtree
return _rmtree_unsafe(path, onerror)
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 627, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File “C:\Users\mail.rhinocode\py39-rh8\lib\shutil.py”, line 625, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Ingen tilgang: ‘C:\Users\mail\.rhinocode\py39-rh8\site-envs\default-jYSimVZO\charset_normalizer\md.cp39-win_amd64.pyd’

It seems lige charset_normalizer struggles for some reason. “Ingen tilgang” means “no permission”.

But why is it trying to install this multiple times? It is already installed. Can that be the issue?

PS! On 8.6 now, installing RC 8.7 to see if there are any changes.

@Holo From the logs it seems like the error is related to installing charset_normalizer while a version of this package is already loaded:

PermissionError: [WinError 5] Ingen tilgang: ‘C:\Users\mail\.rhinocode\py39-rh8\site-envs\default-jYSimVZO\charset_normalizer\md.cp39-win_amd64.pyd’

The md.cp39-win_amd64.pyd library gets loaded into Rhino by another script using the charset_normalizer package, so when another script is attempting to install a different version of this package, pip tries to remove the old one and fails since it is already loaded.

1 Like

OK, so why do you think it would try to install two different versions from two different scripts?
I don’t specify any versions in either of my scripts, and they used to work side by side.

I think I know what is happening. You are installing it under site-packages. This is by default used for pip and other internal packages in the python 3 runtime. So when any script runs that requires charset_normalizer, you would need to specify #venv: site-packages in your script. This tells the runtime you are using the site-packages as the environment. It also ensures the charset_normalizer is installed in the site-packages so you don’t have to do this manually.

1 Like

I added a ticket to address this issue:

RH-81895 Python runtime to include packages installed in site_packages in all envs

That’s an interesting comment, since I am not doing anything of this intentionally.

As you can see from the script snippet I posted above there (in my point of view) isn’t anything different going on with charset_normalizer than the other installers.

For users like me it would be impossible to understand that we should add an extra #venv: somewhere
 Could this be automated for us and is that what you ticket addresses?

# -*- coding: utf-8 -*-

#! python3
# r: requests
# r: rasterio
# r: numpy
# r: charset_normalizer

import requests
import rasterio
import numpy
import charset_normalizer
import io
import os
import time

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
import System
import System.Collections.Generic

# Large script here...

Yeap that is what the ticket is for. You do directly access the python runtime shipped with Rhino 8, and run pip install from shell and pip by default installed packages under site-packages

When running from inside of Rhino, pip is configured to install under site-envs so I can allow different scripts create independent environments.

I would very much like to know why you would prefer installing using pip directly in shell versus specifying the package requirements in your script as # r: charset_normalizer . This helps me debug the process. It’s better for scripts to ‘ship’ with their needed packages so if you share this script with someone else it would automatically install what is needed.

Hm
 this problem is new for the two latest sr’s and I have not pip installed for about a year
 maybe an old install has messed up now? Strange but possible. I can’t remember installing charset_normalizer with pip though, since I only testet pip in the early wip python3 days :face_with_raised_eyebrow:

Can I easily uninstall the pip installed stuff?

So I just tested this script and works:

#! python3
# r: charset_normalizer

import charset_normalizer as cn

print(cn)

You can easily access the pip that is installed with Rhino using:

It will open up a shell for you to use pip to install or uninstall packages. Notice the --target or --path option that points to the environment under site-envs, otherwise pip works in site-packages by default:

RH-81895 is fixed in Rhino 8 Service Release 8 Release Candidate 1. Please give it a try.

1 Like

Ok, so I have tested for a while now and it seems to run stable.
I can run Python 3 scripts from buttons too and jump back and forth between them with out having to restart Rhino.

I’ll keep on testing and will report when I find stuff.
Thank you!!!

Another question:
I import Rhino, rhinoscriptsyntax and scriptcontext before the referenced packages.
Is that the best order? Or should the order not affect stability?

I put them in the buttons like this:

_-RunPythonScript (

"script name and info here..."

# -*- coding: utf-8 -*-
#! python3
# r: charset_normalizer
# r: other_packages

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
import charset_normalizer
import other_packages

# Stuff done here

)

Try to put these at the top of your script. Currenly the editor only looks at the first 32 lines of the code for these specifiers.