Build conda package with subpackages

67 Views Asked by At

I am trying to build my conda package local souce using conda build. The package has the following folder structure:

.
├── package1
│   ├── module.py
│   ├── secondmodule.py
│   └── __init__.py
├── build.sh
├── conda_build_config.yaml
├── environment.yml
├── meta.yaml
├── README.md
├── setup.py
└── subpackages
    ├── subpackage1
        ├── subpackage1wrapper.py
        ├── subpackage1cython.pyx 
        ├── compile.sh
        ├── lib
        │   ├── Makefile
        │   ├── Cfunctions.cpp
        │   └── Cheaders.h
        ├── Makefile
        └── setup.py

As you can see the package has three key elements.

  1. A main package1
  2. A subpackage folder subpackages containing a subpackage subpackage1 with some C functions, some Cython definitions and python subpackage2, each made of C files to be compiled.

package1 has subpackage1 has dependency.

My conda build.sh script contains:

#!/bin/bash
# Install package1
$PYTHON setup.py install     # Python command to install the script.

# Install subpackage1
cd subpackages/subpackage1

# compile the c code
cd lib
make

cd ..
make

# install the python package
$PYTHON setup.py install

Upon building, the subpackage is correctly compiled, Cythonized and installed. However, upon testing, following the test section of my meta.yaml:

...
test:
  imports:
    - package1
...

I get the error:

    import subpackage1 as subp
ModuleNotFoundError: No module named 'subpackage1'

Can someone provide a MWE for conda building a similar package structure?

0

There are 0 best solutions below