Fishes and chip Fishes and chip - 4 months ago 19
PowerShell Question

Can't create a virtual environment in the Google Drive folder

I'm using Google Drive to keep a copy of my code projects in case my computer dies (I'm also using GitHub, but not on some private projects).

However, when I try to create a virtual environment using

, I get the following error:

PS C:\users\fchatter\google drive> virtualenv env
New python executable in C:\users\fchatter\google drive\env\Scripts\python.exe
ERROR: The executable "C:\users\fchatter\google drive\env\Scripts\python.exe" could not be run: [Error 5] Access is denied

Things I've tried:

  • I thought it was because the path to the venv included blank spaces, but the command works in other paths with blank spaces. I also tried installing the win32api library, as recommended in the
    docs, but it didn't work.

  • running the PowerShell as an administrator.

Any ideas on how to solve this? My workaround at the moment is to create the venv outside of the Google Drive, which works but is inconvenient.


Don't set up a virtual env in a cloud synced folder, nor should you run a python script from such a folder. It's a bad idea. They are not meant for version control. Write access (modifying files) to the folder is limited because in your case Google drive will periodically sync the folder which will prevent exclusive write access to the folder almost always.

TLDR; One cant possibly modify files while they are being synced.

I suggest you stick to git for version control.