Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Iris on Windows #467

Closed
rsignell-usgs opened this issue Apr 18, 2013 · 57 comments
Closed

Support Iris on Windows #467

rsignell-usgs opened this issue Apr 18, 2013 · 57 comments

Comments

@rsignell-usgs
Copy link

It would be great if Iris was supported on Windows. Most US Government Employees are on Windows computers -- at the USGS, this is partly because ArcGIS is a Windows application.

@dpsnowden
Copy link

+1, I have no access to linux unfortunately but I'm very interested in becoming an Iris user.

@pelson
Copy link
Member

pelson commented Apr 18, 2013

👍 - I know @munslowa had a look at this some time ago, but I have no idea how far he got. I have no expertise in this, but I can't imagine its too hard (if you know what you're doing with compiling on Windows, which I don't...).

@rsignell-usgs
Copy link
Author

@pelson, I'm sure you are right, but I think the problem is that there are only a few people who really know how to compile python binaries on Windows. Nearly everyone relies on @cgohlke binaries or scientific distributions for windows where lots of packages are already built (Enthought Python Distribution, Anaconda, Python(x,y)).

But wait. I just checked and @cgohlke has windows binaries for Cartopy, and Pyke is pure python, right? Christoph and the other distributions cover everything else except for Udunits. So perhaps that only leaves udunits as a prerequisite for Iris?

@rsignell-usgs
Copy link
Author

Which package requires UDUNITS?

@munslowa
Copy link
Contributor

You remember well @pelson. udunits is where I got stuck. In lib/iris/unit.py (line 180) it needs to load the shared library and then go on to load the xml unit database. Searching around I found http:https://cran.rakanu.com/web/packages/udunits2/index.html.

@rsignell-usgs
Copy link
Author

The above seems to be a R package.
Could this be a replacement: https://code.google.com/p/cfunits-python/ ?

@rsignell-usgs
Copy link
Author

Grrr... Just remembered the hard way that many (all?) of Gohlke's current Python Windows binaries will NOT work with the latest EPD, because Gohlke went to numpy 1.7 and EPD is still at numpy 1.6.1. So Gohlke's Cartopy windows binary, for example, doesn't work with the EPD.

@rhattersley
Copy link
Member

Could this be a replacement: https://code.google.com/p/cfunits-python/ ?

Sadly, this also requires the UDUNITS-2 library to be installed.

@esc24
Copy link
Member

esc24 commented May 5, 2013

screenhunter_03 may 05 20 56

It took a few hours as I got my head around Python on Windows and installed dependencies, but by sidestepping udunits in unit.py I now have basic loading and plotting functionality under windows.

@bblay
Copy link
Contributor

bblay commented May 13, 2013

Would anyone be interested in evaluating an "alpha quality" version of the ECMWF GRIB API for MSVC 2008? I cannot currently find time to do this. Ideally, we would check if the Iris grib tests pass or not. If so, I might be able to arrange access to the pre-release.

@rsignell-usgs
Copy link
Author

Sure, I'd be willing to test this out.
-Rich

On Mon, May 13, 2013 at 6:22 AM, bblay [email protected] wrote:

Would anyone be interested in evaluating an "alpha quality" version of the
ECMWF GRIB API for MSVC 2008? I cannot currently find time to do this.
Ideally, we would check if the Iris grib tests pass or not. If so, I *
might* be able to arrange access to the pre-release.


Reply to this email directly or view it on GitHubhttps://github.com//issues/467#issuecomment-17803563
.

Dr. Richard P. Signell (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598

@scw
Copy link

scw commented May 13, 2013

I'm also happy to help test.

@bblay
Copy link
Contributor

bblay commented May 14, 2013

Thanks Rich, contact details sent.

Thanks @scw, I attempted to contact you privately with the email address of a developer at ECMWF who will help you get the api. Please could you let me know if you got that email?

@scw
Copy link

scw commented May 14, 2013

@bblay Yes, I did get your message, thanks -- I'll let you know once I've heard back and have the API in-hand. cheers, Shaun

@bblay
Copy link
Contributor

bblay commented May 15, 2013

It's just been revealed, the Windows version does not include a python interface, and there is seemingly nothing on the horizon 😟.

@rhattersley
Copy link
Member

there is seemingly nothing on the horizon

No harm in everyone with an interest nudging the ECMWF to see if we can get it moved up (or even, onto) their agenda.

@bblay
Copy link
Contributor

bblay commented May 15, 2013

One potential way forward:

Well if you or your colleagues are kind enough to contribute any code or solution which enables python to be used on Windows, then we will gladly add that into our distribution [ There is a small matter of a Contributor Licence Agreement of course! ]
We already have agreements in place with organizations like The Max Planck Institute and DWD and they regularly contribute to our grib api package.
:)

We could finish writing this: https://github.com/bblay/gribby

@rsignell-usgs
Copy link
Author

@esc24 What did you do to "sidestep" udunits?
I'd like to try this on windows as well.

Thanks,
Rich

@esc24
Copy link
Member

esc24 commented Jul 12, 2013

I put a collection of ugly if windows-type statements in unit.py to prevent use of the non-existent udunits library under win32. I have it in a branch on a machine at home, so I'll do a little tidying and push it up to my origin next week.

@rsignell-usgs
Copy link
Author

Great. Also, @semmerson at Unidata is working on getting UDUNITS going on Windows. Hopefully we'll hear good news on that front soon!

@ghost
Copy link

ghost commented Jul 16, 2013

I'd like to add a note of support for the effort to get a Windows version of IRIS and Cartopy built. I have a user base that could benefit from the effort but who predominantly use Windows.

Thanks for your work and please let me know if there's any way I can help.

@esc24
Copy link
Member

esc24 commented Jul 16, 2013

There is a windows binary of cartopy v0.7 at http:https://www.lfd.uci.edu/%7Egohlke/pythonlibs/#cartopy. The blocker for Iris on windows is udunits (although grib support might also be a challenge). I'm very encouraged by the news that @semmerson is looking into udunits.

@rsignell-usgs
Copy link
Author

@semmerson is still working on the CMAKE build for UDUNITS, but there is a pull request on UDUNITS by @sdebionne that has a native Windows build for Visual Studio:
https://github.com/Unidata/UDUNITS-2/pulls

Does that sound like something that you guys could use to get UDUNITS going on Windows?
(I don't have Visual Studio)
Thanks,
Rich

P.S. Another option would be to use a different units package. Of the 18 units packages (aka physical quantities packages) for Python that Trevor Bekolay looked into during his SciPY 2013 talk (http:https://www.youtube.com/watch?v=N-edLdxiM40 ), only one of them appears to be pure python -- the "magnitude" package by @juanre at
https://github.com/juanre/magnitude

@esc24
Copy link
Member

esc24 commented Aug 16, 2013

That sounds very promising. I'll give it a go. I have a little bit of breathing room in my diary next week so I'll put this on the list. Sorry for letting this topic slip lately.

@rsignell-usgs
Copy link
Author

Excellent. Thanks for the update.

@ajdawson
Copy link
Member

@semmerson is still working on the CMAKE build for UDUNITS, but there is a pull request on UDUNITS by @sdebionne that has a native Windows build for Visual Studio:
https://github.com/Unidata/UDUNITS-2/pulls

Did anyone try this out? I couldn't get it to compile...

@sdebionne
Copy link

@ajdawson Andrew, I would be glad to help you. Can you tell me more about what goes wrong ?

@ajdawson
Copy link
Member

@ajdawson Andrew, I would be glad to help you. Can you tell me more about what goes wrong ?

I can but not until I'm at a windows machine, I'll investigate and get back to you. Thanks @sdebionne.

@ajdawson
Copy link
Member

@sdebionne - I loaded the solution into Visual Studio Express 2012 and tried to build the solution but I got 3 errors:

...
1>parser.y(28): fatal error C1083: Cannot open include file: 'strings.h': No such file or directory
...
5>LINK : fatal error LNK1104: cannot open file 'C:\Users\dawson\Projects\UDUNITS-2\win\build-vs11\Win32\Debug\lib.lib'
...
6>LINK : fatal error LNK1104: cannot open file 'C:\Users\dawson\Projects\UDUNITS-2\win\build-vs11\Win32\Debug\lib.lib'
========== Rebuild All: 3 succeeded, 3 failed, 0 skipped ==========

I've omitted the other details from the output. I also tried usingVisual Studio Professional 2012 but I got the same errors.

I haven't used Visual Studio for many years so I'm a beginner really, it may be something really simple but I'm afraid I'm stuck! Your help is much appreciated.

@sdebionne
Copy link

@ajdawson Andrew,

You should have something like this line 29 of parser.y :

#if !defined(_MSC_VER)
#   include <strings.h>
#else
#   define snprintf _snprintf 
#   define vsnprintf _vsnprintf 
#   define strcasecmp _stricmp 
#   define strncasecmp _strnicmp 
#endif

And that should prevent <strings.h> to be included. If you don't have it then it's probably my mistake with GitHub !

@sdebionne
Copy link

@ajdawson And in parser.c (generated from the bison file) I have :

#if !defined(_MSC_VER)
#   include <strings.h>
#else
#   define snprintf _snprintf 
#   define vsnprintf _vsnprintf 
#   define strcasecmp _stricmp 
#   define strncasecmp _strnicmp
#   define strdup _strdup
#endif

parser.c is not part of the repository (but part of the source tarball) as it is generated by bison. That would explain why you see these errors. Here is a patch to apply on parser.c :

--- udunits-2.1.24/lib/parser.c Tue Jan 25 02:16:44 2011
+++ UDUNITS-2/lib/parser.c  Fri Oct 25 11:54:31 2013
@@ -134,7 +134,16 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <strings.h>
+
+#if !defined(_MSC_VER)
+#  include <strings.h>
+#else
+#  define snprintf _snprintf 
+#  define vsnprintf _vsnprintf 
+#  define strcasecmp _stricmp 
+#  define strncasecmp _strnicmp
+#  define strdup _strdup
+#endif

 #include "udunits2.h"

@@ -380,7 +389,7 @@
 #  ifndef YYSTACK_ALLOC_MAXIMUM
 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
 #  endif
-#  if (defined __cplusplus && ! defined _STDLIB_H \
+#  if ((defined __cplusplus || defined _MSC_VER) && ! defined _STDLIB_H \
        && ! ((defined YYMALLOC || defined malloc) \
         && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */

@ajdawson
Copy link
Member

Thanks @sdebionne my source tree had become polluted from previous attempts. I did a fresh checkout of your branch, opened the solution file in Visual Studio, and selected build solution and I got the following errors:

...
1>c1 : fatal error C1083: Cannot open source file: '..\..\..\lib\parser.c': No such file or directory
...
5>LINK : fatal error LNK1104: cannot open file 'C:\Users\dawson\Projects\udunits-win\win\build-vs11\Win32\Debug\lib.lib'
6>LINK : fatal error LNK1104: cannot open file 'C:\Users\dawson\Projects\udunits-win\win\build-vs11\Win32\Debug\lib.lib'
========== Build: 3 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========

These are because I haven't generated parser.c right? Do I need to get Visual Studio to do that or do I copy it from somewhere? You mentioned the source tarball...

Sorry for so many questions!

@ajdawson
Copy link
Member

OK so I copied parser.c form udunits source tarball and applied the patch you gave me and that seems to work. Is that what I am meant to do?

I'm now having problems related to scanner.l/scanner.c. First it said couldn't find scanner.c, so I copied it over from the source tarball(?) and then I get an error in scanner.l saying identifier "M_E" is undefined.

@esc24
Copy link
Member

esc24 commented Oct 28, 2013

@sdebionne - I ran into exactly the same parser.c issue as @ajdawson, but rather than copying I tried to generate it using bison (I can't remember the error - this was a month or two back) and failed. I expect your patch will solve that. Any ideas for the scanner.c issue? Any help would be much appreciated, as it would be great to get udunits building under windows.

@sdebionne
Copy link

OK so I copied parser.c form udunits source tarball and applied the patch you gave me and that seems to work. Is that what I am meant to do?

@ajdawson Yes, exactly. I agree that it's not really practical though.

@esc24 Well I'm not very acquainted with bison so what I did, which is of course not recommanded, is edit the generated files. That explain why I gave a patch for parser.c rather than parser.y... I think I should either do the same for the scanner or finally dig into the bison/lex files. Short time solution :

--- udunits-2.1.24/lib/scanner.c    Fri Mar 06 22:28:49 2009
+++ UDUNITS-2/lib/scanner.c Mon Jun 17 09:13:57 2013
@@ -423,7 +423,7 @@
 /* %% [1.0] uttext/utin/utout/yy_state_type/utlineno etc. def's & init go here */
 /* Begin user sect3 */

-#define utwrap(n) 1
+#define utwrap() 1
 #define YY_SKIP_YYWRAP

 #define FLEX_DEBUG
@@ -1072,12 +1072,18 @@
 #include <ctype.h>
 #include <errno.h>
 #include <math.h>
+#if defined(_MSC_VER)
+#  include <win/math.h>
+#endif
 #include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>

+#if defined(_MSC_VER)
+#define fileno _fileno
+#endif

 #line 1083 "<stdout>"

@ajdawson
Copy link
Member

Looks like the latest release of udunits2 supports windows: http:https://www.unidata.ucar.edu/software/udunits/udunits-2.2.4/doc/udunits/udunits2.html#Windows. I don't know how useful that will be, I don't have time to test it myself.

@semmerson
Copy link

Andrew,

I'm working on it. Currently, it only supports building from source using
CMake and MinGW. I intend to support binary installations and CYGWIN, but
need some necessary infrastructure first.

Regards,
Steven Emmerson
Software Developer
Unidata Program Center
University Corporation for Atmospheric Research

On Sat, Jan 18, 2014 at 9:08 AM, Andrew Dawson [email protected]:

Looks like the latest release of udunits2 supports windows:
http:https://www.unidata.ucar.edu/software/udunits/udunits-2.2.4/doc/udunits/udunits2.html#Windows.
I don't know how useful that will be, I don't have time to test it myself.


Reply to this email directly or view it on GitHubhttps://github.com//issues/467#issuecomment-32685302
.

@rsignell-usgs
Copy link
Author

Steve,
How it's going? Any blockers?
-Rich

@semmerson
Copy link

Hi Rich,

Work on a binary Windows release is currently suspended as I'm waiting for
some necessary infrastructure (my continuous-delivery pipeline needs some
virtual machines for creating binary releases and they haven't yet been
created on our hypervisor system).

I also have to work on a 2-year, 2M$ NSF grant on which I'm a PI (it deals
with adding virtual-circuit multicasting capability to the LDM).

All that aside, you should be able to build the UDUNITS version on the
"master" branch on GitHub using CMake and MinGW.

--Steve

On Thu, Feb 13, 2014 at 9:53 AM, Rich Signell [email protected]:

Steve,
How it's going? Any blockers?
-Rich

Reply to this email directly or view it on GitHubhttps://github.com//issues/467#issuecomment-34999111
.

@sdebionne
Copy link

@ajdawson Andrew, I guess you could not managed to use my PR... Could you tell me where you get stucked ? I may have time int the next weeks to improve this. I probably need to rebase my PR first if you are using the master branch...

@semmerson While I'm not a fan of CMake, official Windows support (through MinGW) is an excellent news !

@semmerson
Copy link

Sdebionne,

I decided to use CMake because that's what the netCDF developers use -- and the UDUNITS package is heavily used by netCDF folks.

The reason I didn't get around to your pull request has nothing to do with the quality of your work -- I was simply too constrained by time and the decision to use CMake.

@rsignell-usgs
Copy link
Author

@semmerson, any status update here on building native windows version of udunits?

@semmerson
Copy link

Rich,

There's been no progress since my last comment because I've been working on
the virtual-circuit LDM project.

We also need to create some persistent Windows virtual machines in order to
establish a Windows package repository.

It should still be possible, however, to build the HEAD commit of the
"master" branch on a windows system by using CMake and MinGW.

--Steve

@rsignell-usgs
Copy link
Author

@semmerson , can you provide a scope estimate for completing this project (e.g. is this a several hour, several day, or several week job?)

@semmerson
Copy link

Rich,

All told, establishing a Windows package repository on persistent virtual
machines and enhancing the UDUNITS build process to also support Cigwin and
Visual Studio is probably a several week endeavor.

--Steve

Regards,
Steven Emmerson
Software Developer
Unidata Program Center
University Corporation for Atmospheric Research

On Wed, May 21, 2014 at 10:04 AM, Rich Signell [email protected]:

@semmerson https://github.com/semmerson , can you provide a scope
estimate for completing this project (e.g. is this a several hour, several
day, or several week job?)


Reply to this email directly or view it on GitHubhttps://github.com//issues/467#issuecomment-43776984
.

@rsignell-usgs
Copy link
Author

thanks!

@rsignell-usgs
Copy link
Author

UDUNITS now builds on Windows using CMAKE, thanks to @WardF and @semmerson: Unidata/UDUNITS-2#17

@cgohlke
Copy link

cgohlke commented Aug 18, 2014

I put experimental Windows binaries at http:https://www.lfd.uci.edu/~gohlke/pythonlibs/#iris using the following changes (libc does not exist on Windows; use os.path.sep instead of /; load udunits2.dll from sys.prefix\share\udunits):

diff --git a/lib/iris/unit.py b/lib/iris/unit.py
index 0a022c6..40dc111 100644
--- a/lib/iris/unit.py
+++ b/lib/iris/unit.py
@@ -169,11 +169,25 @@ _ut_set_error_message_handler = None
 ########################################################################

 #
+# load the shared libraries on Windows
+#
+if sys.platform.startswith('win32'):
+    try:
+        _lib_c = ctypes.cdll.msvcr90
+    except Exception:
+        _lib_c = ctypes.cdll.msvcr100
+    _lib_ud = iris.config.get_option(
+        'System', 'udunits2_path',
+        default=os.path.join(sys.prefix, 'share', 'udunits', 'udunits2.dll'))
+    _lib_ud = ctypes.CDLL(_lib_ud, use_errno=True)
+
+#
 # load the libc shared library
 #
 if _lib_c is None:
     _lib_c = ctypes.CDLL(ctypes.util.find_library('libc'))

+if _lib_c:
     #
     # cache common shared library functions
     #
@@ -189,6 +203,7 @@ if _lib_ud is None:
         default=ctypes.util.find_library('udunits2'))
     _lib_ud = ctypes.CDLL(_lib_ud, use_errno=True)

+if _lib_ud:
     #
     # cache common shared library functions
     #
diff --git a/setup.py b/setup.py
index 93d0ab3..eddae8b 100644
--- a/setup.py
+++ b/setup.py
@@ -27,7 +27,7 @@ def find_package_tree(root_path, root_package):
             if dir_name in exclude_dirs or not contains_init_file:
                 dir_names.remove(dir_name)
         if dir_names:
-            prefix = dir_path.split('/')[root_count:]
+            prefix = dir_path.split(os.path.sep)[root_count:]
             packages.extend(['.'.join([root_package] + prefix + [dir_name])
                                 for dir_name in dir_names])
     return packages
@@ -258,7 +258,7 @@ setup(
                 ['fileformats/_pyke_rules/*.k?b'] + \
                 ['tests/stock*.npz']
         },
-    data_files=[('iris', ['CHANGES', 'COPYING', 'COPYING.LESSER'])],
+    data_files=[('Lib\site-packages\iris', ['CHANGES', 'COPYING', 'COPYING.LESSER'])],
     tests_require=['nose'],
     features={
         'unpack': setuptools.Feature(

Anyway, most/all examples fail with iris.exceptions.TranslationError: The file appears empty or incomplete, e.g.:

Traceback (most recent call last):
  File "projections_and_annotations.py", line 115, in <module>
    main()
  File "projections_and_annotations.py", line 110, in main
    make_plot('Equidistant Cylindrical', ccrs.PlateCarree())
  File "projections_and_annotations.py", line 48, in make_plot
    main_data = iris.load_cube(maindata_filepath)
  File "X:\Python27-x64\lib\site-packages\iris\__init__.py", line 309, in load_cube
    cubes = _load_collection(uris, constraints, callback).merged().cubes()
  File "X:\Python27-x64\lib\site-packages\iris\__init__.py", line 252, in _load_collection
    "The file appears empty or incomplete: {!r}".format(e.message))
iris.exceptions.TranslationError: The file appears empty or incomplete: 'X:\\Python27-x64\\lib\\site-packages\\iris\\sample_data\\rotated_pole.nc'

@cgohlke
Copy link

cgohlke commented Aug 19, 2014

Fix for the iris.exceptions.TranslationError:

diff --git a/lib/iris/io/__init__.py b/lib/iris/io/__init__.py
index e4b08b6..5b3ada9 100644
--- a/lib/iris/io/__init__.py
+++ b/lib/iris/io/__init__.py
@@ -182,7 +182,7 @@ def load_files(filenames, callback, constraints=None):
     # Create default dict mapping iris format handler to its associated filenames
     handler_map = collections.defaultdict(list)
     for fn in all_file_paths:
-        with open(fn) as fh:
+        with open(fn, 'rb') as fh:
             handling_format_spec = iris.fileformats.FORMAT_AGENT.get_spec(os.path.basename(fn), fh)
             handler_map[handling_format_spec].append(fn)

@rsignell-usgs
Copy link
Author

@cgohlke, this is exciting!

I tried to see if I could get this going with Anaconda on Win32, so I created a new "iris" environment for python 2.7, numpy 1.8 with netcdf4 installed, and then tried installing your iris windows package by extracting the contents of .\PLATLIB into my
c:\programs\anaconda\env\iris\lib\site-packages
folder.

I discovered that I need to install shapely, which I installed from your site in a same fashion, and then I built conda packages for pyshp and biggus,and installed them.

When I import iris, I get:

[test2] c:\RPS>python
Python 2.7.8 |Continuum Analytics, Inc.| (default, Jul  2 2014, 15:13:35) [MSC v
.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http:https://continuum.io/thanks and https://binstar.org
>>> import iris
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\__init__.py", lin
e 104, in <module>
    import iris.cube
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\cube.py", line 36
, in <module>
    import iris.analysis
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\analysis\__init__
.py", line 57, in <module>
    from iris.analysis._interpolator import (_LINEAR_EXTRAPOLATION_MODES,
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\analysis\_interpo
lator.py", line 25, in <module>
    from iris.analysis.cartography import wrap_lons as wrap_circular_points
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\analysis\cartogra
phy.py", line 32, in <module>
    import iris.coords
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\coords.py", line
34, in <module>
    import iris.aux_factory
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\aux_factory.py",
line 28, in <module>
    from iris._cube_coord_common import CFVariableMixin
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\_cube_coord_commo
n.py", line 24, in <module>
    import iris.unit
  File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\unit.py", line 18
2, in <module>
    _lib_ud = ctypes.CDLL(_lib_ud, use_errno=True)
  File "c:\programs\Anaconda\envs\test2\lib\ctypes\__init__.py", line 365, in __
init__
    self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

I'm not sure what this error means.

I'm also not sure what I was supposed to do about udunits2. I tried setting a user environment variable UDUNITS2_PATH=c:\programs\anaconda\share\udunits\udunits2.dll but that didn't seem to help.

@ghost
Copy link

ghost commented Aug 19, 2014

You guys absolutely rock!

I installed the binaries on my windows machine with a minimum of fuss and
I'm off to the races.

A few minor things I ran into in installing it. I needed biggus and pyke
which I had to find and manually install. It might be nice to include a
list of requirements under iris on Dr Gohlke's site like he does for other
packages. Also if biggus and pyke could be added to his indispensible list
of available packages that would be convenient as well. The second thing I
ran into is that I couldn't run some of the examples because I didn't have
the sample_data folder. I had to pull it from github separately.

Thanks for making my day.

Colin

[image: Inline image 2]

Colin Talbert
GIS Analyst and Developer
US Geological Survey

[email protected]

USGS Fort Collins Science Center
2150 Centre Ave. Bldg. C
Fort Collins, CO 80526
(970) 226-9425

USGS North Central Climate Science Center
(970) 492-4283

Work schedule:
Monday - 7:00 - 3:00 (NC CSC)
Tuesday - 7:00 - 3:00 (NC CSC)
Wednesday - 7:00 - 3:00 (FORT)
Thursday - 7:00 - 5:00 (NC CSC)
Friday - 7:00 - 5:00 (FORT)

On Tue, Aug 19, 2014 at 7:20 AM, Rich Signell [email protected]
wrote:

@cgohlke https://github.com/cgohlke, this is exciting!

I tried to see if I could get this going with Anaconda, so I created a new
"iris" environment for python 2.7, numpy 1.8 with netcdf4 installed, and
then tried installing your iris windows package by extracting the contents
of .\PLATLIB into my
c:\programs\anaconda\env\iris\lib\site-packages
folder.

I discovered that I need to install shapely, which I installed from your
site in a same fashion, and then I built conda packages for pyshp and
biggus,and installed them.

When I import iris, I get:

[test2] c:\RPS>python
Python 2.7.8 |Continuum Analytics, Inc.| (default, Jul 2 2014, 15:13:35) [MSC v
.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http:https://continuum.io/thanks and https://binstar.org

import iris
Traceback (most recent call last):
File "", line 1, in
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris__init__.py", lin
e 104, in
import iris.cube
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\cube.py", line 36
, in
import iris.analysis
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\analysis__init__
.py", line 57, in
from iris.analysis._interpolator import (LINEAR_EXTRAPOLATION_MODES,
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\analysis_interpo
lator.py", line 25, in
from iris.analysis.cartography import wrap_lons as wrap_circular_points
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\analysis\cartogra
phy.py", line 32, in
import iris.coords
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\coords.py", line
34, in
import iris.aux_factory
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\aux_factory.py",
line 28, in
from iris.cube_coord_common import CFVariableMixin
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris_cube_coord_commo
n.py", line 24, in
import iris.unit
File "c:\programs\Anaconda\envs\test2\lib\site-packages\iris\unit.py", line 18
2, in
lib_ud = ctypes.CDLL(lib_ud, use_errno=True)
File "c:\programs\Anaconda\envs\test2\lib\ctypes__init
.py", line 365, in __
init

self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

I'm not sure what this error means.

I'm also not sure what I was supposed to do about udunits2. I tried
setting a user environment variable
UDUNITS2_PATH='c:\programs\anaconda\share\udunits\udunits2.dll` but that
didn't seem to help.


Reply to this email directly or view it on GitHub
#467 (comment).

@cgohlke
Copy link

cgohlke commented Aug 19, 2014

I put udunits2.dll in sys.prefix\share\udunits\ because that's where Iris expects the udunits2.xml file. Maybe in the Anaconda environment sys.prefix is c:\programs\Anaconda\envs\test2\ and not c:\programs\Anaconda\...

@rsignell-usgs
Copy link
Author

@cgohlke , does it look like my problem above is indeed a udunits problem, or some issue with ctypes?

@rsignell-usgs
Copy link
Author

Okay, I figured how to get it going with Anaconda. The sys.prefix was the head of my custom environment, which was c:\programs\anaconda\envs\iris, so putting the udunits2.dll and udunits2.xml in c:\programs\anaconda\envs\iris\share\udunits solved the problem!
Here's the proof:
8-19-2014 5-56-42 pm

Thanks @cgohlke !!!

@rsignell-usgs
Copy link
Author

Thanks also to @WardF and @semmerson at Unidata for getting the udunits2 package to build on native Windows that made this all possible!

@WardF
Copy link

WardF commented Aug 19, 2014

Glad this is proving useful, and it's interesting to see what it has taken to get this working on Windows with other projects/tools. It's good information that may need to make it in to the cmake/windows documentation, when it appears :).

@rhattersley
Copy link
Member

I've been away for a while so only just seen this fantastic news! 😀 Thank you everyone!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests