matplotlib runtime errors after installing Ubuntu 16.04

Hello,
            I have matplotlib installed via sudo apt-get install on Ubuntu
16.04 and when I run my old scripts(developed on Ubuntu 14.04) I get this
run time error . I do have basemap installed as well as pyproj using sudo
apt-get.

Traceback (most recent call last):File "contour.py", line 30, in <module>
x,y = m(lons,lats)File
"/usr/lib/python3/dist-packages/mpl_toolkits/basemap/__init__.py",
line 1148, in __call__
xout,yout = self.projtran(x,y,inverse=inverse)sys.exit()
File "/usr/lib/python3/dist-packages/mpl_toolkits/basemap/proj.py",
line 286, in __call__
  outx,outy = self._proj4(x, y, inverse=inverse)
  File "/usr/lib/python3/dist-packages/mpl_toolkits/basemap/pyproj.py",
line 392, in __call__
_proj.Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck)
File "_proj.pyx", line 122, in _proj.Proj._fwd (src/_proj.c:1571)
SystemError: <class 'RuntimeError'> returned a result with an error set

This is the code I am running

nc_f = './hgt_500_2014_12_5_00Z.nc'
nc_fid = Dataset(nc_f, 'r')
                         # and create an instance of the ncCDF4 class
lats = nc_fid.variables['lat'][:] # extract/copy the data

lons = nc_fid.variables['lon'][:]

time = nc_fid.variables['time'][:]
hgt = nc_fid.variables['hgt'][:]

m = Basemap(width=5000000,height=3500000,
resolution='l',projection='stere', lat_0 = 0, lon_0 = 0, lat_ts = 40)

lons,lats = np.meshgrid(lons, lats,copy=False)

  x,y = m(lons,lats) <----- CODE FAILS HERE

  m.drawcoastlines()
  m.drawcountries()

Any thoughts ?

Regards,

Ashwin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160817/0c9f1fb0/attachment.html>