tsherwen / AC_tools

Module for working with global/regional Chemical Transport Model (CTM) output and observations
MIT License
13 stars 10 forks source link

fall to import modules after installation #85

Closed jinlx closed 5 years ago

jinlx commented 5 years ago

Hi,

I install AC_tools by python setup.py install.

However, I get this imformation when I try to import AC_tools

ephem package not installed
failed to import geopandas
failed to import rasterio
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/glade/u/home/lixujin/AC_tools/AC_tools/__init__.py", line 12, in <module>
    from . mask import *
  File "/glade/u/home/lixujin/AC_tools/AC_tools/mask.py", line 33, in <module>
    from affine import Affine
ModuleNotFoundError: No module named 'affine'

So I install affine, ephem, geopandas and raterio in the environment, expecting this bug could be fixed. But I still get error information below. I wonder if you have any suggestions on this kind of installation error.

>>> import AC_tools
failed to import geopandas
failed to import rasterio

My packages in the environment are listed below. Hope it helps.

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
ac-tools                  0.0.1                    pypi_0    pypi
affine                    2.3.0                      py_0    anaconda
antlr-python-runtime      4.7.2                 py37_1000    conda-forge
asn1crypto                0.24.0                py37_1003    conda-forge
atomicwrites              1.3.0                    pypi_0    pypi
attrs                     19.2.0                   pypi_0    pypi
basemap                   1.2.0            py37h673bf1a_2    conda-forge
basemap-data-hires        1.2.0                         0  
bokeh                     1.3.4                    py37_0    conda-forge
boost-cpp                 1.70.0               ha2d47e9_1    conda-forge
boto3                     1.9.241                    py_0    conda-forge
botocore                  1.12.241                   py_0    conda-forge
bzip2                     1.0.8                h516909a_1    conda-forge
ca-certificates           2019.9.11            hecc5488_0    conda-forge
cairo                     1.14.12              h8948797_3  
cartopy                   0.17.0          py37h0aa2c8f_1004    conda-forge
certifi                   2019.9.11                py37_0    conda-forge
cf-units                  2.1.3            py37hc1659b7_0    conda-forge
cffi                      1.12.3           py37h8022711_0    conda-forge
cftime                    1.0.3.4         py37hd352d35_1001    conda-forge
chardet                   3.0.4                 py37_1003    conda-forge
click                     7.0                        py_0    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.5.0                      py_0    conda-forge
cloudpickle               1.2.2                      py_0    conda-forge
cryptography              2.7              py37h72c5cf5_0    conda-forge
curl                      7.65.3               hf8cf82a_0    conda-forge
cycler                    0.10.0                     py_1    conda-forge
cytoolz                   0.10.0           py37h516909a_0    conda-forge
dask                      2.5.0                      py_0    conda-forge
dask-core                 2.5.0                      py_0    conda-forge
dbus                      1.13.2               h714fa37_1  
distributed               2.5.1                      py_0    conda-forge
docutils                  0.15.2                   py37_0    conda-forge
ephem                     3.7.7.0          py37h7b6447c_0    anaconda
expat                     2.2.6                he6710b0_0  
fiona                     1.8.4           py37heb36068_1001    conda-forge
fontconfig                2.13.0               h9420a91_0  
freetype                  2.10.0               he983fc9_1    conda-forge
freexl                    1.0.5             h14c3975_1002    conda-forge
fsspec                    0.5.1                      py_0    conda-forge
gdal                      2.3.3            py37hbb2a789_0  
geopandas                 0.6.0                      py_0    conda-forge
geos                      3.7.1             hf484d3e_1000    conda-forge
gettext                   0.19.8.1          hc5be6a0_1002    conda-forge
giflib                    5.1.9                h516909a_0    conda-forge
glib                      2.56.2            had28632_1001    conda-forge
gst-plugins-base          1.14.0               hbbd80ab_1  
gstreamer                 1.14.0               hb453b48_1  
hdf4                      4.2.13            h9a582f1_1002    conda-forge
hdf5                      1.10.4          nompi_h3c11f04_1106    conda-forge
heapdict                  1.0.1                      py_0    conda-forge
icu                       58.2              hf484d3e_1000    conda-forge
idna                      2.8                   py37_1000    conda-forge
importlib-metadata        0.23                     pypi_0    pypi
iris                      2.2.1                    py37_0    conda-forge
jinja2                    2.10.1                     py_0    conda-forge
jmespath                  0.9.4                      py_0    conda-forge
jpeg                      9c                h14c3975_1001    conda-forge
json-c                    0.13.1            h14c3975_1001    conda-forge
kealib                    1.4.10            h1978553_1003    conda-forge
kiwisolver                1.1.0            py37hc9558a2_0    conda-forge
krb5                      1.16.3            h05b26f9_1001    conda-forge
libblas                   3.8.0               12_openblas    conda-forge
libcblas                  3.8.0               12_openblas    conda-forge
libcurl                   7.65.3               hda55be3_0    conda-forge
libdap4                   3.19.1               h6ec2957_0  
libedit                   3.1.20181209         hc058e9b_0    anaconda
libffi                    3.2.1             he1b5a44_1006    conda-forge
libgcc-ng                 9.1.0                hdf63c60_0  
libgdal                   2.3.3                h2e7e64b_0  
libgfortran               3.0.0                         1    conda-forge
libgfortran-ng            7.3.0                hdf63c60_0  
libiconv                  1.15              h516909a_1005    conda-forge
libkml                    1.3.0             h4fcabce_1010    conda-forge
liblapack                 3.8.0               12_openblas    conda-forge
libnetcdf                 4.6.2             hbdf4f91_1001    conda-forge
libopenblas               0.3.7                h6e990d7_1    conda-forge
libpng                    1.6.37               hed695b0_0    conda-forge
libpq                     11.4                 h4e4e079_0    conda-forge
libspatialindex           1.9.0                he1b5a44_1    conda-forge
libspatialite             4.3.0a            hb5ec416_1026    conda-forge
libssh2                   1.8.2                h22169c7_2    conda-forge
libstdcxx-ng              9.1.0                hdf63c60_0  
libtiff                   4.0.10            h57b8799_1003    conda-forge
libuuid                   1.0.3                h1bed415_2  
libxcb                    1.13              h14c3975_1002    conda-forge
libxml2                   2.9.9                h13577e0_2    conda-forge
locket                    0.2.0                      py_2    conda-forge
lz4-c                     1.8.3             he1b5a44_1001    conda-forge
markupsafe                1.1.1            py37h14c3975_0    conda-forge
matplotlib                2.2.3            py37hb69df0a_0  
more-itertools            7.2.0                    pypi_0    pypi
msgpack-python            0.6.2            py37hc9558a2_0    conda-forge
munch                     2.3.2                      py_0    conda-forge
ncurses                   6.1               hf484d3e_1002    conda-forge
netcdf4                   1.5.1.2          py37had58050_0    conda-forge
numpy                     1.17.2           py37h95a1406_0    conda-forge
olefile                   0.46                       py_0    conda-forge
openjpeg                  2.3.1                h21c5421_1    conda-forge
openssl                   1.1.1c               h516909a_0    conda-forge
owslib                    0.18.0                     py_0    conda-forge
packaging                 19.2                       py_0    conda-forge
pandas                    0.25.1           py37hb3f55d8_0    conda-forge
partd                     1.0.0                      py_0    conda-forge
pcre                      8.43                 he6710b0_0  
pillow                    6.2.0            py37h6b7be26_0    conda-forge
pip                       19.2.3                   py37_0    conda-forge
pixman                    0.38.0            h516909a_1003    conda-forge
pluggy                    0.13.0                   pypi_0    pypi
poppler                   0.72.0            h2fc8fa2_1000    conda-forge
poppler-data              0.4.9                         1    conda-forge
proj4                     5.2.0             he1b5a44_1006    conda-forge
psutil                    5.6.3            py37h516909a_0    conda-forge
pthread-stubs             0.4               h14c3975_1001    conda-forge
py                        1.8.0                    pypi_0    pypi
pycparser                 2.19                     py37_1    conda-forge
pyepsg                    0.4.0                      py_0    conda-forge
pyhdf                     0.10.1           py37h3a4e923_1    conda-forge
pykdtree                  1.3.1           py37h3010b51_1002    conda-forge
pyke                      1.1.1                 py37_1000    conda-forge
pyopenssl                 19.0.0                   py37_0    conda-forge
pyparsing                 2.4.2                      py_0    conda-forge
pyproj                    1.9.6           py37h516909a_1002    conda-forge
pyqt                      5.9.2            py37h05f1152_2  
pyshp                     2.1.0                      py_0    conda-forge
pysocks                   1.7.1                    py37_0    conda-forge
pytest                    5.2.0                    pypi_0    pypi
python                    3.7.3                h5b0a415_0    conda-forge
python-dateutil           2.8.0                      py_0    conda-forge
pytz                      2019.2                     py_0    conda-forge
pyyaml                    5.1.2            py37h516909a_0    conda-forge
qt                        5.9.7                h5867ecd_1  
rasterio                  1.0.21           py37hc38cc03_0  
readline                  7.0               hf8c457e_1001    conda-forge
requests                  2.22.0                   py37_1    conda-forge
rtree                     0.8.3           py37h666c49c_1002    conda-forge
s3transfer                0.2.1                    py37_0    conda-forge
scipy                     1.3.1            py37h921218d_2    conda-forge
setuptools                41.2.0                   py37_0    conda-forge
shapely                   1.6.4           py37h06cd6f9_1005    conda-forge
sip                       4.19.8          py37hf484d3e_1000    conda-forge
six                       1.12.0                py37_1000    conda-forge
snuggs                    1.4.7                      py_0    conda-forge
sortedcontainers          2.1.0                      py_0    conda-forge
sqlite                    3.28.0               h8b20d00_0    conda-forge
tblib                     1.4.0                      py_0    conda-forge
tk                        8.6.9             hed695b0_1003    conda-forge
toolz                     0.10.0                     py_0    conda-forge
tornado                   6.0.3            py37h516909a_0    conda-forge
udunits2                  2.2.27.6          h4e0c4b3_1001    conda-forge
urllib3                   1.25.6                   py37_0    conda-forge
wcwidth                   0.1.7                    pypi_0    pypi
wheel                     0.33.6                   py37_0    conda-forge
xarray                    0.13.0                   pypi_0    pypi
xerces-c                  3.2.2             hea5cb30_1003    conda-forge
xorg-libxau               1.0.9                h14c3975_0    conda-forge
xorg-libxdmcp             1.1.3                h516909a_0    conda-forge
xz                        5.2.4             h14c3975_1001    conda-forge
yaml                      0.1.7             h14c3975_1001    conda-forge
zict                      1.0.0                      py_0    conda-forge
zipp                      0.6.0                    pypi_0    pypi
zlib                      1.2.11            h516909a_1006    conda-forge
zstd                      1.4.0                h3b9ef0a_0    conda-forge

Lixu

tsherwen commented 5 years ago

Hello,

Are you importing whilst using an ipython command shell? If so, which version of python is your ipython running?

I have been able to reproduce the warning messages in python you reported by setting up a fresh environment, but not specifying ipython (3) is installed.

ephem package not installed
/users/ts551/scratch/conda_local/envs/py_2_7_master_MPL_II/lib/python2.7/site-packages/iris/unit.py:52: IrisDeprecation: iris.unit is deprecated in Iris v1.9. Please use cf_units (https://github.com/SciTools/cf_units) instead. warn_deprecated('iris.unit is deprecated in Iris v1.9. Please use 
failed to import geopandas
failed to import rasterio

When importing AC_tools in ipython (python 3), there are 4 warning I would expect to see (pasted below). This is because I am partially maintaining back compatibility with python 2 to allow conversion of legacy GEOS-Chem bpch files to NetCDF via a iris backend (using PyGChem).

WARNING iris not imported
WARNING iris not imported
WARNING: Module not found error raised for: mpl_toolkits.basemap
WARNING: Module not found error raised for: mpl_toolkits.basemap

Tomas

jinlx commented 5 years ago

Hi Tomas,

Thanks for the reply.

I am using python in ubuntu terminal and I set AC_tools in a clean environment. The python version I use is python3. So what I do to import AC_tools is simply

(AC_tools) cheyenne5 home/lixujin> python
Python 3.7.3 | packaged by conda-forge | (default, Mar 27 2019, 23:01:00)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import AC_tools

And then I get the information I show above after I install affine package.

>>> import AC_tools
failed to import geopandas
failed to import rasterio

I am not sure if it is caused by my installation process. I would also show my installation step just in case.

conda create -n AC_tools
conda activate AC_tools
git clone --recursive https://github.com/tsherwen/AC_tools.git
git submodule update --recursive

And then install additional packages

conda install -c conda-forge iris
conda install -c conda-forge pyhdf
conda install netCDF4 
conda install basemap
conda install --channel conda-forge geopandas
conda install -c conda-forge rasterio
conda install -c anaconda ephem

Hope this imformation helps.

Lixu

tsherwen commented 5 years ago

Hello Lixu,

OK. I think I can see a possible issue. I would not recommend including basemap in your environment if you are using python3, as basemap is no longer maintained. I would recommend using cartopy for spatial plotting now.

One other question, does the prompt “>>>” return after the warning messages “failed to …”?

I successfully followed the steps you shared (and also included the install of xarray). When I excluded the install of basemap I got the error message below and when I included the basemap install I saw no warnings.

(AC_tools) [ts551@login1(viking) AC_tools]$ python 
Python 3.7.3 | packaged by conda-forge | (default, Jul  1 2019, 21:52:21) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import AC_tools
WARNING: Module not found error raised for: mpl_toolkits.basemap
WARNING: Module not found error raised for: mpl_toolkits.basemap
>>> 

I am slowly removing routines that use packages that were in use when AC_tools was used with python 2, including those for handling the bpch data format and basemap for plotting.

Does this help?

Tomas

jinlx commented 5 years ago

Hi Tomas,

I do get “>>>” return after the warning messages “failed to …”. and there is no warning massage.

And I resintall it again and successfully import AC_tools without installing any other packages.

Thanks, Lixu

tsherwen commented 5 years ago

Hello Lixu,

Great. I'll update the messages to make it clearer that they are just warnings to alert the user and the package should still work fine without them, except for the few functions that require them.

Glad everything seems to be working now.

Cheers,

Tomas