venv issues with iCloud Documents #133028
Labels
OS-mac
stdlib
Python modules in the Lib dir
topic-venv
Related to the venv module
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
This may be an odd edge case, and not sure what the "right" solution is...
If a user has "Desktop & Documents" folders synced with iCloud, and has more than one Mac, and different local usernames on each Mac, then virtual environments created on one Mac don't work on the other Mac.
It seems obvious now that I've dug into this that something would break in this scenario, but also, it wasn't immediately obvious to me why things were failing.
To recreate:
On Mac 1 with local-username-1 syncing "Documents" to iCloud Account:
On Mac 2 with local-username-2 syncing "Documents" to SAME iCloud Account:
Possible fix(?):
Change the creation of the activate script so that the VIRTUAL_ENV export statement uses the "USERNAME" environment variable:
export VIRTUAL_ENV='/Users/'${USERNAME}'/Documents/venv_name
I tested this, and it worked for me. I've tried to think of other cases where this change might cause problems, and none come to mind. But I fully accept that this may have major issues I'm oblivious to. Thoughts?
CPython versions tested on:
3.13
Operating systems tested on:
macOS
The text was updated successfully, but these errors were encountered: