Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 894
monomonedula Avatar asked Feb 11 '20 12:02

monomonedula


People also ask

Does conda run setup py?

The Conda recipe is used to build a package for distribution. It builds a temporary environment with the dependencies in `recipe/meta. yaml`, then runs `python setup.py install` to install the package into that environment.

How do I run Python setup py?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

What is setup py in Python?

The setup.py file is a Python file which indicates that the installation module/package is most likely packed and distributed using Distutils, the Python Module distribution standard.


1 Answers

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
like image 155
Stuart Berg Avatar answered Sep 20 '22 08:09

Stuart Berg