OSError:[Errno 26]文本文件在使用synced_folder的vagrant上忙碌

时间:2013-09-26 18:34:38

标签: python matplotlib virtualbox vagrant

最初标题为:MPLCONFIGDIR .matplotlib在matplotlib import上无法写入

我正在运行pylearn2的教程,我在导入matplotlib.pyplot时遇到了一些错误。一些可能不必要的信息是我在Vagrant生成的VirtualBox中运行它。我看到几个类似的错误都指的是django,但我不是在尝试虚拟主机,也不是我没有空间。我尝试以root身份运行python,因为它不安全,但它仍然无效。我也尝试使用相同的错误设置我的MPLCONFIGDIR变量。如果我能提供更多信息,请告诉我。感谢。

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是我的主目录,所以它是可写的,但对于有关的......

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/

更新:

似乎是由

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

我怀疑与将我的主文件夹安装为synced_folder的流浪汉有关

3 个答案:

答案 0 :(得分:0)

vagrant provision时遇到类似的错误。当您尝试以正在执行的写入模式打开可执行文件时,会发生错误26。使用lsof <file>查看执行文件的进程。终止进程后,可以避免此错误。

参考文献:

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

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

答案 1 :(得分:0)

运行lsof /home/vagrant/.matplotlib/tmp3ciLMofuser /home/vagrant/.matplotlib/tmp3ciLMo来检查正在使用导致文件繁忙的文件的进程。

然后终止释放文件的过程。

答案 2 :(得分:0)

这可能是VirtualBox长期存在的问题,它在同步文件夹中具有低级文件系统操作(如rmdir)。这是在Vagrant归档的原始问题:

https://github.com/hashicorp/vagrant/issues/2282

具有相同错误模式的最新VirtualBox问题:

我仍然可以使用当前的VirtualBox 6.0和6.1版本及其相应的Guest Additions版本来重现它。

我无法在任何VirtualBox版本(包括6.0和6.1)上重现Guest Additions 5.x的问题。因此,这可能是一种解决方法。

另一个解决方法是使用另一个synced folder mechanism

相关问题