Virtualenv not creating an environment

Virtualenv is using symbolic links (shutil.copytree uses them, see traceback). Creating symbolic links in a VirtualBox shared folder is disabled. Simple test in terminal (inside the guest machine):

$ ln -s testfile

Either you'll get a failed to create symbolic link './testfile': Read-only file system or Protocol error.

You can enable symbolic links in shared folders by executing in terminal on the host (solution from schisamo):

$ vboxmanage setextradata VM_NAME "VBoxInternal2/SharedFoldersEnableSymlinksCreate/NAME_OF_YOUR_SHARED_FOLDER" 1

Replace VM_NAME with the name of the virtual machine, as seen in the VirtualBox Manager:

VM_NAME example

and NAME_OF_YOUR_SHARED_FOLDER with the name of the shared folder which you can see in the settings of the virtual machine:

Shared folders settings

After the setting, restart the VirtualBox.

You can check the settings (on the host) with

$ vboxmanage getextradata VM_NAME enumerate

Fix for Windows (Ahti Kitsik) (thanks to Bryan's answer).


VirtualBox implemented symbolic links for shared folders since version 4.0 (for Linux and Solaris) but are disabled since version 4.1.8 for security reasons. That may be the reason why it first worked for you and later not.

Documentation:

VirtualBox shared folders also support symbolic links, also called symlinks, under the following conditions:

  • The host operating system must support symlinks. For example, a Mac OS X, Linux, or Oracle Solaris host is required.
  • Currently only Linux and Oracle Solaris Guest Additions support symlinks.
  • For security reasons the guest OS is not allowed to create symlinks by default. If you trust the guest OS to not abuse the functionality, you can enable creation of symlinks for a shared folder as follows [see above]

Ok after a bit more in-depth googling found that this is a VirtualBox issue, not a Ubuntu problem. The shared folders are protected from this activity. I don't know how/why it worked the first time round but it is a known bug. I created a project outside of the shared folder with no problems. Thanks for the input Dougal.