Install Iris on Windows

344 views
Skip to first unread message

Qingxiang Liu

unread,
Jul 30, 2015, 2:23:16 AM7/30/15
to Iris

Dear All,

I am planning to use Iris on Windows (64). Following the Installation guide, I have tried 

conda install -c scitools iris

But after the installation, I got the error message below:

import iris
Traceback (most recent call last):
  File "<ipython-input-1-005053b25f37>", line 1, in <module>
    import iris
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\__init__.py", line 107, in <module>
    import iris.cube
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\cube.py", line 38, in <module>
    import iris.analysis
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\analysis\__init__.py", line 59, in <module>
    from iris.analysis._area_weighted import AreaWeightedRegridder
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\analysis\_area_weighted.py", line 22, in <module>
    from iris.analysis._interpolation import get_xy_dim_coords, snapshot_grid
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\analysis\_interpolation.py", line 30, in <module>
    from iris.analysis.cartography import wrap_lons as wrap_circular_points
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\analysis\cartography.py", line 34, in <module>
    import iris.coords
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\coords.py", line 36, in <module>
    import iris.aux_factory
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\aux_factory.py", line 30, in <module>
    from iris._cube_coord_common import CFVariableMixin
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\_cube_coord_common.py", line 25, in <module>
    import iris.unit
  File "C:\Users\qingxiangliu\AppData\Local\Continuum\Anaconda\lib\site-packages\iris\unit.py", line 350, in <module>
    _status_msg, _error_msg))
OSError: [UT_OPEN_ARG] Failed to open UDUNITS-2 XML unit database : "No such file or directory"


Could anyone tell me how to solve this problem?

Best regards,
Qingxiang 

Phil Elson

unread,
Sep 3, 2015, 6:48:37 AM9/3/15
to Qingxiang Liu, Iris
Hi Qingxiang,

I've not seen this one before. We do some things on the UDUNITS windows build (https://github.com/SciTools/conda-recipes-scitools/blob/master/udunits/bld.bat) which may not be sufficiently covering all of the bases.

For sanity sake, would you mind updating udunits with conda update -c scitools udunits  to see if we've fixed the problem recently. If this doesn't work, could you look for the $PREFIX\...\share\udunits\ xml files to check that they are installed correctly. If so, you can manually point UDUNITS at them with the UDUNITS2_XML_PATH environment variable. Some relevant discussion is available at https://github.com/SciTools/iris/issues/404 when we were originally porting UDUNITS to Windows.

HTH

--
You received this message because you are subscribed to the Google Groups "Iris" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scitools-iri...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

刘庆翔

unread,
Sep 3, 2015, 8:32:10 AM9/3/15
to Phil Elson, Iris
​Dear Phil,

I have traced the error to the ​path of my anaconda installation. In fact I have installed anaconda in my primary disk, i.e., C disk. When I created my python scripts in C disk, that error did not appear. While, when I created python scripts in other disks, that error was raised. So is there a way to solve this?

Best regards,
Qingxiang


-------------------------------------------------------------------------
College of Physical and Environmental Oceanography
Ocean University of China
Qingdao, China

Phil Elson

unread,
Sep 3, 2015, 4:04:45 PM9/3/15
to 刘庆翔, Phil Elson, Iris
I confess, I've never tried installing on a non C: disk. The original error message looked like it was on a C drive though?

Simon Tett

unread,
Sep 28, 2015, 5:42:57 PM9/28/15
to Iris, qxia...@gmail.com, pelso...@gmail.com
Hi,
 I'm having a similar problem. I've done a fresh install of iris and required libraries via conda on Windows 7 64 bit.  Looks like I'm running vn 1.8.0 of iris and 2.2.17 of udunits.

I'm running a pretty dumb script which just reads in some data and plots them but fails with an error on the import iris state.  See below for the traceback:

The issue appears that udunits2.xml can't be found. I have udunits2.xml in C:\Program Files\Anaconda\Library\share\udunits

How do I configure Iris or udunits (on windows) so that it can pick up udunits2.xmls

many thanks
Simon Tett


-----------------------------
In [1]: runfile('M:/analyse/iris_test/plot_ocn_model.py', wdir='M:/analyse/iris_test')

Traceback (most recent call last):

  File "<ipython-input-1-e6d40d773d74>", line 1, in <module>
    runfile('M:/analyse/iris_test/plot_ocn_model.py', wdir='M:/analyse/iris_test')

  File "C:\Program Files\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 685, in runfile
    execfile(filename, namespace)

  File "C:\Program Files\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 71, in execfile
    exec(compile(scripttext, filename, 'exec'), glob, loc)

  File "M:/analyse/iris_test/plot_ocn_model.py", line 6, in <module>
    import iris

  File "C:\Program Files\Anaconda\lib\site-packages\iris\__init__.py", line 107, in <module>
    import iris.cube

  File "C:\Program Files\Anaconda\lib\site-packages\iris\cube.py", line 38, in <module>
    import iris.analysis

  File "C:\Program Files\Anaconda\lib\site-packages\iris\analysis\__init__.py", line 59, in <module>
    from iris.analysis._area_weighted import AreaWeightedRegridder

  File "C:\Program Files\Anaconda\lib\site-packages\iris\analysis\_area_weighted.py", line 22, in <module>

    from iris.analysis._interpolation import get_xy_dim_coords, snapshot_grid

  File "C:\Program Files\Anaconda\lib\site-packages\iris\analysis\_interpolation.py", line 30, in <module>

    from iris.analysis.cartography import wrap_lons as wrap_circular_points

  File "C:\Program Files\Anaconda\lib\site-packages\iris\analysis\cartography.py", line 34, in <module>
    import iris.coords

  File "C:\Program Files\Anaconda\lib\site-packages\iris\coords.py", line 36, in <module>
    import iris.aux_factory

  File "C:\Program Files\Anaconda\lib\site-packages\iris\aux_factory.py", line 30, in <module>
    from iris._cube_coord_common import CFVariableMixin

  File "C:\Program Files\Anaconda\lib\site-packages\iris\_cube_coord_common.py", line 25, in <module>
    import iris.unit

  File "C:\Program Files\Anaconda\lib\site-packages\iris\unit.py", line 350, in <module>

    _status_msg, _error_msg))

OSError: [UT_OPEN_ARG] Failed to open UDUNITS-2 XML unit database : "No such file or directory"


In [2]:

刘庆翔

unread,
Oct 7, 2015, 9:28:00 PM10/7/15
to Iris, qxia...@gmail.com, pelso...@gmail.com
Hi Simon,

I have no idea how to solve it but just know how to avoid it. As I said, I installed my Anaconda packages in my primary disk, i.e., C disk. According to your error message, you also installed it in C disk. If you put your script plot_ocn_model.py and your data into C disk and then run it again, perhaps you won't see that error.

Good luck,
Qingxiang

Prof Simon Tett

unread,
Oct 8, 2015, 7:41:32 PM10/8/15
to 刘庆翔, Iris, pelso...@gmail.com
Dear Qingxiang,

I think there are a couple of problems around line 331 of iris\unit.py.

        _alt_xml_path = os.path.join(sys.prefix, 'share',
                                     'udunits', 'udunits2.xml')
## this should be (at least on my version of Anaconda)
##_alt_xml_path = os.path.join(sys.prefix, 'Library', 'share',
 ##                                    'udunits', 'udunits2.xml')
## but even when I fix this the following line returns None even though the file exists.
        _ud_system = _ut_read_xml(_alt_xml_path)

If I run from c: I get a different error:
WindowsError: [Error 5] Access is denied: 'C:\\Program Files\\Anaconda\\lib\\site-packages\\iris\\fileformats\\_pyke_rules\\compiled_krb\\fc_rules_cf_fc.py

(and I renamed Lib to lib). I don't think iris works on window...I did have a version of iris work though had to do some odd things to make it work... Iris team are you following this?

Simon

--
You received this message because you are subscribed to a topic in the Google Groups "Iris" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scitools-iris/3R_yYt55RkE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scitools-iri...@googlegroups.com.

刘庆翔

unread,
Oct 8, 2015, 7:52:09 PM10/8/15
to Iris, qxia...@gmail.com, pelso...@gmail.com
Dear Simon,

Yes, I also tried to modify these lines but it did not work. But one thing I am quite sure is that Iris does work on windows. If the iris package from scitool binstar is not OK for you, you can have a try to install the iris package from IOOS binstar  by:

conda config --add channels ioos -f
conda install iris

I used this package and it works fine for me when I run my scripts in C disk. Note that when you run your script, you current work directory should be also located in C disk.

Best regards,
Qingxiang

Prof Simon Tett

unread,
Oct 9, 2015, 4:15:33 AM10/9/15
to 刘庆翔, Iris, pelso...@gmail.com
I think to run iris you need to first load it as administrator... That caches various things -- this should really be done as part of the install.

Secondly to get udunits works you need to load the udunits2.xml file once when your working directory is c:. After that all works. I assume this is because udunits2.xml having been read in is then cached. 

Simon

Filipe Pires Alvarenga Fernandes

unread,
Oct 9, 2015, 6:34:58 AM10/9/15
to Prof Simon Tett, 刘庆翔, Iris, Phil Elson
Hi,

I had a Windows machine with last this past week and I was able to reproduce the problem.  Indeed the ENV variables on Windows seems to not known the drive letter!  I am not a Windows and do not know how to solve this.  I was not even able to start an IPython session at the drive letter "C:" as that is considered a hidden directory!!

I could not test loading it as administrator, but there is another workaround that works too.  First load iris and then switch the directory from inside python:

```python
import iris


-Filipe
Reply all
Reply to author
Forward
0 new messages