virtualenv returns error 'Operation not Permitted'
django, python-2.7, virtualenv
Solution
By default, VirtualBox will forbid creating symlinks in mounted shared folders due to the security reasons.
You can however, enable it yourself manually using the following command.
VBoxManage setextradata VM_NAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME 1
After that virtual environment should be bootstrapped correctly. Do not forget to shutdown the VM for this setting to be picked up.
You can refer to this VirtualBox's ticket for more details: https://www.virtualbox.org/ticket/10085.
Problem
I was using the command `virtualenv --no-site-packages django-env` but I encountered the following error ``` Traceback (most recent call last): File "/usr/local/bin/virtualenv", line 9, in <module> load_entry_point('virtualenv==12.0.7', 'console_scripts', 'virtualenv')() File "/usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg/virtualenv.py", line 825, in main symlink=options.symlink) File "/usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg/virtualenv.py", line 985, in create_environment site_packages=site_packages, clear=clear, symlink=symlink)) File "/usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg/virtualenv.py", line 1416, in install_python os.symlink(py_executable_base, full_pth) OSError: [Errno 1] Operation not permitted ``` So I thought using the command `sudo virtualenv --no-site-packages django-env` on my terminal to avoid any operating system conflicts, but it throws the following error please have a look at that ``` Traceback (most recent call last): File "/usr/local/bin/virtualenv", line 9, in <module> load_entry_point('virtualenv==12.0.7', 'console_scripts', 'virtualenv')() File "/usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg/virtualenv.py", line 825, in main symlink=options.symlink) File "/usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg/virtualenv.py", line 985, in create_environment site_packages=site_packages, clear=clear, symlink=symlink)) File "/usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg/virtualenv.py", line 1204, in install_python copyfile(stdinc_dir, inc_dir, symlink) File "/usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg/virtualenv.py", line 479, in copyfile copyfileordir(src, dest, symlink) File "/usr/local/lib/python2.7/dist-packages/virtualenv-12.0.7-py2.7.egg/virtualenv.py", line 454, in copyfileordir shutil.copytree(src, dest, symlink) File "/usr/lib/python2.7/shutil.py", line 208, in copytree raise Error, errors shutil.Error: [('/usr/include/python2.7/numpy', 'django-env/include/python2.7/numpy', '[Errno 1] Operation not permitted')] ``` I am using Ubuntu 14.04 and Python 2.7.6 I am unable to figure what is causing the error.