I have a Windows 10 guest managed by vagrant, and a python app directory synced:
#Vagrantfile
config.vm.synced_folder "../python_app", "/vagrant_data"
I want to have a venv
in both OSX host and Windows guest, but get error when trying to create in the guest:
Error: Unable to create directory 'C:\\vagrant_data'
In the guest box, C:\vagrant_data
contains the python_app
files.
And it is symlinked to another directory in the guest:
Directory of C:\
11/18/2020 03:34 PM <DIR> Users
etc...
11/18/2020 03:17 PM <SYMLINKD> vagrant [\\vboxsvr\vagrant]
11/18/2020 03:17 PM <SYMLINKD> vagrant_data [\\vboxsvr\vagrant_data]
I am able to create a file:
echo hello world > vagrant_data\hello.txt
Or a directory:
mkdir vagrant_data\removeme
These files appear in the host directory as well.
There isn't already a Scripts
or Lib
directory.
There is, however a pyvenv.cfg
file, which contains details from the host (osx):
home = /usr/local/bin
include-system-site-packages = false
version = 3.8.6
Despite that I have py --version 3.9
in the guest, the home location will obviously be different.
Is a good solution to exclude specified files within the synced directory?
Another option is, of course to not sync at all and use the Git remote to pass files from the devbox to the test environment.
does a one-time one-way sync from the machine running to the machine being started by Vagrant.
What makes much more sense is to simple move the venv
into a directory above the synced folder, like this:
config.vm.synced_folder "../my_venv/python_app", "/my_venv/python_app"
(Syncing a folder that's next to, rather than within the one that the Vagrantfile is located in)
In this way, only the second directory is synced, but the first is created. So I vagrant ssh
into the guest, cd
into the directory above the synced one and create the venv
there.