question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

.NET PowerShell notebook does not work with Plotly

See original GitHub issue

Describe the bug

Trying to execute code within a .NET PowerShell notebook (locally using Jupyter lab, locally using VS Code and also online) does throw an error when trying to display Plotly charts via New-PlotlyChart. Example code: `$chart = [Graph.Bar]::new()

$chart.x = 20,14,23 $chart.y = ‘lions’, ‘tigers’, ‘bears’ $chart.orientation=‘h’

New-PlotlyChart -Trace $chart | Out-Display`

Error: InvalidOperation: Unable to find type [Graph.Bar]. The term ‘New-PlotlyChart’ is not recognized as a name of a cmdlet, function, script file

Please complete the following:

Which version of .NET Interactive are you using? There are a few ways to find this out: 1.0.216002+26986fc7149e69110f7485a7e02d5f8db166eebf

  • OS
    • [x ] Windows 10
    • macOS
    • Linux (Please specify distro)
    • iOS
    • Android
  • Browser
    • [x ] Chrome
    • Edge
    • Firefox
    • Safari
  • Frontend
    • Jupyter Notebook
    • [ x] Jupyter Lab
    • nteract
    • [ x] Visual Studio Code
    • Visual Studio Code Insiders
    • Other (please specify)

Screenshots

image image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
colombodcommented, Apr 16, 2021

I would not call then diversions, they are interesting takes and feature improvements! Thank you for the contributions to the project. I would love to see more work that makes extension and api even more tuned into the kernel language consuming it. That will make the user experience incredibly better.

On 16 Apr 2021, at 08:37, jhoneill @.***> wrote:

Just a nod that I’m fine with closing it. I think I’ve created two diversions which should be items in their own right. Sorry for that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

2reactions
jhoneillcommented, Apr 13, 2021

@dfinke
Sorry fingers going faster than brain when I pasted. The whole thing is

#!pwsh
$pshome
$p = Get-process -id $pid   
$p, $p.Parent, $p.Parent.Parent,$p.Parent.Parent.parent,$p.Parent.Parent.parent.parent
Get-CimInstance -ClassName win32_process -Filter "processID = $($p.id)" |  select -expand commandline
Get-CimInstance -ClassName win32_process -Filter "processID = $($p.Parent.id)" |  select -expand commandline
Get-CimInstance -ClassName win32_process -Filter "processID = $($p.Parent.parent.id)" |  select -expand commandline
Get-CimInstance -ClassName win32_process -Filter "processID = $($p.Parent.parent.parent.id)" |  select -expand commandline
Get-CimInstance -ClassName win32_process -Filter "processID = $($p.Parent.parent.parent.parent.id)" |  select -expand commandline

The output is

 NPM(K)    PM(M)      WS(M)     CPU(s)      Id  SI ProcessName
 ------    -----      -----     ------      --  -- -----------
    182   311.59     325.31       5.92   34192   1 dotnet-interactive
     21    11.54      23.05       0.39   13612   1 dotnet
     78    84.69      87.78       9.89   31108   1 Code - Insiders
     34   178.89     181.13      69.58   30032   1 Code - Insiders
     40    54.00      78.54      18.42   20188   1 Code - Insiders
"C:\Users\xxxxxx\.dotnet\tools\dotnet-interactive.exe" jupyter --default-kernel csharp C:\Users\xxx~1\AppData\Local\Temp\tmp-311089zVT7p0ij0My.json 
dotnet interactive jupyter --default-kernel csharp C:\Users\xxx~1\AppData\Local\Temp\tmp-311089zVT7p0ij0My.json
"C:\Users\xxxxxxx\AppData\Local\Programs\Microsoft VS Code Insiders\Code - Insiders.exe" --inspect-port=0   etc. et.c

Notice it’s gone back to --default-kernel csharp

@colombod image

Which gives me a clue If I change it to the last one This disappears image

The language on the cell is respected and the two command lines become

"C:\Program Files\dotnet\dotnet.exe" C:\Users\xxxxx\.nuget\packages\microsoft.dotnet-interactive\1.0.221202\tools/net5.0/any/Microsoft.DotNet.Interactive.App.dll [vscode] stdio --working-dir c:\Users\xxxx\Documents\AzDo\ --http-port 50111
dotnet tool run dotnet-interactive -- [vscode] stdio --working-dir c:\Users\xxxx\Documents\AzDo\ --http-port 50111

Every time I exit and restart vs code it reverts to the Jupyter version which would explain why I was getting the old version of .NET Interactive which was associated with the Jupyter Server and couldn’t get #!about show anything current.

If I start the server in anaconda and go to the browser I get these kernels image

Not quite the same set, and I get a third set in Az Data Studio.

Back at plotly It needs to be added manually and downloaded for each session ? Is that expected to remain ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting in Python
How to troubleshoot import and rendering problems in Plotly with Python. ... you are rendering figures: Dash, Jupyter Lab or Classic Notebook, VSCode...
Read more >
.NET Interactive: Jupyter Notebooks with .NET Core - Preview 2
NET Interactive is embedding code into a Jupyter Notebook. ... The initial preview is fairly basic but can run PowerShell code and display ......
Read more >
XPlot.Plotly.Interactive 4.0.7
Enables XPlot.Plotly to be used in .NET Interactive. When you use this package, you can embed Plotly charts directly into a .NET Interactive...
Read more >
Using .NET Core in Jupyter Notebook | Devportal
Open the Windows Command Prompt and use the following commands to install Jupyter Notebook.
Read more >
LIVE : .NET Interactive Notebooks with C#/F# in VS Code
Join Diego as he discusses some of the experiences he and his team are building to create improve experiences using notebooks.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found