just starting to get my hands dirty with snappy. I am trying to port a python project to a snappy app. The python code relies on numpy 1.5.1, which relies on python-dev being installed.
My snapcraft parts section looks like:
parts:
mypythonapp:
plugin: python2
source: https://github.com/me/mypythonapp.git
source-type: git
build-packages:
- gcc
- gfortran
- libblas-dev
- liblapack-dev
- cython
- python-dev
python-packages:
- numpy==1.5.1
When I snapcraft pull
it attempts to build numpy, but errors out with:
x86_64-linux-gnu-gcc: build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.c
In file included from numpy/core/src/npymath/ieee754.c.src:7:0:
numpy/core/src/npymath/npy_math_common.h:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
In file included from numpy/core/src/npymath/ieee754.c.src:7:0:
numpy/core/src/npymath/npy_math_common.h:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Command "x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include/x86_64-linux-gnu -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include -I/home/me/Code/mypythonapp-snap/parts/mypythonapp/install/usr/include/x86_64-linux-gnu -fPIC -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.c -o build/temp.linux-x86_64-2.7/build/src.linux-x86_64-2.7/numpy/core/src/npymath/ieee754.o"
I can find Python.h
located at ./parts/mypythonapp/install/usr/include/python2.7/Python.h
. When I look at the all the included paths I notice that usr/include/python2.7
is not there.
Is there anyway for me to include a path similar to the autotools plugin configflags? Or am I missing something easy?
edit:
I have made some progress by modifying env
function in the python2 plugin located at /usr/lib/python3/dist-packages/snapcraft/plugins/python2.py
The original function looked like:
def env(self, root):
# This is until we figure out how to get pip to download only
# and then build in the build step or split out pulling
# stage-packages in an internal private step.
env = [
'CPPFLAGS="-I{} $CPPFLAGS"'.format(os.path.join(
root, 'usr', 'include')),
'CFLAGS="-I{} $CFLAGS"'.format(os.path.join(
root, 'usr', 'include')),
]
I modified it to look like:
def env(self, root):
# This is until we figure out how to get pip to download only
# and then build in the build step or split out pulling
# stage-packages in an internal private step.
env = [
'CPPFLAGS="-I{} $CPPFLAGS"'.format(os.path.join(
root, 'usr', 'include')),
'CFLAGS="-I{} $CFLAGS"'.format(os.path.join(
root, 'usr', 'include')),
'CPPFLAGS="-I{} $CPPFLAGS"'.format(os.path.join(
root, 'usr', 'include', 'python2.7')),
'CFLAGS="-I{} $CFLAGS"'.format(os.path.join(
root, 'usr', 'include' 'python2.7')),
]
Now it picks up the Python.h
, but it fails to find scalartypes.c
x86_64-linux-gnu-gcc: numpy/core/src/multiarray/multiarraymodule_onefile.c
numpy/core/src/multiarray/multiarraymodule_onefile.c:10:25: fatal error: scalartypes.c: No such file or directory
compilation terminated.
numpy/core/src/multiarray/multiarraymodule_onefile.c:10:25: fatal error: scalartypes.c: No such file or directory
compilation terminated.