0
votes

I created a test virtual environment using pipenv install to practice with my new installation of pipenv. I went to remove the virtual environment using pipenv --rm and it gave the following output in the cmd prompt:

D:\Desktop\testproject>pipenv --rm
Removing virtualenv (C:\Users\Harry\.virtualenvs\testproject-Ox2snZ7k)…
[=== ] Running...Error:  An error occurred while removing C:\Users\Harry\.virtualenvs\testproject-Ox2snZ7k!
[WinError 145] The directory is not empty: 'C:\\Users\\Harry\\.virtualenvs\\testproject-Ox2snZ7k'

It makes me wonder: what is the point of --rm if it means I have to manually remove the environment directory (e.g. testproject-Ox2snZ7k) myself?

1
Check with procmon if it encounters any errors while deleting the dir's contents. Something in it is probably open by some other process. - ivan_pozdeev
The error is irrelevant to pipenv and is purely Windows' workings. - ivan_pozdeev

1 Answers

0
votes

I tried pipenv --rm the next morning and the virtual environment was removed without an issue. As @ivan_pozdeev commented, something in the environment was probably being used elsewhere.

I will update this answer with Procmon results if it happens again.