Giovana Morais
Giovana Morais

Reputation: 83

Google App Engine: "Error: no module named numpy.distutils.core" while deploying an app

I've read several questions about deploying Python applications on GAE, but I still couldn't manage to make my own work. First I thought it was because of my requirements.txt file and my lib folder, but then I discovered (through this question) I was messing the configurations and to flexible environments you should use only the requirements file (I may have misunderstood this too, so if I'm wrong please tell me).

I have this app.yaml file:

runtime: python
api_version: 1
env: flex
threadsafe: true

handlers:
- url: /.*
  script: app.app 

runtime_config:
  python_version: 2

entrypoint: gunicorn -w 4 -b $HOST:$PORT app:app

And this is my requirements.txt file:

certifi==2018.4.16
cffi==1.11.5
chardet==3.0.4
click==6.7
enum34==1.1.6
Flask==1.0.2
funcsigs==1.0.2
gunicorn==19.9.0
idna==2.7
itsdangerous==0.24
Jinja2==2.10
llvmlite==0.24.0
MarkupSafe==1.0
numba==0.39.0
numpy==1.15.0
pycparser==2.18
PySoundFile==0.9.0.post1
requests==2.19.1
resampy==0.2.1
scikits.talkbox==0.2.5
scipy==1.1.0
singledispatch==3.4.0.3
six==1.11.0
SoundFile==0.10.2
urllib3==1.23
Werkzeug==0.14.1

The error I'm always getting is

Step #1: Collecting scikits.talkbox==0.2.5 (from -r requirements.txt (line 20)) Step #1: Downloading https://files.pythonhosted.org/packages/65/a0/410eb932e1765186a4728d1c9b28410695d554c47439bcb69a407d5d3921/scikits.talkbox-0.2.5.tar.gz (151kB)
Step #1: Complete output from command python setup.py egg_info:
Step #1: Traceback (most recent call last):
Step #1: File "", line 1, in
Step #1: File "/tmp/pip-build-3zN00W/scikits.talkbox/setup.py", line 10, in
Step #1: from numpy.distutils.core import setup
Step #1: ImportError: No module named numpy.distutils.core

So, after doing some research, I found this question that shows kind of a "hack" to bypass this problem, the only thing is that it'll make no difference changing it locally. I have no problem running my application locally.

Upvotes: 1

Views: 474

Answers (1)

Giovana Morais
Giovana Morais

Reputation: 83

Ok, so apparently the only solution I could find was to change the runtime parameter in app.yaml to custom and then creating a Dockerfile with my configs.

I still don't know why scikits.talkbox won't install corretly through my requirements.txt, but I found out that using

RUN pip install scikits.talkbox

in my Dockerfile and removing it from my requirements file was enough to make it work. I would be glad to know if anyone could make it happen otherwise, because I'm really curious about this.

Now my app.yaml now looks like this:

runtime: custom
env: flex

Upvotes: 1

Related Questions