[MMTK] ImportError: No module named Scientific_netcdf (Building Scientific Python on Windows)

Peter mmtk at maubp.freeserve.co.uk
Tue Jun 8 09:29:42 CEST 2004


hinsen at cnrs-orleans.fr wrote:
> On 06.06.2004, at 13:28, Peter wrote:
> 
>> It looks for an environment variable called NETCDF_PREFIX, and also
>> knows to try '/usr/local', '/usr' and '/sw' which are normal on
>> Unix/Linux/mac OS.  Perhaps this should include the standard locations
>> for Windows too?
> 
> 
> If someone tells me what they are, I will add them.
> 
> Konrad.

See also my email, 
http://starship.python.net/pipermail/mmtk/2004/000658.html

If the netCDF header files and are installed under the python directory, 
i.e.

C:\Python23\lib\netcdf.lib
C:\Python23\lib\netcdfs.lib
C:\Python23\include\netcdf.h
C:\Python23\include\netcdf.inc

Then you can use:
netcdf_prefix = sys.prefix

or:
netcdf_prefix = sys.exec_prefix

This should take care of the use of C:\Python, C:\Python22, C:\Python23 
or anything the user may have chosen instead.

I don't know what the difference is between sys.prefix and 
sys.exec_prefix, but they which both return C:\Python23 on my machine. 
This may be important on Unix?

i.e. I suggest something like this in setup.py:

for netcdf_prefix in ['/usr/local', '/usr', '/sw', sys.prefix, 
sys.exec_prefix]:

--------------------------------------------------------------------

Also, some people might try putting the files in MSVC's lib and include 
directories (which appear to have environment variables 'lib' and 
'include' respectively):

C:\Program Files\Microsoft Visual Studio\VC98\lib
C:\Program Files\Microsoft Visual Studio\VC98\include

[I have not tried this myself - it may work...]

We could look for these (if win32), but would it require rearranging the 
code to find and test the paths netcdf_lib and netcdf_include separately.

I don't know if MinGW has its own lib and include folders, and if they 
are available as environment variables.

----------------------------------------------------------------------

Peter



More information about the mmtk mailing list