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

ImportError: Convolution C extension is missing. Try re-building astropy. #271

Closed
JBWoerdman opened this issue Apr 28, 2022 · 8 comments
Closed

Comments

@JBWoerdman
Copy link

JBWoerdman commented Apr 28, 2022

Hi @kvos,

I'm having a hard time getting the initial settings to work.
The following errors are prompt:

import os
import numpy as np
import pickle
import warnings
warnings.filterwarnings("ignore")
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
from matplotlib import gridspec
plt.ion()
import pandas as pd
from datetime import datetime
from coastsat import SDS_download, SDS_preprocess, SDS_shoreline, SDS_tools, SDS_transects

OSError Traceback (most recent call last)
~\Anaconda3\envs\coastsat\lib\site-packages\astropy\convolution\convolve.py in
24 try:
---> 25 _convolve = load_library("_convolve", LIBRARY_PATH)
26 except Exception:

~\Anaconda3\envs\coastsat\lib\site-packages\numpy\ctypeslib.py in load_library(libname, loader_path)
153 ## if no successful return in the libname_ext loop:
--> 154 raise OSError("no file with expected extension")
155

OSError: no file with expected extension

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_20324\3769660273.py in
11 import pandas as pd
12 from datetime import datetime
---> 13 from coastsat import SDS_download, SDS_preprocess, SDS_shoreline, SDS_tools, SDS_transects

~\CoastSat-master\coastsat\SDS_download.py in
30
31 # CoastSat modules
---> 32 from coastsat import SDS_preprocess, SDS_tools, gdal_merge
33
34 np.seterr(all='ignore') # raise/ignore divisions by 0 and nans

~\CoastSat-master\coastsat\SDS_preprocess.py in
27
28 # CoastSat modules
---> 29 from coastsat import SDS_tools
30
31 np.seterr(all='ignore') # raise/ignore divisions by 0 and nans

~\CoastSat-master\coastsat\SDS_tools.py in
16 from shapely import geometry
17 import skimage.transform as transform
---> 18 from astropy.convolution import convolve
19
20 np.seterr(all='ignore') # raise/ignore divisions by 0 and nans

~\Anaconda3\envs\coastsat\lib\site-packages\astropy\convolution_init_.py in
6 from .utils import discretize_model, KernelSizeError # noqa
7
----> 8 from .convolve import convolve, convolve_fft, interpolate_replace_nans, convolve_models, convolve_models_fft # noqa
9
10 # Deprecated kernels that are not defined in all

~\Anaconda3\envs\coastsat\lib\site-packages\astropy\convolution\convolve.py in
25 _convolve = load_library("_convolve", LIBRARY_PATH)
26 except Exception:
---> 27 raise ImportError("Convolution C extension is missing. Try re-building astropy.")
28
29 # The GIL is automatically released by default when calling functions imported

ImportError: Convolution C extension is missing. Try re-building astropy.

To resolve the errors I have already done the steps as suggested in #42, although the earthengine authentication happened without any problems. Furthermore, I tried to reinstall anaconda, created multiple new environments and downloaded a new folder of CoastSat-master. Still the same issues raise. Do you perhaps have any idea how to get it working?

Thanks!
Best, Jelle

@kvos
Copy link
Owner

kvos commented Apr 29, 2022

hi jelle, there seems to be an issue that is raised with the new version of the astropy library.
Can you try the following:

  • remove all existing environments (conda env remove --name myenv). You can check the names of the environments that you have installed with conda env list
  • run conda clean --all
  • run conda update -n base -c defaults conda
  • try to re-install with the environment.yml contained in this zip file zip.zip

let me know if this fixes it and I will update the environment.yml file in the repo

@kvos kvos changed the title error in initial setting ImportError: Convolution C extension is missing. Try re-building astropy. Apr 29, 2022
@JBWoerdman
Copy link
Author

Thanks for your reply! I will try to reinstall the environment right away.

@JBWoerdman
Copy link
Author

hi jelle, there seems to be an issue that is raised with the new version of the astropy library. Can you try the following:

  • remove all existing environments (conda env remove --name myenv). You can check the names of the environments that you have installed with conda env list
  • run conda clean --all
  • run conda update -n base -c defaults conda
  • try to re-install with the environment.yml contained in this zip file zip.zip

let me know if this fixes it and I will update the environment.yml file in the repo

In the previous occasions that I installed the environment it took about 5-10 min. However, now it is still running for 38 min. Is that how it is supposed to be?

@kvos
Copy link
Owner

kvos commented Apr 30, 2022

oh should be too much to process for conda.
what you can do is to install them in multiple steps with conda install
start with conda install -c conda-forge earthengine-api=0.1.236
then conda install gdal geopandas
then conda install scikit-image, conda install -c anaconda astropy, conda install spyder notebook

@JBWoerdman
Copy link
Author

Hi Kilian,

It worked! The errors are no longer showing and it seems to download the example images!
Thanks for the help!

@kvos
Copy link
Owner

kvos commented Apr 30, 2022

great! will need to update the doco, did you end up entering the conda install commands for each package?

@JBWoerdman
Copy link
Author

JBWoerdman commented Apr 30, 2022

Yep! Ik ran each package separately after creating an empty environment.

kvos added a commit that referenced this issue May 1, 2022
easier way to install the environment based on issue #271
@kvos
Copy link
Owner

kvos commented May 2, 2022

I've updated the changes on how to install the environment in the dev branch, will close here for now

@kvos kvos closed this as completed May 2, 2022
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

2 participants