Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Running Bonsai with TorchSharp on Mono/Linux #31

Open
ncguilbeault opened this issue Oct 30, 2024 · 0 comments
Open

Issue Running Bonsai with TorchSharp on Mono/Linux #31

ncguilbeault opened this issue Oct 30, 2024 · 0 comments

Comments

@ncguilbeault
Copy link
Collaborator

ncguilbeault commented Oct 30, 2024

Summary

The issue is a bit difficult to describe but essentially what happens is Bonsai crashes when trying to launch the editor on Mono/Linux when the Bonsai.ML.Torch package is installed. It is related to how assemblies are loaded in Bonsai and comes from this line where the derived class inherits from Module<Tensor, Tensor>. The error says, "Could not find assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'."

Things I've tried

  • Bonsai works as expected on Windows with no errors or crashes.
  • I've tried making explicit reference to netstandard in the .csproj but this doesn't change anything.

Steps to reproduce

  1. Clone the Bonsai.ML repo.
  2. Switch to the "torch-dev" branch.
  3. Restore and build the Bonsai.ML solution using dotnet sdk (I've tested using dotnet-8)
  4. In Bonsai, install the "Bonsai.ML.Torch" package created in the previous step.
  5. Now, open a new or existing workflow. This will cause Bonsai to exit with an error message printed to the console before the editor opens. Occasionally, I've seen the IDE open briefly before closing.

Full Error Message

Unhandled Exception:
System.IO.FileNotFoundException: Could not find assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveAssembly (System.Reflection.Metadata.AssemblyReferenceHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module) [0x00013] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ComputeTypeRefResolution (System.Reflection.Metadata.TypeReferenceHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module) [0x00099] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver+<>c.<.cctor>b__15_1 (System.Reflection.Metadata.EntityHandle h, System.Reflection.TypeLoading.Ecma.EcmaModule m) [0x00006] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.MetadataTable`2[T,C].GetOrAdd (System.Reflection.Metadata.EntityHandle handle, C context, System.Func`3[T1,T2,TResult] factory) [0x0002c] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveTypeRef (System.Reflection.Metadata.TypeReferenceHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module) [0x0000c] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaModule.GetTypeFromReference (System.Reflection.Metadata.MetadataReader reader, System.Reflection.Metadata.TypeReferenceHandle handle, System.Byte rawTypeKind) [0x00000] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeTypeHandle (System.Reflection.Metadata.BlobReader& blobReader, System.Byte rawTypeKind, System.Boolean allowTypeSpecifications) [0x00052] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications, System.Int32 typeCode) [0x00163] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications) [0x00009] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeGenericTypeInstance (System.Reflection.Metadata.BlobReader& blobReader) [0x00000] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications, System.Int32 typeCode) [0x00127] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications) [0x00009] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeTypeSequence (System.Reflection.Metadata.BlobReader& blobReader) [0x00020] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeGenericTypeInstance (System.Reflection.Metadata.BlobReader& blobReader) [0x00009] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications, System.Int32 typeCode) [0x00127] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications) [0x00009] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.TypeSpecification.DecodeSignature[TType,TGenericContext] (System.Reflection.Metadata.ISignatureTypeProvider`2[TType,TGenericContext] provider, TGenericContext genericContext) [0x00021] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveTypeSpec (System.Reflection.Metadata.TypeSpecificationHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module, System.Reflection.TypeLoading.TypeContext& typeContext) [0x0000d] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveTypeDefRefOrSpec (System.Reflection.Metadata.EntityHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module, System.Reflection.TypeLoading.TypeContext& typeContext) [0x0003b] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaDefinitionType.SpecializeBaseType (System.Reflection.TypeLoading.RoType[] instantiation) [0x00024] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.RoConstructedGenericType.ComputeBaseTypeWithoutDesktopQuirk () [0x0000c] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.RoType.ComputeBaseType () [0x00000] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.RoType.GetRoBaseType () [0x00018] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.RoType.get_BaseType () [0x00000] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at Bonsai.ReflectionHelper.GetCustomAttributesData (System.Type type, System.Boolean inherit) [0x0002e] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at Bonsai.WorkflowElementLoader+<GetWorkflowElements>d__5.MoveNext () [0x0007e] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Linq.Lookup`2[TKey,TElement].Create (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x0002b] in <69ada62907b24213a012734531df1db1>:0 
  at System.Linq.GroupedEnumerable`2[TSource,TKey].GetEnumerator () [0x00000] in <69ada62907b24213a012734531df1db1>:0 
  at System.Reactive.Linq.ObservableImpl.SelectMany`3+NoSelectorImpl[TSource,TCollection,TResult].OnNext (TSource value) [0x00032] in <ca02e5325231461a82636e1009e0b2a7>:0 
--- End of stack trace from previous location where exception was thrown ---

  at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow (System.Exception exception) [0x00006] in <76c8b808d7ec4b85a4488e5beddfd952>:0 
  at System.Reactive.ExceptionHelpers.Throw (System.Exception exception) [0x0000a] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Stubs.<.cctor>b__1 (System.Exception ex) [0x00000] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.AnonymousSafeObserver`1[T].OnError (System.Exception error) [0x0000e] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Linq.ObservableImpl.TakeUntil`2+_+T[TSource,TOther].OnError (System.Exception error) [0x00011] in <ca02e5325231461a82636e1009e0b2a7>:0 
  at System.Reactive.ScheduledObserver`1[T].Dispatch (System.Reactive.Disposables.ICancelable cancel) [0x00073] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Concurrency.Scheduler.<ScheduleLongRunning>b__72 (System.Action`1[T] a, System.Reactive.Disposables.ICancelable c) [0x00000] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Concurrency.DefaultScheduler+LongRunning+<>c__DisplayClassc`1[TState].<ScheduleLongRunning>b__b (System.Object arg) [0x00007] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Concurrency.ConcurrencyAbstractionLayerImpl+<>c__DisplayClass5.<StartThread>b__4 () [0x00000] in <76c8b808d7ec4b85a4488e5beddfd952>:0 
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <d636f104d58046fd9b195699bcb1a744>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <d636f104d58046fd9b195699bcb1a744>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <d636f104d58046fd9b195699bcb1a744>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <d636f104d58046fd9b195699bcb1a744>:0 
  at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <d636f104d58046fd9b195699bcb1a744>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not find assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly.
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveAssembly (System.Reflection.Metadata.AssemblyReferenceHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module) [0x00013] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ComputeTypeRefResolution (System.Reflection.Metadata.TypeReferenceHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module) [0x00099] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver+<>c.<.cctor>b__15_1 (System.Reflection.Metadata.EntityHandle h, System.Reflection.TypeLoading.Ecma.EcmaModule m) [0x00006] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.MetadataTable`2[T,C].GetOrAdd (System.Reflection.Metadata.EntityHandle handle, C context, System.Func`3[T1,T2,TResult] factory) [0x0002c] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveTypeRef (System.Reflection.Metadata.TypeReferenceHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module) [0x0000c] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaModule.GetTypeFromReference (System.Reflection.Metadata.MetadataReader reader, System.Reflection.Metadata.TypeReferenceHandle handle, System.Byte rawTypeKind) [0x00000] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeTypeHandle (System.Reflection.Metadata.BlobReader& blobReader, System.Byte rawTypeKind, System.Boolean allowTypeSpecifications) [0x00052] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications, System.Int32 typeCode) [0x00163] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications) [0x00009] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeGenericTypeInstance (System.Reflection.Metadata.BlobReader& blobReader) [0x00000] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications, System.Int32 typeCode) [0x00127] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications) [0x00009] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeTypeSequence (System.Reflection.Metadata.BlobReader& blobReader) [0x00020] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeGenericTypeInstance (System.Reflection.Metadata.BlobReader& blobReader) [0x00009] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications, System.Int32 typeCode) [0x00127] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.Ecma335.SignatureDecoder`2[TType,TGenericContext].DecodeType (System.Reflection.Metadata.BlobReader& blobReader, System.Boolean allowTypeSpecifications) [0x00009] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.Metadata.TypeSpecification.DecodeSignature[TType,TGenericContext] (System.Reflection.Metadata.ISignatureTypeProvider`2[TType,TGenericContext] provider, TGenericContext genericContext) [0x00021] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveTypeSpec (System.Reflection.Metadata.TypeSpecificationHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module, System.Reflection.TypeLoading.TypeContext& typeContext) [0x0000d] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaResolver.ResolveTypeDefRefOrSpec (System.Reflection.Metadata.EntityHandle handle, System.Reflection.TypeLoading.Ecma.EcmaModule module, System.Reflection.TypeLoading.TypeContext& typeContext) [0x0003b] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.Ecma.EcmaDefinitionType.SpecializeBaseType (System.Reflection.TypeLoading.RoType[] instantiation) [0x00024] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.RoConstructedGenericType.ComputeBaseTypeWithoutDesktopQuirk () [0x0000c] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.RoType.ComputeBaseType () [0x00000] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.RoType.GetRoBaseType () [0x00018] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Reflection.TypeLoading.RoType.get_BaseType () [0x00000] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at Bonsai.ReflectionHelper.GetCustomAttributesData (System.Type type, System.Boolean inherit) [0x0002e] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at Bonsai.WorkflowElementLoader+<GetWorkflowElements>d__5.MoveNext () [0x0007e] in <9c19be5e35fa47b58c5c3cea5b2adb98>:0 
  at System.Linq.Lookup`2[TKey,TElement].Create (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x0002b] in <69ada62907b24213a012734531df1db1>:0 
  at System.Linq.GroupedEnumerable`2[TSource,TKey].GetEnumerator () [0x00000] in <69ada62907b24213a012734531df1db1>:0 
  at System.Reactive.Linq.ObservableImpl.SelectMany`3+NoSelectorImpl[TSource,TCollection,TResult].OnNext (TSource value) [0x00032] in <ca02e5325231461a82636e1009e0b2a7>:0 
--- End of stack trace from previous location where exception was thrown ---

  at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow (System.Exception exception) [0x00006] in <76c8b808d7ec4b85a4488e5beddfd952>:0 
  at System.Reactive.ExceptionHelpers.Throw (System.Exception exception) [0x0000a] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Stubs.<.cctor>b__1 (System.Exception ex) [0x00000] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.AnonymousSafeObserver`1[T].OnError (System.Exception error) [0x0000e] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Linq.ObservableImpl.TakeUntil`2+_+T[TSource,TOther].OnError (System.Exception error) [0x00011] in <ca02e5325231461a82636e1009e0b2a7>:0 
  at System.Reactive.ScheduledObserver`1[T].Dispatch (System.Reactive.Disposables.ICancelable cancel) [0x00073] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Concurrency.Scheduler.<ScheduleLongRunning>b__72 (System.Action`1[T] a, System.Reactive.Disposables.ICancelable c) [0x00000] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Concurrency.DefaultScheduler+LongRunning+<>c__DisplayClassc`1[TState].<ScheduleLongRunning>b__b (System.Object arg) [0x00007] in <ccffe746d40444b9b3de95f82ba320ef>:0 
  at System.Reactive.Concurrency.ConcurrencyAbstractionLayerImpl+<>c__DisplayClass5.<StartThread>b__4 () [0x00000] in <76c8b808d7ec4b85a4488e5beddfd952>:0 
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <d636f104d58046fd9b195699bcb1a744>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <d636f104d58046fd9b195699bcb1a744>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <d636f104d58046fd9b195699bcb1a744>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <d636f104d58046fd9b195699bcb1a744>:0 
  at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <d636f104d58046fd9b195699bcb1a744>:0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant