Iris: No module found

Created on 6 May 2021  路  5Comments  路  Source: SciTools/iris

馃摪 Custom Issue


I'm sorry if this is the wrong place to post this but I couldn't find a more appropriate forum. I've been trying to get iris working today but had consistent issues with Conda and getting python to recognize packages installed using it. When I saw that you had a pip version under scitools-iris I figured this would be easier to use. However, when in python you cannot import scitools-iris as it leads to syntax errors, and python cannot find a module called scitoolsiris, scitools_iris, iris, or another other combination I could think of.

I also tried:
import importlib
iris = importlib.import_module("scitools-iris")
but got a "ModuleNotFoundError: No module named 'scitools-iris'" error.

The module should be installed as it shows up (v 3.0.1) when I call pip list in cmd. I'm just not sure how to import it.

Regards,
Daniel

Issue

Most helpful comment

Yes! Sorry, I was able to get Iris functioning via conda. Sorry for not commenting earlier!

All 5 comments

Hi @DanielMutton1, thanks for getting in touch, and sorry to hear about the issues you've been facing with installing Iris. I'll admit it's not clear to me what's going wrong for you, so maybe I'll start with stating what I'd expect to work and then maybe we can work from that to solving the specific issues you've run into.

I'd expect to be able to install Iris in one of the following ways:

_Conda_

conda create -n iris-env -c conda-forge iris
conda activate iris-env
python

Here we create a new conda env called iris-env, install Iris (and dependencies automatically) into that env, and activate the env.

_pip_

pip install scitools-iris
python

And then I'd expect to be able to import Iris in the Python session:

import iris

That should be all that's needed...

It is possible you're encountering a problem with the particular python executable that is being run when you call python to start a python prompt in your terminal. It might be worth checking how your system PATH is set up and confirming you don't have any system pythons (MacOS in particular can be bad for this) on your path that are taking higher precedence than, say, your conda python executable, or the python executable that pip is using, if you also have pip explicitly added to your PATH. When you installed conda, did you allow the installer to modify your PATH variable? And did you restart your terminal session after you installed conda? (Assuming that you're on a UNIX-like system and installed conda via the shell installer and not the Anaconda-supplied exe.)

Thanks for the response.

I think my mistake was that I was pip installing within the Anaconda Prompt so it looked like scitools-iris was being installed without issue when it wasn't. I tried to install it in CMD-proper and got errors when it was installing Cartopy; so I need to install proj4 and GEOS > v 3.3.3. I'll edit the post if I run into any issues with that.

@DanielMutton1 Are you happy for us to close this issue?

Yes! Sorry, I was able to get Iris functioning via conda. Sorry for not commenting earlier!

Great stuff! @DanielMutton1 glad all is sorted with this 馃檪

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jupalm picture jupalm  路  3Comments

trexfeathers picture trexfeathers  路  5Comments

schlunma picture schlunma  路  4Comments

cpelley picture cpelley  路  3Comments

SarahAlidoost picture SarahAlidoost  路  5Comments