OSError: [Errno 26] Text file busy on vagrant with synced_folder

匿名 (未验证) 提交于 2019-12-03 01:46:01

问题:

Originally titled: MPLCONFIGDIR .matplotlib not writeable on matplotlib import

I am running the tutorial for pylearn2 and I'm getting some errors when it imports matplotlib.pyplot. Some information that is probably unnecessary is that I'm running it in a VirtualBox generated by Vagrant. I've seen a couple of similar errors all referring to django, but I'm not trying to webhost, nor am I out of space. I've tried running python as root, as unsafe as that is, but it still didn't work. I have also tried setting my MPLCONFIGDIR variable with the same error. Please let me know if there is any more information I can include. Thanks.

Traceback (most recent call last):   File "/home/vagrant/pylearn2/pylearn2/scripts/plot_monitor.py", line 274, in <module>     main()   File "/home/vagrant/pylearn2/pylearn2/scripts/plot_monitor.py", line 57, in main     import matplotlib.pyplot as plt   File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 774, in <module>     rcParams = rc_params()   File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 692, in rc_params     fname = matplotlib_fname()   File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 604, in matplotlib_fname     fname = os.path.join(get_configdir(), 'matplotlibrc')   File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 253, in wrapper     ret = func(*args, **kwargs)   File "/usr/lib/pymodules/python2.7/matplotlib/__init__.py", line 475, in _get_configdir     raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir.  You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "% (h, h)) RuntimeError: '/home/vagrant' is not a writable dir; you must set /home/vagrant/.matplotlib to be a writable dir.  You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored 

/home/vagrant is my home directory so it is writable, but for the concerned...

vagrant@precise64:~$ ls -ld /home/vagrant drwxrwxrwx 1 vagrant vagrant 16384 Sep 26 17:40 /home/vagrant vagrant@precise64:~$ ls -ld /home/vagrant/.matplotlib/ drwxrwxrwx 1 vagrant vagrant 4096 Sep 26 18:07 /home/vagrant/.matplotlib/ 

UPDATE:

it seems to be caused by

OSError: [Errno 26] Text file busy: '/home/vagrant/.matplotlib/tmp3ciLMo' 

which I suspect has something to do with vagrant mounting my home folder as a synced_folder

回答1:

I have the similar error when I do vagrant provision. Error 26 occurs when you try to open an executable file in writing mode which is being executed. Use lsof <file> to see the process executing the file. You can avoid this error after you terminate the process.

References:

http://man7.org/linux/man-pages/man3/errno.3.htm

https://stackoverflow.com/a/15514388/547578



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!