Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I put a conda-recipe relative to my project?

I have created a python project that I want to build with conda however I am getting an error when I cd to conda-recipe folder and run conda build . that the setup.py file was not found. I've tried moving the conda-recipe to the same level as the setup.py and adding source section to my meta.yaml but I'm still getting the error. Where is the best place to put the conda-recipe relative to my python package?

Here is my project structure:

- MyProject/
  |- conda-recipe/
    |- bld.bat
    |- build.sh
    |- meta.yaml
  |- code/
    |- subpackage/
      |- __init__.py
      |- foo.py
  |- tests/
    |- test_foo.py
  |-setup.py

Here is the content of my bld.bat:

"%PYTHON%" setup.py sdist install
if errorlevel 1 exit 1

And the build.sh:

#!/bin/bash

$PYTHON setup.py sdist install     

And the meta.yaml:

package:
  name: myproject
  version: "1.0.0" 

source:
  path: ../code

requirements:
  build:
    - python
    - setuptools

  run:
    - python
    - argparse

And for completeness here is the error:

(C:\Anaconda2\conda-bld\myproject_1492545717354\_b_env) 
  C:\Anaconda2\conda-bld\myproject_1492545717354\work>
  "C:\Anaconda2\conda-bld\myproject_1492545717354\_b_env\python.exe" setup.py 
  sdist install C:\Anaconda2\conda-bld\myproject_1492545717354\_b_env\python.exe: 
  can't open file 'setup.py': [Errno 2] No such file or directory
like image 438
jencoston Avatar asked Apr 18 '17 20:04

jencoston


People also ask

What is a conda build recipe?

A conda-build recipe is a flat directory that contains the following files: meta. yaml ---A file that contains all the metadata in the recipe. Only package/name and package/version are required. build.sh ---The script that installs the files for the package on macOS and Linux.

How do I publish to Conda-Forge?

To submit a package to the conda-forge channel, add its recipe and licence to the staged-recipes repository and create a pull request. Once the pull request is merged, the package becomes available on the conda-forge channel.

What is conda Noarch?

The conda build system allows you to specify “no architecture” when building a package, so it is compatible with all platforms and architectures. Noarch packages from your Repository instance can be downloaded and installed on any platform.

Where is Conda_build_config Yaml?

conda_build_config. yaml should be in your recipe directory, https://conda-forge.readthedocs.io/en/latest/meta.html#build-matrices. If you have numpy set to a specific version in this file, then in meta. yaml you should have numpy {{ numpy }} .


1 Answers

IIUC, the location of the conda-recipe folder doesn't really matter as long as it knows the exact location of the source code.

According to the documentation, the value of path should be pointing to a copy of the source repository. In your case, it is 'MyProject', so you could try replacing...

path: ../code 

to

path: ../../

Better yet, make it absolute instead of relative by using the $RECIPE_DIR environment variable:

path: $RECIPE_DIR/../..
like image 65
Nehal J Wani Avatar answered Sep 18 '22 00:09

Nehal J Wani