Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pip: Exception when a component appears more than once #883

Closed
sonnb opened this issue Oct 30, 2023 · 1 comment
Closed

Pip: Exception when a component appears more than once #883

sonnb opened this issue Oct 30, 2023 · 1 comment
Labels
detector:pip The pip detector duplicate This issue or pull request already exists type:bug Bug fix of existing functionality

Comments

@sonnb
Copy link

sonnb commented Oct 30, 2023

In my case, although in the requirement.text file numpy only appears one but it seems to be transitively linked from other components and when I run the scan, it throws those errors. I think it should nicely handle the case of duplication?

##[error]Component "0.1.1.post2209072238" : {ReleaseValue)} could not be added to the sorted list of pip components for spec="thop". Usually this happens with unexpected PyPi version formats (e.g. prerelease/dev versions).
System.ArgumentException: An item with the same key has already been added. Key: [0.1.1.post2209072238, System.Collections.Generic.List`1[Microsoft.ComponentDetection.Detectors.Pip.PythonProjectRelease]]
   at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)
   at Microsoft.ComponentDetection.Detectors.Pip.PyPiClient.GetReleasesAsync(PipDependencySpecification spec)
##[error]Error while parsing pip components in "/builds/xxx/yyy/requirements.txt"
System.ArgumentException: An item with the same key has already been added. Key: numpy
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](List`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
   at Microsoft.ComponentDetection.Detectors.Pip.PythonResolver.InvalidateAndReprocessAsync(PythonResolverState state, PipGraphNode node, PipDependencySpecification newSpec)
   at Microsoft.ComponentDetection.Detectors.Pip.PythonResolver.ProcessQueueAsync(ISingleFileComponentRecorder singleFileComponentRecorder, PythonResolverState state)
   at Microsoft.ComponentDetection.Detectors.Pip.PythonResolver.ResolveRootsAsync(ISingleFileComponentRecorder singleFileComponentRecorder, IList`1 initialPackages)
   at Microsoft.ComponentDetection.Detectors.Pip.PipComponentDetector.OnFileFoundAsync(ProcessRequest processRequest, IDictionary`2 detectorArgs)

AB#2119435

@cobya
Copy link
Contributor

cobya commented Nov 29, 2023

Closing as a duplicate of #862

@cobya cobya closed this as completed Nov 29, 2023
@cobya cobya added duplicate This issue or pull request already exists type:bug Bug fix of existing functionality detector:pip The pip detector labels Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detector:pip The pip detector duplicate This issue or pull request already exists type:bug Bug fix of existing functionality
Projects
None yet
Development

No branches or pull requests

2 participants