Conda build and cython problems #1698

Open
jordi-vaquero opened this Issue May 5, 2017 · 1 comment

Comments

Projects
None yet
2 participants

jordi-vaquero commented May 5, 2017 edited

I am trying to create a conda package to distribute a python tool. Part of the tool is cythonized, and it works perfectly using python setup.py install.
I create the tar properly but when I try to install it, the package does not contain the .py files that links the python imports and the .so files.
So when I try to import that packages I get a module not found.

The only think I have found around cython and conda is to introduce cython requirement in the build/run section in the meta.yaml, but I don't know why those .py files are not included.

This is my meta.yaml

package:
  name: project
  version: 1.0.0
source:
  path: /home/user/project
requirements:
  build:
    - python >=2.7
    - jinja2
    - numpy
    - scipy
    - matplotlib
    - pysam
    - setuptools
    - h5py
    - cython
  run:
    - python >=2.7
    - jinja2
    - numpy
    - scipy
    - matplotlib
    - pysam >=0.8 
    - setuptools
    - h5py
    - cython
build:
  preserve_egg_dir: True
  entry_points:
    - exec_file = project.run_exec:main
about:
  license: GPL3
  summary: "PROJECT"

my setup.py file looks like

from setuptools import setup, find_packages
from distutils.core import Extension
from Cython.Build import cythonize


extensions = [Extension('project.src.norm', ['project/src/norm.pyx'])]

setup(
    name="PROJECT",
    packages=find_packages(),
    version="1.0.0",
    description="PROJECT",
    author='Lab',
    author_email='email',
    url='http://',
    license='LICENSE.txt',
    include_package_data=True,
    entry_points={'console_scripts': ['exec_file = project.run_exec:main']},
    zip_safe=False,
    ext_modules=cythonize(extensions),
    classifiers=[
        'Development Status :: 4 - Beta',
        'Environment :: Console',
        'Intended Audience :: Bioinformaticians',
        'License :: OSI Approved :: BSD License',
        'Operating System :: MacOS',
        'Operating System :: Microsoft :: Windows',
        'Operating System :: POSIX',
        'Programming Language :: Python :: 2.7',
    ]
)

The directory structures is

project/
    setup.py
    __init__.py
    MANIFEST.in
    requirements.txt
    README.md
    info/
        meta.yaml
        build.sh
        bld.bat
    project/
         src/
            norm.pyx
        run_exec.py
    subproject/
        <etc...>

I also tried using python setup.py bdist_conda but the behavior is the same, or it is a conda issue or it is an specific problem on my configuration.
if that is the case I guess is is setup.py....

Contributor

robertwb commented Jul 9, 2017

I'm not super familiar with conda packaging details, but lots of cython-using packages ship with conda so I would try to see what they do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment