error installing basemap

Following instructions here:

http://matplotlib.org/basemap/users/installing.html

Got this error and termination after issuing python setup.py install from the basemap directory.

src/_proj.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Command “gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Isrc -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c src/_proj.c -o build/temp.linux-i686-2.7/src/_proj.o” failed with exit status 1

I’m running a new installation of Ubuntu 12.04. I installed Python and Matplotlib through package manager. Several examples tested fine. I see no Python.h file on my system. Thanks in advance for suggestions.

MR

You need to also install the python development package (python-dev), which contains the headers.

Mike

···

On 09/13/2012 02:06 PM, Michael Rawlins wrote:

Following instructions here:

Installing — Basemap Matplotlib Toolkit 1.2.1 documentation

Got this error and termination after issuing python setup.py install from the basemap directory.

src/_proj.c:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Isrc -I/usr/lib/python2.7/dist-packages/numpy/core/include -I/usr/include/python2.7 -c src/_proj.c -o build/temp.linux-i686-2.7/src/_proj.o" failed with exit status 1

I'm running a new installation of Ubuntu 12.04. I installed Python and Matplotlib through package manager. Several examples tested fine. I see no Python.h file on my system. Thanks in advance for suggestions.

MR

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

···

From: Michael Droettboom <mdroe@…86…>
To: matplotlib-users@…1543…rge.net
Sent: Thursday, September 13, 2012 2:09 PM
Subject: Re: [Matplotlib-users] error installing basemap

  You need to also install the python

development package (python-dev), which contains the headers.

  Mike

OK basemap installed. Thanks. But I’m getting an error running a script that worked with previous installation(s) of python, matplotlib, and basemap. The error:

user@…4200…:~>python map2_TempDiff_4panels.py
Traceback (most recent call last):
File “map2_TempDiff_4panels.py”, line 27, in
from mpl_toolkits.basemap import NetCDFFile
ImportError: cannot import name NetCDFFile

I installed python-mpltoolkits.basemap from package manager, before testing my script.

MR

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@...813...ourceforge.net
[https://lists.sourceforge.net/lists/listinfo/matplotlib-users](https://lists.sourceforge.net/lists/listinfo/matplotlib-users)

Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Matplotlib-users mailing list
Matplotlib-users@…1738…net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

···

From: Michael Droettboom <mdroe@…86…>
To: matplotlib-users@lists.sourceforge.net
Sent: Thursday, September 13, 2012 2:09 PM
Subject: Re: [Matplotlib-users] error installing basemap

  You need to also install the python

development package (python-dev), which contains the headers.

  Mike

From: Michael Rawlins <rawlins02@…9…>
To:
Michael Droettboom <mdroe@…86…>; "matplotlib-users@lists.sourceforge.net" matplotlib-users@lists.sourceforge.net
Sent: Thursday, September 13, 2012 3:11 PM
Subject: Re: [Matplotlib-users] error installing basemap

  ailing list

Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

OK basemap installed. Thanks. But I’m getting an error running a script that worked with previous installation(s) of python, matplotlib, and basemap. The error:

user@…4200…:~>python map2_TempDiff_4panels.py
Traceback (most recent call last):
File “map2_TempDiff_4panels.py”, line 27, in
from mpl_toolkits.basemap import NetCDFFile
ImportError: cannot import name NetCDFFile

I installed python-mpltoolkits.basemap from package manager, before testing my script.

MR

An update: My test script, which works with previously, now gets past the header initializations. Here they
are:

import sys,getopt
from mpl_toolkits.basemap import Basemap, shiftgrid, cm
#from mpl_toolkits.basemap import NetCDFFile
from Scientific.IO.NetCDF import NetCDFFile
from pylab import *
import matplotlib.pyplot as plt

Notr clear why the first import NetCDFFile statement does not work. Farther down the script, the code stops on this statement:

data.missing_value=-9.99

There error to standard output:

Traceback (most recent call last):
File “map2_TempDiff_4panels.py”, line 266, in
data.missing_value=-9.99
IOError: netcdf: write access to read-only file


Live Security Virtual Conference
Exclusive live event will cover all the ways today’s security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Michael: The NetCDFFile function was deprecated a few releases
back, and recently removed. If you have netcdf4-python installed
you can do
from netCDF4 import Dataset as NetCDFFile
and the script should work as before.
Regarding the second error, you must open the file for write access
(mode=‘w’) if you want to add attributes to the data variables.
-Jeff

···

On 9/13/12 2:34 PM, Michael Rawlins
wrote:


From: Michael
Droettboom Thursday, September
13, 2012 2:09 PM
Re:
[Matplotlib-users] error installing basemap

                        You need to also install the python

development package (python-dev), which
contains the headers.

                        Mike

From: Michael
Rawlins Michael Droettboom
;
Thursday,
September 13, 2012 3:11 PM
Re:
[Matplotlib-users] error installing basemap
ailing list
OK basemap installed. Thanks. But I’m
getting an error running a script that
worked with previous installation(s) of
python, matplotlib, and basemap. The error:
user@…4200…:~>python Traceback (most recent call last):
File “map2_TempDiff_4panels.py”, line 27,
in
from mpl_toolkits.basemap import
NetCDFFile
ImportError: cannot import name NetCDFFile
I installed python-mpltoolkits.basemap from
package manager, before testing my script.
MR
An update: My test script, which works with
previously, now gets past the header
initializations. Here they are:
import sys,getopt
from mpl_toolkits.basemap import Basemap,
shiftgrid, cm #from mpl_toolkits.basemap import
NetCDFFile
from Scientific.IO.NetCDF import NetCDFFile
from pylab import *
import matplotlib.pyplot as plt
Notr clear why the first import NetCDFFile
statement does not work. Farther down the
script, the code stops on this statement:
data.missing_value=-9.99
There error to standard output:
Traceback (most recent call last):
File “map2_TempDiff_4panels.py”, line 266,
in
data.missing_value=-9.99
IOError: netcdf: write access to read-only
file

<mdroe@…86…>
**To:**matplotlib-users@lists.sourceforge.net
Sent:
Subject:
<rawlins02@…9…>
To:<mdroe@…86…>"matplotlib-users@lists.sourceforge.net"matplotlib-users@lists.sourceforge.net
Sent:
Subject:
Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users

map2_TempDiff_4panels.py

···

From: Jeff Whitaker <jswhit@…146…>
To: matplotlib-users@…1738…net
Cc: rawlins02@…83…9…
Sent: Thursday, September 13, 2012 9:44 PM
Subject: Re: [Matplotlib-users] error installing basemap

  On 9/13/12 2:34 PM, Michael Rawlins wrote:

From: Michael
Droettboom <mdroe@…86…>
To:
matplotlib-users@lists.sourceforge.net
Sent: Thursday, September
13, 2012 2:09 PM
Subject: Re:
[Matplotlib-users] error installing basemap

                        You need to also install the python

development package (python-dev), which
contains the headers.

                        Mike

From: Michael
Rawlins <rawlins02@…9…>
To: Michael Droettboom
<mdroe@…86…> ;
matplotlib-users@lists.sourceforge.net
matplotlib-users@lists.sourceforge.net

                        **Sent:** Thursday,

September 13, 2012 3:11 PM
Subject: Re:
[Matplotlib-users] error installing basemap

                        ailing list

Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

                        OK basemap installed.  Thanks. But I'm

getting an error running a script that
worked with previous installation(s) of
python, matplotlib, and basemap. The error:

                        user@...4200...:~>python [map2_TempDiff_4panels.py](http://map2_tempdiff_4panels.py/)

                        Traceback (most recent call last):

                          File "map2_TempDiff_4panels.py", line 27,

in

                            from mpl_toolkits.basemap import 

NetCDFFile

                        ImportError: cannot import name NetCDFFile





                        I installed python-mpltoolkits.basemap from

package manager, before testing my script.

                        MR





                        An update:  My test script, which works with

previously, now gets past the header
initializations. Here they are:

                        import sys,getopt

                        from mpl_toolkits.basemap import Basemap,

shiftgrid, cm

                        #from mpl_toolkits.basemap import 

NetCDFFile

                        from [Scientific.IO](http://scientific.io.net/).NetCDF import NetCDFFile

                        from pylab import *

                        import  matplotlib.pyplot as plt





                        Notr clear why the first import NetCDFFile

statement does not work. Farther down the
script, the code stops on this statement:

                        data.missing_value=-9.99



                        There error to standard output:



                        Traceback (most recent call last):

                          File "map2_TempDiff_4panels.py", line 266,

in

                            data.missing_value=-9.99

                        IOError: netcdf: write access to read-only

file

Michael:  The NetCDFFile function was deprecated a few releases

back, and recently removed. If you have netcdf4-python installed
you can do

from netCDF4 import Dataset as NetCDFFile

and the script should work as before.

Regarding the second error, you must open the file for write access

(mode=‘w’) if you want to add attributes to the data variables.

-Jeff

Jeff,

No I don’t have netCDF4 installed. It’s not in the package manager. Wasn’t sure if there would be a conflict with python-netcdf that’s installed. Guess that’s the reverse interface. Now I’m having some trouble compiling netcdf4-python from sources following:

http://code.google.com/p/netcdf4-python/wiki/UbuntuInstall

The configure ended in error:

checking whether the C compiler works… no
configure: error: in `/home/rawlins/Downloads/netcdf-4.2.1.1’:
configure: error: C compiler cannot create executables

Mike

···

From: Jeff Whitaker <jswhit@…146…>
To: matplotlib-users@lists.sourceforge.net
Cc: rawlins02@…9…
Sent: Thursday, September 13, 2012 9:44 PM
Subject: Re: [Matplotlib-users] error installing basemap

Michael:  The NetCDFFile function was deprecated a few releases

back, and recently removed. If you have netcdf4-python installed
you can do

from netCDF4 import Dataset as NetCDFFile

and the script should work as before.

Regarding the second error, you must open the file for write access

(mode=‘w’) if you want to add attributes to the data variables.

-Jeff

From: Michael Rawlins <rawlins02@…9…>
To:
Jeff Whitaker <jswhit@…146…>; "matplotlib-users@lists.sourceforge.net" matplotlib-users@lists.sourceforge.net
Sent: Thursday, September 13, 2012 10:28 PM
Subject: Re: [Matplotlib-users] error installing basemap

Making some progress. Following here:

http://code.google.com/p/netcdf4-python/wiki/UbuntuInstall

I’ve installed HDF5 after installing build-essential package. With just gcc installed I got an error.

The ./configure in netcdf4 directory failed, but completed with --disable-netcdf-4. I went ahead anyway hoping I don’t need netCDF-4 formats or the additional netCDF-4 functions. Besides that issue, what’s also not clear is where is setup.py file for the last step. It is not in the netcdf directory after the make install finished. I assume netcdf-python package will not conflict with the python-netcdf and netcdf versions installed through
package manager.

Mike


Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

···

From: Jeff Whitaker <jswhit@…146…>
To: matplotlib-users@lists.sourceforge.net
Cc: rawlins02@…9…
Sent: Thursday, September 13, 2012 9:44 PM
Subject: Re: [Matplotlib-users] error installing basemap

Michael:  The NetCDFFile function was deprecated a few releases

back, and recently removed. If you have netcdf4-python installed
you can do

from netCDF4 import Dataset as NetCDFFile

and the script should work as before.

Regarding the second error, you must open the file for write access

(mode=‘w’) if you want to add attributes to the data variables.

-Jeff

From: Michael Rawlins <rawlins02@…9…>
To:
Jeff Whitaker <jswhit@…146…>; "matplotlib-users@lists.sourceforge.net" matplotlib-users@lists.sourceforge.net
Sent: Thursday, September 13, 2012 10:28 PM
Subject: Re: [Matplotlib-users] error installing basemap

Making some progress. Following here:

http://code.google.com/p/netcdf4-python/wiki/UbuntuInstall

I’ve installed HDF5 after installing build-essential package. With just gcc installed I got an error.

The ./configure in netcdf4 directory failed, but completed with --disable-netcdf-4. I went ahead anyway hoping I don’t need netCDF-4 formats or the additional netCDF-4 functions. Besides that issue, what’s also not clear is where is setup.py file for the last step. It is not in the netcdf directory after the make install finished. I assume netcdf-python package will not conflict with the
python-netcdf and netcdf versions installed through
package manager.

Mike


From: Michael Rawlins <rawlins02@…83…9…>
To: "matplotlib-users@lists.sourceforge.net" matplotlib-users@lists.sourceforge.net
Sent: Friday, September 14, 2012 1:34 AM
Subject: Re: [Matplotlib-users] error installing basemap

Got sidetracked with an OS issue. Back on the case. Where is the setup.py file I’m to install? I’ve installed both HDF5 and netcdf-4, correctly I hope.

Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users