fsprojects / IfSharp

F# for Jupyter Notebooks
Other
442 stars 71 forks source link

Doesn't work with JupyterLab #201

Closed Bob-McCrory closed 5 years ago

Bob-McCrory commented 5 years ago

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.

image

Has IFSharp been tested on JupyterLab yet? Is there anything I can do to help?

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.

cgravill commented 5 years ago

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 commented 5 years ago

Thanks for your reply. Given the improvements in JupyterLab vs. Jupyter, it would be great if F# could keep up.

Unfortunately, I'm not competent to help you with the coding, at least without a lot of hand holding. I just code simulations in F#, so systems work is beyond me. But if there is some way I can help, like in testing or some such, I would be glad to.

Thanks again.

Bob

Robert T. McCrory, FSA 1532 East McGraw Street Seattle, WA 98112-2134 206-323-7312 bobmccrory@outlook.commailto:bobmccrory@outlook.com


From: Colin Gravill notifications@github.com Sent: Tuesday, March 12, 2019 4:31 AM To: fsprojects/IfSharp Cc: Bob McCrory; Author Subject: Re: [fsprojects/IfSharp] Doesn't work with JupyterLab (#201)

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](AsyncActivation1 ctxt, TResult result1, FSharpFunc2 part2) at Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc2 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(FSharpFunc2 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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffsprojects%2FIfSharp%2Fissues%2F201%23issuecomment-471963219&data=02%7C01%7C%7Ca39ef2d761d84f8c268708d6a6de422a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636879870852410258&sdata=rL8HnjfHOoC0VuqcjxqIE846VLOlMfDh%2BfRQs2fY5NU%3D&reserved=0, or mute the threadhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATsah_SFy9XTXB7vZej-_43-bT07bKXLks5vV5ALgaJpZM4bnjCc&data=02%7C01%7C%7Ca39ef2d761d84f8c268708d6a6de422a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636879870852420263&sdata=tFHrA9XwRBHSkwY%2BounWsd0EPffqQ71MFidZR3QBaQI%3D&reserved=0.

cgravill commented 5 years ago

@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:

Bob-McCrory commented 5 years ago

Thanks, Colin. I'll take a shot at it when I'm back home tomorrow.

Hope the rest of your weekend is great! You've improved mine.

Bob

Robert T. McCrory, FSA 1532 East McGraw Street Seattle, WA 98112-2134 206-323-7312 bobmccrory@outlook.commailto:bobmccrory@outlook.com


From: Colin Gravill notifications@github.com Sent: Sunday, March 31, 2019 7:24 AM To: fsprojects/IfSharp Cc: Bob McCrory; Mention Subject: Re: [fsprojects/IfSharp] Doesn't work with JupyterLab (#201)

@Bob-McCroryhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FBob-McCrory&data=02%7C01%7C%7Ce1a791fcc94449824a6b08d6b5e49175%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636896390622711846&sdata=dujK5iYWOUEVMNomWX6vIgUGpVHd8T%2FrySAWMidPv1c%3D&reserved=0 I've had a go at a basic fix on #214https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffsprojects%2FIfSharp%2Fpull%2F214&data=02%7C01%7C%7Ce1a791fcc94449824a6b08d6b5e49175%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636896390622721851&sdata=VNV%2FCCcdb6DzzZ3oFZxs1gCQVK9HcLO%2BsSZ4qnYDriQ%3D&reserved=0 and I'm now able to load. Give a go.

Note there are outstanding issues in Jupyter Labs:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffsprojects%2FIfSharp%2Fissues%2F201%23issuecomment-478346479&data=02%7C01%7C%7Ce1a791fcc94449824a6b08d6b5e49175%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636896390622731863&sdata=RxQ6Ck8jlduO17dXdkXsXHWFWhO9tnlyAFR5jf2ibuk%3D&reserved=0, or mute the threadhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FATsah261Q5iIT45Uz6OQJjpb0P1kY9w1ks5vcMUUgaJpZM4bnjCc&data=02%7C01%7C%7Ce1a791fcc94449824a6b08d6b5e49175%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636896390622741862&sdata=eKOKtxsh%2BH0JZa%2FhQEVRlyJ0%2FnNjRA0oRRs26fGRDf0%3D&reserved=0.

cgravill commented 5 years ago

I've done a few more checks and it seems OK so I've merged the pull request #214

xjose97x commented 5 years ago

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()
cgravill commented 5 years ago

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.

xjose97x commented 5 years ago

@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!

cgravill commented 5 years ago

Sounds good, if you confirm it fixes the error via building I'll then do a zip release for others as well.

xjose97x commented 5 years ago

@cgravill compiled it and installed it. It worked!

Thanks a lot!

xjose97x commented 5 years ago

@cgravill Intellisense does not work, tho!

cgravill commented 5 years ago

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?

cgravill commented 5 years ago

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.