dotnet / interactive

.NET Interactive combines the power of .NET with many other languages to create notebooks, REPLs, and embedded coding experiences. Share code, explore data, write, and learn across your apps in ways you couldn't before.
MIT License
2.88k stars 382 forks source link

Unable to find package Azure.Identity. No packages exist with this id in source(s): C:\Program Files\dotnet\sdk\7.0.403\FSharp\library-packs #3289

Open onionhammer opened 11 months ago

onionhammer commented 11 months ago

Describe the bug

When I run

#r "nuget: Azure.Identity, 1.10.1"

I get

\nuget\Projects\3360--a4a684bf-6f1e-44e7-8ba4-aff69777dc2d\Project.fsproj : error NU1101: Unable to find package Azure.Identity. No packages exist with this id in source(s): C:\Program Files\dotnet\sdk\7.0.403\FSharp\library-packs

When I run dotnet nuget list source, i see only 1 enabled source:

Registered Sources:

  1. Package source 1 [Enabled] https://api.nuget.org/v3/index.json

Please complete the following:

Which version of .NET Interactive are you using? (In a notebook, run the #!about magic command. ):

.NET Interactive

© 2020 Microsoft Corporation

Version: 1.0.451701+e231cd6f4a395b6f74568c5ad95a15cbecb85cf2

Library version: 1.0.0-beta.23517.1+e231cd6f4a395b6f74568c5ad95a15cbecb85cf2

Build date: 2023-10-25T21:48:24.6705144Z

https://github.com/dotnet/interactive

jonsequitur commented 10 months ago

I'm not able to reproduce this issue and I don't think it would be an issue with .NET Interactive since it uses whatever NuGet configurations you have on your machine.

Are you able to restore a project referencing this package?

onionhammer commented 10 months ago

Are you able to restore a project referencing this package?

Yes, only the notebook was affected.

jonsequitur commented 10 months ago

If you run dotnet nuget list source in the same directory where the notebook is located, what do you see?

onionhammer commented 10 months ago

If you run dotnet nuget list source in the same directory where the notebook is located, what do you see?

> dotnet nuget list source
Registered Sources:
  1.  Package source 1 [Enabled]
      https://api.nuget.org/v3/index.json
  2.  C2C [Disabled]
      https://pkgs.dev.azure.com/{...snip}
  3.  Microsoft Visual Studio Offline Packages [Disabled]
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

I have 2 disabled package sources, one is an ADO package source which requires --interactive (but it's disabled)

ptrushin commented 10 months ago

I have the same error, when current dotnet version is 6 (dotnet --version in folder with file). When i add global.json like { "sdk": { "version": "7.0.400" } } all is ok

jonsequitur commented 10 months ago

.NET 8 support was released today. Please update and let us know if it resolves the issue.

onionhammer commented 10 months ago

Now I'm seeing this @jonsequitur image

Copying directly from image image

pimbrouwers commented 10 months ago

This just started happening for me as well in net8 for #F scripts, doesn't matter what package it is.

Affects: net8.0.100 Works: net6.0.x, net7.0.x

Agazoth commented 9 months ago

Sorry to hijack this issue, but we are 2 developers with a similar issue. On my machine there are no issues installing packages: image but on my colleagues machine, we se the same errors as described here: image

We are both on .NET 8.0.100 and our dotnet nuget list source lists match.

It is as if VS Code searches for packages in all sorts of places on my colleagues machine, whereas it just does the right thing on mine.

onionhammer commented 9 months ago

Glad I'm not the only one... does anyone have a workaround?

pimbrouwers commented 9 months ago

Back to the 7.* SDK is probably easiest. Just use a localized global.json and away you go.

On Mon., Dec. 11, 2023, 10:54 a.m. onionhammer, @.***> wrote:

Glad I'm not the only one... does anyone have a workaround?

— Reply to this email directly, view it on GitHub https://github.com/dotnet/interactive/issues/3289#issuecomment-1850360061, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDB57I6EN6KGK5T5ELC74TYI4UB7AVCNFSM6AAAAAA6QCFF3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGM3DAMBWGE . You are receiving this because you commented.Message ID: @.***>

Agazoth commented 9 months ago

How does the notebook system actually work?

It seems that, when a brand new notebook with a code cell with a #r "nuget: line is executed, a new FSharp project is creted in %USERPROFILE%\.packagemanagement\nuget\Projects but only if the package can be downloaded somewhere.

It also seems that the packages are downloaded from the sources configured in dotnet nuget.

Unfortunately the issue is not on my machine. It could be interesting to run ProgMon when the cell is executed.

pimbrouwers commented 9 months ago

You have the details exactly correct on how the script provides access to nuget resources via the file system, post http request.

For repro, we can peel this back even further than the notebook. It's just a wrapper around the core scripting environment.

The simplest repro would be:

  1. Create a file named NugetPackageTest.fsx
  2. On line 1 of the file enter #r "nuget:[package]"
  3. Execute script dotnet fsi NugetPackageTest.fsx

To ensure you're hitting the correct SDK create a file named global.json next to the script with the following in it:

{
  "sdk": {
    "version": "8.0.100"
  }
}
pimbrouwers commented 9 months ago

Interestingly, this error does not occur if you're running as Administrator on Windows 11.

pimbrouwers commented 9 months ago

In my case this was fixed by eliminating spaces from NuGet source names. See: https://github.com/dotnet/fsharp/issues/16071

onionhammer commented 6 months ago

Bump: This is still an error, havent been able to use notebooks for a good long while now.

nuget\Projects\39208--31424aae-586c-48f9-a5df-2f4f9b768563\Project.fsproj : error NU1101: Unable to find package Azure.Core. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, C:\Program Files\dotnet\sdk\8.0.200\FSharp\library-packs

@pimbrouwers that reference is actually the issue, unfortunately "Package source 1" isnt what I named the default nuget feed.

KevinRansom commented 6 months ago

Hey, I'm going to work on this, sorry it's taken so long to get around to it, I've been busy on other stuff.

It will be managed by this issue: https://github.com/dotnet/fsharp/issues/16071

When it's fixed, the fix will flow through to notebooks, but they only take publicly available FSharps, so it may take a while to flow.