Due to the high availability of python code for the rpi, I'm trying to call python functions from Mathematica. I know that pythonika works well on OS X, but I can't compile it on the Raspberry pi.

This is the repository for pythonika:


I suspect that I need to change the Makefile.linux to match Raspberry pi settings. But so far I havent been able to succeed.


1 Answer 1


I was able to do it. I'll post what I did in case somebody else needs it. So far it works really nice. Just follow the instructions from the repository, and modify the Makefile.linux with the following code, saved as Makefile.linux:

# Set the paths according to your MathLink Developer Kit location.
# (The paths should not contain whitespaces)

MATHEMATICA_INSTALL_DIR = /opt/Wolfram/WolframEngine/10.3
MLINKDIR = ${MATHEMATICA_INSTALL_DIR}/SystemFiles/Links/MathLink/DeveloperKit

SYS = Linux-ARM
CADDSDIR = ${MLINKDIR}/${SYS}/CompilerAdditions


MPREP = "${CADDSDIR}/mprep"
MCC = "${CADDSDIR}/mcc"

# Modify the following for Python versions other than 2.6

# Path to the Python includes (modify according to Python version)

PYTHONIKA = Pythonika

# libstdc++ and librt are, apparently, needed for correct compilation under Linux
# with libMLi3 statically linked
LIBS = -L${LIBDIR} ${LIBDIR}/libML32i4.a -lstdc++ -lrt -lm -pthread -luuid -ldl -lpython${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}

all : Pythonika

Pythonika: ${PYTHONIKA}.o ${PYTHONIKA}tm.o

    ${MPREP} ${PYTHONIKA}.tm -o ${PYTHONIKA}tm.c
	${CC} -c ${PYTHONIKA}tm.c ${INCLUDES}

    ${CC} -c ${PYTHONIKA}.c ${INCLUDES}

clean :
    rm -f ${PYTHONIKA}tm.* ${PYTHONIKA}.o ${PYTHONIKA}

Now open the Pythonika.nb notebook and run the code.

I'll update this if I find any issues.

  • 3
    $\begingroup$ I edited your post directly include the code rather than your google drive file, which is less permanent. $\endgroup$
    – anderstood
    Oct 3, 2016 at 0:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.