pythonmacospipenv

pipenv: Permission denied for ~/.local/share/virtualenvs


I'm working with a codebase that uses pipenv to install dependencies as part of its setup. However, I'm getting the following error when the pipenv install --deploy --dev command is run:

PermissionError: [Errno 13] Permission denied: '/Users/XXX/.local/share/virtualenvs'

I've checked the .local/share folder and it does not contain a virtualenvs folder. Also, the entire .local folder is owned by root.

Tool versions:

I tried sudo creating a 'virtualenvs' folder in there, but it didn't help... still permission denied. Very reluctant to chown a directory that I don't understand the security scope of.


Solution

  • Based on the comments by Philippe and chepner, I decided to change the ownership of my ~/.local/ folder. For surety's sake, I used the id command to check my username and group. On MacOS, I guess the group is always staff. Then I just used the command:

    sudo chown -R joshuasullivan:staff ~/.local

    And everything started working properly.