Doesn't work with JupyterLab
Bob-McCrory opened this issue ยท 13 comments
Just installed JupyterLab. When I try to run an F#/Jupyter notebook that works in Jupyter, it hangs in JupyterLab, getting stuck and showing the error message in the .png below over and over.
Has IFSharp been tested on JupyterLab yet? Is there anything I can do to help?
- Windows 10
- Most recent updates installed
- .NET Runtime
I'm kind of new at this, so please forgive me if I haven't given you enough. Just let me know what else you need. Thanks.
I'm not aware of people using F# with JupyterLab but it would be great if was made possible. I took a quick look and, for me, there's a more detailed exception which is likely to be involved in your restarts:
Unhandled Exception: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path 'deletedCells', line 1, position 17.
at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
at Newtonsoft.Json.JsonTextReader.ReadAsString()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at IfSharp.Kernel.IfSharpKernel.deserializeDict(String str) in E:\dev\IfSharp\src\IfSharp.Kernel\Kernel.fs:line 109
at IfSharp.Kernel.IfSharpKernel.recvMessage(NetMQSocket socket) in E:\dev\IfSharp\src\IfSharp.Kernel\Kernel.fs:line 154
at <StartupCode$IfSharp-Kernel>.$Kernel.msg@610.Invoke(NetMQSocket socket) in E:\dev\IfSharp\src\IfSharp.Kernel\Kernel.fs:line 610
at IfSharp.Kernel.IfSharpKernel.doShell() in E:\dev\IfSharp\src\IfSharp.Kernel\Kernel.fs:line 610
at <StartupCode$IfSharp-Kernel>.$Kernel.StartAsync@705.Invoke(Unit unitVar) in E:\dev\IfSharp\src\IfSharp.Kernel\Kernel.fs:line 705
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.FSharp.Control.AsyncPrimitives.Start@938-1.Invoke(ExceptionDispatchInfo edi)
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
at <StartupCode$FSharp-Core>.$Async.-ctor@167-1.Invoke(Object o)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
What that suggests is there's new or adjusted messages in a JupyterLab context that would need responding to. It's probably a case of comparing the current protocol for Jupyter notebooks and Jupyter labs and figuring out what's new, then implementing that.
@Bob-McCrory I've had a go at a basic fix on #214 and I'm now able to load in Jupyter Lab. Give it a go.
Note there are outstanding issues in Jupyter Labs:
- Code highlighting not enabled
- Code completion not enabled
- Plotting results not shown
I still have this issue with the latest version.
Another error I get:
Unhandled Exception: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path 'deletedCells', line 1, position 17.
at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
at Newtonsoft.Json.JsonTextReader.ReadAsString()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at IfSharp.Kernel.IfSharpKernel.recvMessage(NetMQSocket socket) in C:\dev\IfSharp\src\IfSharp.Kernel\Kernel.fs:line 155
at IfSharp.Kernel.IfSharpKernel.doShell() in C:\dev\IfSharp\src\IfSharp.Kernel\Kernel.fs:line 610
at <StartupCode$IfSharp-Kernel>.$Kernel.StartAsync@705.Invoke(Unit unitVar) in C:\dev\IfSharp\src\IfSharp.Kernel\Kernel.fs:line 705
at Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.FSharp.Control.AsyncPrimitives.Start@938-1.Invoke(ExceptionDispatchInfo edi)
at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
at <StartupCode$FSharp-Core>.$Async.-ctor@167-1.Invoke(Object o)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Are you building from source or using the last zip release?
I don't think the fix has been added to a zip release but it could be done if that would be useful. It's a while since we've made one so would make sense.
@cgravill used the zip release.
I can go ahead and compile it, but having a prebuilt version available could be pretty helpful.
Thanks for the quick reply, Colin!
Sounds good, if you confirm it fixes the error via building I'll then do a zip release for others as well.
Hmm, code completion is working for me with master on Windows.
Could you try using an Incognito/InPrivate browser window to check if it's bad browser state? If that doesn't fix it, what OS? Any console errors?
I've put a prerelease version up here: https://github.com/fsprojects/IfSharp/releases/tag/v3.0.3
It generally works, but on macOS (and possibly Mono more generally) there's a cosmetic issue with a spurious error about referencing netstandard. I'll need to look into that some other time.