Django with numpy, Error: cannot import multiarray name

I am running Django in a virtual environment oriented to Python 3.4 using mod_wsgi. I have numpy 1.9 and I get this error:

**Request Method: GET Django Version: 1.7.1 Exception Type: ImportError Exception Value: cannot import name multiarray Exception Location: /var/www/mapsite/lib/python3.4/site-packages/numpy/core/__init__.py in <module>, line 6 Python Executable: /usr/bin/python Python Version: 2.7.5 Python Path: ['/var/www/mapsite/lib/python3.4/site-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode', '/var/www/mysite'] Server time: Wed, 3 Dec 2014 09:07:24 +0000** 

Plesae Council

+7
django numpy virtualenv
source share
2 answers

First you need to make sure that you are in the right environment where you installed numpy, Django, etc. Based on the information you provided, I assume that you have virtualenv and am currently developing an application. If the assumption is correct, you can follow these steps.

You do not need Apache for this.

  • The source you are virtualenv, source /path/to/env/bin/activate and go to the project directory.
  • Make sure you have the whole package that you need, pip freeze will show you, install if necessary.
  • Run the embedded server from Django, python manage.py runserver
  • Go to browser: http://localhost:8000

Voila!

0
source share

You must configure Apache and / or mod_wsgi.

In the lines that you show, you can see that Python 2.7 is used, but combined with packages from the Python 3.4 virtual environment. This is completely wrong and should be considered.

To fix this, the easiest way is to use the following python binary:

 /var/www/mapsite/bin/python3.4 

instead of the standard

 /usr/bin/python 

Using an explicit virtual binary binary is a way to go in such situations (at least it worked for me in many similar scenarios).

0
source share

All Articles