conda build: Access error on just-created directory

99封情书 提交于 2020-08-10 19:16:16

问题


I'm trying to build a conda package with conda build .. I'm getting quite far, but after the tests, I get this output:

Renaming work directory,  C:\ProgramData\Miniconda3\envs\p37\conda-bld\<package-name>_1596716574942\work  to  
    C:\ProgramData\Miniconda3\envs\p37\conda-bld\<package-name>_1596716574942\work_moved_<package-name>-1.1.1-py38_0_win-64
Traceback (most recent call last):
  File "C:\ProgramData\Miniconda3\envs\p37\lib\shutil.py", line 566, in move
    os.rename(src, real_dst)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 
    'C:\\ProgramData\\Miniconda3\\envs\\p37\\conda-bld\\<package-name>_1596716574942\\work' ->
    'C:\\ProgramData\\Miniconda3\\envs\\p37\\conda-bld\\<package-name>_1596716574942\\work_moved_<package-name>-1.1.1-py38_0_win-64'

But how can that be when conda build itself has only just created the entire directory? I just rebooted to be on the safe side, but that did not help. Neither did running conda build in an administrator prompt.

And why does conda build build for python 3.8? The meta.yaml specifies python>=3.6 and the conda environment I'm in has Python 3.7 installed - python --version on the command line gives 3.7.6. Specifying conda build . --python=3.7 does not change the package name - it is still ...py38...


回答1:


The reason for this was that I was starting a subprocess in the setup.py. It was somewhat perplexing that it worked like that 100% on one machine and failing 100% on another and also that leaving the program in the breakpoint just before the access over the weekend (so that subprocesses should have time to finish). However, changing

cmd = 'pandoc -s --toc -t html doc/manual.md -o '+html_path
subprocess.run(cmd)

to

os.system(cmd)

solved my problem.



来源:https://stackoverflow.com/questions/63283925/conda-build-access-error-on-just-created-directory

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