IOError: [Errno 13] Permission denied
当我尝试运行创建函数空间时,我一直收到权限被拒绝错误: 。
我认为这与 JIT 编译器有关。不知何故,所有编译都是在 root 下完成的,当它尝试读取时权限被拒绝。
这是我收到的错误日志:
lento@lento-VPCF11C5E:~/Documents/Thesis/programs/navierstokes$ python test_navierStokes.py
Traceback (most recent call last):
File "test_navierStokes.py", line 104, in <module>
N=np.array([nx,ny]))
File "/home/lento/Documents/Thesis/programs/navierstokes/navierStokes.py", line 145, in __init__
self._nu,self._cfl,self._uMax)
File "/home/lento/Documents/Thesis/programs/navierstokes/base/ipcs.py", line 129, in __init__
super(ipcs,self).__init__(mesh,boundaryDomains,nu,cfl,uMax)
File "/home/lento/Documents/Thesis/programs/navierstokes/base/solverBase.py", line 68, in __init__
self.boundary_DOFCoordinates, self.boundary_VectorDOFIndex = boundary.locate_boundaryDOFs(self.mesh,self.boundaryDomains,3)
File "/home/lento/Documents/Thesis/programs/navierstokes/base/boundary.py", line 125, in locate_boundaryDOFs
V = dolfin.FunctionSpace(mesh, "CG", p)
File "/usr/lib/python2.7/dist-packages/dolfin/functions/functionspace.py", line 403, in __init__
FunctionSpaceBase.__init__(self, mesh, element, constrained_domain)
File "/usr/lib/python2.7/dist-packages/dolfin/functions/functionspace.py", line 84, in __init__
ufc_element, ufc_dofmap = jit(self._ufl_element)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 60, in mpi_jit
return local_jit(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/dolfin/compilemodules/jit.py", line 122, in jit
return jit_compile(form, parameters=p, common_cell=common_cell)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 76, in jit
return jit_element(ufl_object, parameters)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 252, in jit_element
compiled_form, module, form_data, prefix = jit_form(form, parameters)
File "/usr/lib/python2.7/dist-packages/ffc/jitcompiler.py", line 179, in jit_form
module = instant.import_module(module_name, cache_dir=cache_dir)
File "/usr/lib/python2.7/dist-packages/instant/cache.py", line 156, in import_module
return check_disk_cache(modulename, cache_dir, moduleids)
File "/usr/lib/python2.7/dist-packages/instant/cache.py", line 113, in check_disk_cache
lock = get_lock(cache_dir, modulename)
File "/usr/lib/python2.7/dist-packages/instant/locking.py", line 81, in get_lock
lock = open(os.path.join(cache_dir, lockname), "w")
IOError: [Errno 13] Permission denied: '/home/lento/.instant/cache/ffc_form_3d305e9085738f267ea73581b5f0769fda1e332d.lock'
答案1
您不应该以 root 身份编译内容。编译不需要 root。root 仅用于安装,如果您要安装在 $HOME 目录中,则不应使用 root,因为这是您的 $HOME,而不是 root 的。您应该只更改以 root 身份编译的内容的权限。
sudo chwon -R $USER:$USER ~/.instant