jencoston
jencoston

Reputation: 1362

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

Upvotes: 11

Views: 3856

Answers (1)

Nehal J Wani
Nehal J Wani

Reputation: 16639

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

Upvotes: 7

Related Questions