I try to recreate the virtualenv:
foo_bar_d@aptguettler:~$ virtualenv --system-site-packages .
I get this exception:
foo_bar_d@aptguettler:~$ virtualenv --system-site-packages .
New python executable in /home/foo_bar_d/bin/python
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 711, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 924, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 1230, in install_python
shutil.copyfile(executable, py_executable)
File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 26] Text file busy: '/home/foo_bar_d/bin/python'
Does someone know why this exception happens?
I had the exact same problem :)
virtualenv works (afaik) by modifying a copy of the python executable in the virtualenv directory area.
You must have a process using the virtualenv already so the copy of the python executable is 'in use' (technically it's mmap()'ed into memory whilst it's executing).
Unless you need to change the setup of a virtualenv you don't need to re-run the virtualenv command every time - once it's setup you just activate it when needed.
As to why it happens - It's possible that you have a service running at boot time:
ps -ef | grep python
Kill Python Processes running on your system with pkill python
I will work
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With