Reputation: 75
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...>
EDITED:
Today I 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....
Upvotes: 1
Views: 2406
Reputation: 75
I did find the problem was in my environment. I had defined a PYTHONPATH variable that was making conda generate incorrectly the package. Instead of going to the build package, it was importing my source code directly. Removing the PYTHONPATH the problem is solved.
Upvotes: 1