1

This question has been asked, but every single answer is bash related: sudo rm -rf venv just works.

But in Windows:

Remove-Item -Recurse -Force .venv

Error:

Remove-Item : There is a mismatch between the tag specified in the request and the tag present in the reparse point
At line:1 char:1
+ Remove-Item -Recurse -Force .venv
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Remove-Item], Win32Exception
    + FullyQualifiedErrorId : System.ComponentModel.Win32Exception,Microsoft.PowerShell.Commands.RemoveItemCommand

When I look this up it seems to have something to do with PowerShell not being able to delete symbolic links. Is there any clean powershell based solution to deal with this?

J.Todd
  • 707
  • 1
  • 12
  • 34
  • Sometimes I'm amazed by how something that seems like it should be fairly trivial (in my case, downloading pip dependencies for transfer and installation on an offline machine) takes you on a journey where everything that should just work manages to fail spectacularly at every step and 3 SO questions / 24 hours (or 24 weeks) later you're staring at your screen, hopefully dealing with a *different* bug. – J.Todd Jun 11 '22 at 17:48
  • What version of python and powershell are you using? I just tried on my Windows 10 machine - used python3.10.4 - used PowerShell 5.1 as well as PowerShell 7.4 worked on both. And also what packages r installed in your venv? If you could give a list maybe we can try reproducing the issue. – miniGweek Jun 11 '22 at 20:40
  • 1
    Have a look here https://stackoverflow.com/questions/51160864/delete-children-directories-in-powershell-including-symlinks – Daniel Jun 11 '22 at 20:47
  • 1
    `[IO.Directory]::Delete((Convert-Path .venv), $true)` should work. – Santiago Squarzon Jun 11 '22 at 21:33
  • Hopefully Q&A linked by @Daniel solves your issue, after looking into it, one of [GitHub comments](https://github.com/powershell/powershell/issues/621#issuecomment-289230180) proposes calling .NET API directly (as I commented above) which I believe should work properly. If it doesn't @ me and I'll re-open the question. – Santiago Squarzon Jun 11 '22 at 22:32

0 Answers0