0

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...

Jann Poppinga
  • 444
  • 4
  • 18
  • I'm not 100% sure what directory structure is common on Windows, but your setup looks strange to me. Usually `conda-bld` is located directly in `Miniconda3`, not inside an environment. What does `conda config --show-sources` say? – Stuart Berg Aug 08 '20 at 18:10
  • Another thing worth trying: Instead of running `conda build .`, can you first `cd ..` and then `conda build ` ? Maybe there is some strange untested behavior when you try to build a recipe from within the recipe directory itself? (I'm not hopeful, just searching for possible workarounds.) – Stuart Berg Aug 08 '20 at 18:16
  • As for the python-3.8 issue: You need to add an explicit python requirement to your recipe requirements. Use `- python {{ python }}`. If you also want to ensure that the recipe fails to build if someone tries `--python=3.5`, you can add more than one constraint on the same line: `- python >=3.6,{{ python }}` – Stuart Berg Aug 08 '20 at 18:23

1 Answers1

0

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.

Jann Poppinga
  • 444
  • 4
  • 18