pythonanacondacondaconda-build

How to make conda-build work correctly and find the setup.py?


I am trying to create an anaconda python package. My meta.yaml looks like this:

package:
  name: liveprint-lib
  version: "0.1.0"

build:
  number: 0

requirements:
  build:
    - pip
    - python=3.7
    - setuptools
  run:
    - python=3.7
    - numpy
    - opencv

about:
  home: https://github.com/monomonedula/liveprint
  license: Apache License 2.0
  license_file: LICENSE.txt
  summary: Python utility library for dynamic animations projections

build.sh:

$PYTHON setup.py install

The folder structure:

.
├── bld.bat
├── build.sh
├── LICENSE.txt
├── liveprint
├── meta.yaml
├── README.md
├── resources
├── setup.py
└── test

The error I get when running conda build . is the following:

/home/vhhl/programs/anaconda3/conda-bld/liveprint-lib_1581422598848/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/bin/python: can't open file 'setup.py': [Errno 2] No such file or directory

What am I doing wrong?


Solution

  • Your meta.yaml file is missing a source section. Also, it's usually best to keep your recipe files in a directory of their own, rather than in the top repo. I recommend the following:

    mkdir conda-recipe
    mv meta.yaml build.sh bld.bat conda-recipe
    

    Then, edit meta.yaml to add a source section, which points to the top-level directory of your repo.

    package:
      name: liveprint-lib
      version: "0.1.0"
    
    source:
      # Relative path to the parent directory.
      path: ..
    
    build:
      number: 0
    
    requirements:
      build:
        - pip
        - python=3.7
        - setuptools
      run:
        - python=3.7
        - numpy
        - opencv
    

    Then try:

    conda build conda-recipe