Search code examples
pythonanacondacondawindows-subsystem-for-linux

conda build fails due to work file not found error


I'm trying to build a conda package for distribution from a python project. I am trying to build on windows subsystem for linux 2, ubuntu distro. The windows system itself is windows 10. Despite my attempts, I cannot get a successful build. I've gotten a successful build with another project so I know conda build is functional. I navigate to my project folder, and then run the following command:

conda build --python 3.10 .

I've also tried this command:

conda build --python 3.10 /path/to/project/root

All attempts to build fail, with an error about the work folder of the build process not existing. But when I look in the conda-bld folder and go to the relevant folder for the build attempt, the work folder is not only there, but has my entire project inside, with all the directories and files.

The relevant section of build output:

installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts                                                     
running install_scripts                                                                                                 
running build_scripts                                                                                                   
creating build/scripts-3.10                                                                                             
error: file '/home/<user>/anaconda3/conda-bld/<project_name>_1655486651319/work' does not exist                               
Traceback (most recent call last):                                                                                        
File "/home/<user>/anaconda3/bin/conda-build", line 11, in <module>                                                         
    sys.exit(main())                                                                                                      
File "/home/<user>/anaconda3/lib/python3.9/site-packages/conda_build/cli/main_build.py", line 488, in main                  
    execute(sys.argv[1:])                                                                                                 
File "/home/<user>/anaconda3/lib/python3.9/site-packages/conda_build/cli/main_build.py", line 477, in execute               
    outputs = api.build(args.recipe, post=args.post, test_run_post=args.test_run_post,                                    
File "/home/<user>/anaconda3/lib/python3.9/site-packages/conda_build/api.py", line 186, in build                            
    return build_tree(                                                                                                    
File "/home/<user>/anaconda3/lib/python3.9/site-packages/conda_build/build.py", line 3088, in build_tree                    
    packages_from_this = build(metadata, stats,                                                                           
File "/home/<user>/anaconda3/lib/python3.9/site-packages/conda_build/build.py", line 2211, in build                         
    utils.check_call_env(cmd, env=env, rewrite_stdout_env=rewrite_env,                                                    
File "/home/<user>/anaconda3/lib/python3.9/site-packages/conda_build/utils.py", line 411, in check_call_env                 
    return _func_defaulting_env_to_os_environ('call', *popenargs, **kwargs)                                               
File "/home/<user>/anaconda3/lib/python3.9/site-packages/conda_build/utils.py", line 391, in    
    _func_defaulting_env_to_os_environ                                                                                                                     
raise subprocess.CalledProcessError(proc.returncode, _args)                                                         
subprocess.CalledProcessError: Command '['/bin/bash', '-o', 'errexit', '/home/<user>/anaconda3/conda-bld/<project_name>_1655486651319/work/conda_build.sh']' returned non-zero exit status 1.   

One thing I notice is that the specific error is that a "file" is not found, while "work" is actually a folder(which is present in the specified location).

error: file '/home/<user>/anaconda3/conda-bld/<project_name>_1655486651319/work' does not exist    

I wonder if somehow there is some bug where a check is looking for file existence instead of folder existence, but other than that I really don't know what is wrong. I can't find any real info about this error online and I've looked using search engines, conda forums, and the stackoverflow search. I thought maybe it's some kind of permissions issue and the permissions of the work folder are: drwxr-xr-x

Here is my meta.yaml file:

{% set name = "PROGRAM_NAME" %}
{% set version = "0.0.0dev0" %}

package:
  name: "{{ name|lower }}"
  version: "{{ version }}"

source:
  path: ..
  # git_url: 
  # git_depth: 1 # only grab most recent commit on branch

build:
  number: 0
  entry_points:
      - program_name= program_name.package_name:cli_main

requirements:
  build:
    - python
    - setuptools
  host:
    - python
  run:
    - beautifulsoup4 >=4.11.1
    - biopython >=1.79
    - diamond >=2.0.15
    - fasttree >=2.1.11
    - hmmer >=3.3
    - lxml >=4.9.0
    - muscle >=3.8
    - python >=3.8
    - python-dotenv >=0.20.0
    - python-wget >=3.2
    - raxml >=8.2.12
    - requests >=2.28.0

#outputs:


about:
#  home:
#  dev_url:
#  license:
#  license_file:
  summary: A description here.

Solution

  • This answer was originally edited into the question by the OP:


    Found my problem, it was actually an issue with my setup.py file. I had tried to point it to my src folder with the following section:

    setup(
        ...
        package_dir={"": "src"},
        packages=find_packages(
            where="./src",
            exclude=["db",
                     "snapshot",
                     ]
        ),
        ...
    )
    

    This was mistake, and I simply deleted that section to allow automatic src folder mapping.