fsprojects / IfSharp

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

Paket error in Azure notebook samples #146

Closed evelinag closed 7 years ago

evelinag commented 7 years ago

Description

When running the official F# tutorial "FSharp for Azure Notebooks", I'm getting an error when downloading packages with Paket.

Repro steps

  1. Go to section "Referencing NuGet Packages using Paket"
  2. Run first two cells.

Actual behavior

After running the second cell containing

Paket.Dependencies.Install """
frameworks: net45
source https://nuget.org/api/v2
nuget MathNet.Numerics
nuget MathNet.Numerics.FSharp
nuget FSharp.Data
nuget XPlot.Plotly
nuget Angara.Base
"""

Paket.LoadingScripts.ScriptGeneration.generateScriptsForRootFolder 
   Paket.LoadingScripts.ScriptGeneration.FSharp
   (Paket.FrameworkIdentifier.DotNetFramework Paket.FrameworkVersion.V4_5)
   (System.IO.DirectoryInfo __SOURCE_DIRECTORY__)

I'm getting the following:

This expression was expected to have type
    'Paket.Domain.GroupName list'    
but here has type
    'Paket.LoadingScripts.ScriptGeneration.ScriptType'    
This expression was expected to have type
    'Paket.LoadingScripts.ScriptGeneration.ScriptType'    
but here has type
    'Paket.FrameworkIdentifier'    
This expression was expected to have type
    'Paket.FrameworkIdentifier'    
but here has type
    'System.IO.DirectoryInfo'    

It seems that the function that generates load scripts has changed.

cgravill commented 7 years ago

Ah, the sample looks to be running the old syntax. We updated to use Paket 4.x which changed the syntax, more details on #140

I'll follow up with the Azure Notebooks people to make sure the sample is updated. In the meantime I suggest using this:

Paket.Package
  [ "MathNet.Numerics"
    "MathNet.Numerics.FSharp"
  ]

#load "Paket.Generated.Refs.fsx"

as that works with old and new, alternatively using Paket generateScriptsForRootFolder directly is still supported but needs adjustments.

evelinag commented 7 years ago

Thank you and thanks for the workaround, it actually looks better than using generateScriptsForRootFolder directly.

evelinag commented 7 years ago

Is there some way to use packages from github via paket using this syntax, or is it fixed to nuget?

cgravill commented 7 years ago

Great, @sylvanc came up the approach, we like it too!

On the issue itself, there were two F# samples on Azure Notebooks. Only one had been updated with the new release. This has now been resolved so new notebooks will use compatible syntax

cgravill commented 7 years ago

We're just wrapping up a Paket Dependencies object, then making a call into add https://fsprojects.github.io/Paket/paket-add.html it looks like they might be considering adding other support here https://github.com/fsprojects/Paket/issues/2057

It would be great to provide a nice way to access the GitHub dependencies within a Jupyter Notebook.

cgravill commented 7 years ago

Closing this, I've open #147 for tracking getting support for other dependency types

roguetrainer commented 5 years ago

@cgravill - was the ability to load packages into IfSharp notebooks from github ever added, in the end? I wanted to take a crack at installing the newly open-sourced https://github.com/dotnet/infer. Thanks for any advice.

roguetrainer commented 5 years ago

Apologies. As it turns out, we don't need to access Infer.NET from github, because it is on nuget, here: https://www.nuget.org/packages/Microsoft.ML.Probabilistic/
So the standard nuget approach works:

Paket.Package
       [  "Microsoft.ML.Probabilistic -Version 0.3.1810.501"
           ]

Very handy.

cgravill commented 5 years ago

@roguetrainer no problem glad you figured out an approach. BTW I hadn't realised embedding the version number in the name works. What I use is (not explicitly tested):

Paket.Version ["Microsoft.ML.Probabilistic", "0.3.1810.501"]
cgravill commented 5 years ago

Also, in case you're interested, then the files from GitHub was implemented (by @lucymukh in #179) . As an example what you can do is:

screen shot 2018-10-11 at 15 00 05

With thanks to @mndrake :)

roguetrainer commented 5 years ago

Very helpful example. Thanks @mndrake & @cgravill.

roguetrainer commented 5 years ago

Except, @mndrake & @cgravill, I tried the following,

Paket.GitHub ["dotnet/infer src/FSharpWrapper/FSharpWrapper.fs"]

and there are no errors. But I cannot find the file to load!? Will keep looking...

#load "paket-files/dotnet/infer/src/FSharpWrapper/FSharpWrapper.fs"
roguetrainer commented 5 years ago

@mndrake & @cgravill. Sorry. Found it:

 ./IfSharp/bin/paket-files/github/dotnet/infer/src/FSharpWrapper/FSharpWrapper.fs
roguetrainer commented 5 years ago

FYI, the path to DeedleFormat.fs that works is slightly different to yours Colin: #load "paket-files/github/mndrake/IfSharpLab/src/DeedleFormat.fs"

cgravill commented 5 years ago

Ah thanks for the reminder, I might have a stale file from an earlier version of Paket.