Re: [python-users] Trying sample GINI code: ImportError: No module named enum34

  • To: Arlene Laing <Arlene.Laing@xxxxxxxxxxxx>
  • Subject: Re: [python-users] Trying sample GINI code: ImportError: No module named enum34
  • From: Ryan May <rmay@xxxxxxxx>
  • Date: Thu, 21 Apr 2016 14:27:13 -0600
(moving back to list)

> I was able to install enum34 using "conda install enum64" and got pass
> that part of the sample code.  However, I used "pip" to install metpy
> because "conda install metpy" leads to the error below:
>
> -----------------------------------
>
> bash-4.1$ conda install metpy
> Using Anaconda Cloud api site https://api.anaconda.org
> Fetching package metadata: ....
> Solving package specifications: .
> Error:  Package missing in current linux-64 channels:
>   - metpy
> ----------------------------------
>

This error means that you need to add a channel (source of packages) that
knows about MetPy. The best channel for this is conda-forge. You can use
the channel just once:

    conda install -c conda-forge metpy

or add the channel as a source more permanently:

    conda config --add channels conda-forge
    conda install metpy

I keep getting "ImportError" for a number of items, including:
>
> from urllib.request import urlopen
>
> ---------------------------------------------------------------------------ImportError
>                                Traceback (most recent call 
> last)<ipython-input-3-0d1c7b276881> in <module>()----> 1 from urllib.request 
> import urlopen
> ImportError: No module named request
>
> ---------------------------------------------------------------------
>
> Just now, I was able to get the GINI Part 1 example working by cloning and
> activating the Unidata blog environment (with Python 3.4).  However, I
> would like to be able to create plots in an environment that works with
> Python 2.7 as well.
>
That error message is one of the incompatibilities between Python 2 and 3.
For Python 2, that import needs to change to:

    from urllib import urlopen

I just tried out the two blog notebooks in Python 2.7, and that was the
only line I needed to change.

Hopefully, that should get you what you need--if not, let me know.

Ryan

-- 
Ryan May, Ph.D.
Software Engineer
UCAR/Unidata
Boulder, CO
  • 2016 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the python-users archives: