2

I'm trying to set up virtualenv with numpy. I've found that the recommended way to do it is by using

python setup.py install

in the numpy directory while under virtual enviroment.

I was wondering if it's possible to avoid the fortran compiling and just use a numpy binary available for OS?

Has anyone tried this? I couldn't figure out where is numpy located.

UPDATE:

Managed to do something. Searched for "numpy" in my file system and found it in "usr/lib/pymodules/python2.7/numpy".

Then i just copied that to my virtualenv folder to "lib/pymodules/python2.7"

For now, i was able to call all numpy methods i tried.

UPDATE:

Tried to install matplotlib since numpy is a dependency for it. That failed:

REQUIRED DEPENDENCIES  
    numpy: 1.5.1  
    freetype2: found, but unknown version (no pkg-config)  
    * WARNING: Could not find 'freetype2' headers in any  
    * of '/usr/include', '.', '/usr/include/freetype2',  
    * './freetype2'.  

pymods ['pylab']
packages ['matplotlib', 'matplotlib.backends', 'matplotlib.backends.qt4_editor',     'matplotlib.projections', 'matplotlib.testing', 'matplotlib.testing.jpl_units',     'matplotlib.tests', 'mpl_toolkits', 'mpl_toolkits.mplot3d', 'mpl_toolkits.axes_grid',     'mpl_toolkits.axes_grid1', 'mpl_toolkits.axisartist', 'matplotlib.sphinxext',     'matplotlib.tri', 'matplotlib.delaunay', 'pytz', 'dateutil', 'dateutil.zoneinfo']
warning: no files found matching 'KNOWN_BUGS'
warning: no files found matching 'INTERACTIVE'
warning: no files found matching 'MANIFEST'
warning: no files found matching '__init__.py'
warning: no files found matching 'examples/data/*'
warning: no files found matching 'lib/mpl_toolkits'
warning: no files found matching 'LICENSE*' under directory 'license'
In file included from ./CXX/Extensions.hxx:37:0,
    from src/ft2font.h:6,
    from src/ft2font.cpp:3:
./CXX/WrapPython.h:58:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1

It does seem so that it isn't numpy which is causing the errors. Trying to diagnose the cause of the error...

UPDATE: Manually went through all REQUIRED DEPENDENCIES and installed them. It flied by to fast so i didn't notice it, and believed it yielded no errors.

TheMeaningfulEngineer
  • 15,679
  • 27
  • 85
  • 143

2 Answers2

4

Probably you need python dev package. try this

sudo apt-get install python2.7-dev
raxith
  • 60
  • 1
  • 9
  • Nope, checked and it's installed. It seems to be a missing dependency of gcc. – TheMeaningfulEngineer Sep 20 '12 at 10:02
  • @Alan If you get this error `fatal error: Python.h: No such file or directory compilation terminated.`, means gcc is not able to locate Python.h, which is unlikely the problem with gcc, also indicates that gcc is trying to compile (using source files) but could not locate particular header file. – raxith Sep 28 '12 at 12:34
  • For me was necessary do `sudo apt-get install python3.2-dev libpng12-dev libfreetype6-dev` – Arthur Julião Jan 15 '13 at 13:55
0

Not sure what OS you're using, but I would just use an EPD Free binary for this. Granted, you get SciPy and some other stuff along with it, but it's about as hassle-free as you can get.

Travis Vaught
  • 358
  • 2
  • 6
  • 1
    You might also have a look at [this post](http://seanjtaylor.com/2011/03/03/getting-epd-to-play-nicely-with-virtual-environments/) regarding [virtualenvwrapper](http://www.doughellmann.com/projects/virtualenvwrapper/) and EPD together. – Travis Vaught Feb 16 '12 at 16:55
  • Tnx for the replay. I'll give it a try, but currently i have only the need for numpy in virtualenv on a machine which doesn't have the necessary fortran compilers. – TheMeaningfulEngineer Feb 16 '12 at 18:09
  • Found a similar question, will give it a try. http://stackoverflow.com/questions/6976503/how-can-i-use-numpy-without-installing-it – TheMeaningfulEngineer Feb 17 '12 at 07:25