Chris
Chris

Reputation: 999

Minimal working example for conda package build

I am trying to look into conda for python package/virtual environments management. However, I can't seem to be able to build my own conda package. Could somebody help me to construct a minimal working example?

First of all some directory structure:

- src/
  |- foo1.py
  |- foo2.py
- conda-build/
  |- meta.yaml
- setup.py

Running python setup.py install installs the packages using pip. Now if I try to cd to the conda-build directory and run conda build . I get the following output

Removing old build directory
Removing old work directory
BUILD START: example_pkg-0.5.1-abc
Fetching package metadata: ......
Solving package specifications: .
The following NEW packages will be INSTALLED:

    pip:        6.1.1-py34_0
    python:     3.4.3-0
    setuptools: 15.0-py34_0

Linking packages ...
[      COMPLETE         ]|##################################################| 100%
Removing old work directory
Copying C:\some\path\ to C:\Anaconda3\conda-bld\work
Package: example_pkg-0.5.1-abc
source tree in: C:\Anaconda3\conda-bld\work
number of files: 0
Fixing permissions
Fixing permissions
BUILD END: example_pkg-0.5.1-abc
Nothing to test for: example_pkg-0.5.1-abc
# If you want to upload this package to binstar.org later, type:
#
# $ binstar upload C:\Anaconda3\conda-bld\win-64\example_pkg-0.5.1-    abc.tar.bz2
#
# To have conda build upload to binstar automatically, use
# $ conda config --set binstar_upload yes

I can indeed find the package in the directory C:\Anaconda3\conda-bld\win-64 but the package does not seem to contain any files. I can install the package using conda install --use-local .\example_pkg-0.5.1-abc.tar.bz2 and then it is listed by conda list, however I cannot import it in Python. This is my meta.yaml:

package:
  name: example_pkg
  version: "0.5.1"

source:
  path: ../src

build:
  number: 1
  string: abc
  script: python setup.py install

requirements:
  build:
    - python
  run:
    - python

Any help is greatly appreciated! :)

Upvotes: 4

Views: 2912

Answers (1)

asmeurer
asmeurer

Reputation: 91460

Looks like there's an issue where build/script doesn't work on Windows. Until that PR is merged, you should just create a bld.bat with

python setup.py install
if errorlevel 1 exit 1

and put it in the conda recipe.

Upvotes: 1

Related Questions