Docker: How to run cython_extensions?

FROM ubuntu:14.04.2
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN apt-get -y update && apt-get upgrade -y
RUN apt-get install python build-essential python-dev python-pip python-setuptools -y
RUN apt-get install libxml2-dev libxslt1-dev python-dev -y
RUN apt-get install libpq-dev postgresql-common postgresql-client -y
RUN apt-get install openssl openssl-blacklist openssl-blacklist-extra -y
RUN apt-get install nginx -y
RUN pip install "pip>=7.0"
RUN pip install virtualenv uwsgi

ADD canonicaliser_api /home/ubuntu/canonicaliser_api
RUN virtualenv /home/ubuntu/canonicaliser_api/venv
RUN source /home/ubuntu/canonicaliser_api/venv/bin/activate && pip install -r /home/ubuntu/canonicaliser_api/requirements.txt
RUN export CFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/
RUN source /home/ubuntu/canonicaliser_api/venv/bin/activate && \
    python /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/ \
      build_ext --inplace


Last line fails:

  Traceback (most recent call last):
  File "/home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/", line 5, in <module>
    ext_modules = cythonize("*.pyx")
  File "/home/ubuntu/canonicaliser_api/venv/local/lib/python2.7/site-packages/Cython/Build/", line 754, in cythonize
  File "/home/ubuntu/canonicaliser_api/venv/local/lib/python2.7/site-packages/Cython/Build/", line 649, in create_extension_list
    for file in nonempty(extended_iglob(filepattern), "'%s' doesn't match any files" % filepattern):
  File "/home/ubuntu/canonicaliser_api/venv/local/lib/python2.7/site-packages/Cython/Build/", line 103, in nonempty
    raise ValueError(error_msg)
ValueError: '*.pyx' doesn't match any files


What am I missing please?


source to share

1 answer

I found the problem.

  • I had to downgrade to Cython 0.21 (This is the main reason for the error)

  • Subsequently I got another problem as the script was not generating anything despite not throwing any errors. The solution had to be in this directory before executing it.


RUN source /home/ubuntu/canonicaliser_api/venv/bin/activate && cd /home/ubuntu/canonicaliser_api/canonicaliser/cython_extensions/ && python build_ext --inplace


The painful part of Docker feels like you have to cling to all the commands as they seem to be stateless.



All Articles