question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Importing astropy.convolution fails on a conda installation on Python 3.8.0 & 3.9.0 on Windows

See original GitHub issue

UPDATE: Upgrade Python to latest bugfix versions of 3.8 and 3.9, respectively.

Description

Importing astropy.convolution fails on a conda installed astropy on Python 3.8 & 3.9 on Windows. The problem does not occur on MacOS. This is for Astropy 5.0.4 (latest version available on conda).

Expected behavior

I expected the import to not throw ImportError.

Actual behavior

The import threw an ImportError. Full log below, including commands I used to install astropy.

Steps to Reproduce

  1. conda create -n astropy_test python==3.9 astropy
  2. conda activate astropy_test
  3. python -c "import astropy.convolution"
(base) C:\Users\epor>conda create -n astropy python==3.9 astropy
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
  current version: 4.9.2
  latest version: 4.12.0
Please update conda by running
    $ conda update -n base -c defaults conda
## Package Plan ##
  environment location: C:\Users\epor\Anaconda3\envs\astropy
  added / updated specs:
    - astropy
    - python==3.9
The following packages will be downloaded:
    package                    |            build
    ---------------------------|-----------------
    astropy-5.0.4              |   py39h080aedc_0         6.3 MB
    ca-certificates-2022.4.26  |       haa95532_0         124 KB
    certifi-2021.10.8          |   py39haa95532_2         152 KB
    intel-openmp-2021.4.0      |    haa95532_3556         2.2 MB
    mkl-2021.4.0               |     haa95532_640       114.9 MB
    mkl-service-2.4.0          |   py39h2bbff1b_0          51 KB
    mkl_fft-1.3.1              |   py39h277e83a_0         139 KB
    mkl_random-1.2.2           |   py39hf11a4ad_0         225 KB
    numpy-1.21.5               |   py39h7a0a035_2          25 KB
    numpy-base-1.21.5          |   py39hca35cd5_2         4.4 MB
    openssl-1.1.1n             |       h2bbff1b_0         4.8 MB
    packaging-21.3             |     pyhd3eb1b0_0          36 KB
    pip-21.2.4                 |   py39haa95532_0         1.8 MB
    pyerfa-2.0.0               |   py39h2bbff1b_0         359 KB
    pyparsing-3.0.4            |     pyhd3eb1b0_0          81 KB
    python-3.9.0               |       h6244533_2        16.4 MB
    pyyaml-6.0                 |   py39h2bbff1b_1         145 KB
    setuptools-61.2.0          |   py39haa95532_0         1.0 MB
    six-1.16.0                 |     pyhd3eb1b0_1          18 KB
    sqlite-3.38.2              |       h2bbff1b_0         807 KB
    tzdata-2022a               |       hda174b7_0         109 KB
    wheel-0.37.1               |     pyhd3eb1b0_0          33 KB
    wincertstore-0.2           |   py39haa95532_2          15 KB
    ------------------------------------------------------------
                                           Total:       154.1 MB
The following NEW packages will be INSTALLED:
  astropy            pkgs/main/win-64::astropy-5.0.4-py39h080aedc_0
  blas               pkgs/main/win-64::blas-1.0-mkl
  ca-certificates    pkgs/main/win-64::ca-certificates-2022.4.26-haa95532_0
  certifi            pkgs/main/win-64::certifi-2021.10.8-py39haa95532_2
  intel-openmp       pkgs/main/win-64::intel-openmp-2021.4.0-haa95532_3556
  mkl                pkgs/main/win-64::mkl-2021.4.0-haa95532_640
  mkl-service        pkgs/main/win-64::mkl-service-2.4.0-py39h2bbff1b_0
  mkl_fft            pkgs/main/win-64::mkl_fft-1.3.1-py39h277e83a_0
  mkl_random         pkgs/main/win-64::mkl_random-1.2.2-py39hf11a4ad_0
  numpy              pkgs/main/win-64::numpy-1.21.5-py39h7a0a035_2
  numpy-base         pkgs/main/win-64::numpy-base-1.21.5-py39hca35cd5_2
  openssl            pkgs/main/win-64::openssl-1.1.1n-h2bbff1b_0
  packaging          pkgs/main/noarch::packaging-21.3-pyhd3eb1b0_0
  pip                pkgs/main/win-64::pip-21.2.4-py39haa95532_0
  pyerfa             pkgs/main/win-64::pyerfa-2.0.0-py39h2bbff1b_0
  pyparsing          pkgs/main/noarch::pyparsing-3.0.4-pyhd3eb1b0_0
  python             pkgs/main/win-64::python-3.9.0-h6244533_2
  pyyaml             pkgs/main/win-64::pyyaml-6.0-py39h2bbff1b_1
  setuptools         pkgs/main/win-64::setuptools-61.2.0-py39haa95532_0
  six                pkgs/main/noarch::six-1.16.0-pyhd3eb1b0_1
  sqlite             pkgs/main/win-64::sqlite-3.38.2-h2bbff1b_0
  tzdata             pkgs/main/noarch::tzdata-2022a-hda174b7_0
  vc                 pkgs/main/win-64::vc-14.2-h21ff451_1
  vs2015_runtime     pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2
  wheel              pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0
  wincertstore       pkgs/main/win-64::wincertstore-0.2-py39haa95532_2
  yaml               pkgs/main/win-64::yaml-0.2.5-he774522_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
sqlite-3.38.2        | 807 KB    | ############################################################################ | 100%
setuptools-61.2.0    | 1.0 MB    | ############################################################################ | 100%
mkl_random-1.2.2     | 225 KB    | ############################################################################ | 100%
six-1.16.0           | 18 KB     | ############################################################################ | 100%
pip-21.2.4           | 1.8 MB    | ############################################################################ | 100%
intel-openmp-2021.4. | 2.2 MB    | ############################################################################ | 100%
python-3.9.0         | 16.4 MB   | ############################################################################ | 100%
mkl-service-2.4.0    | 51 KB     | ############################################################################ | 100%
packaging-21.3       | 36 KB     | ############################################################################ | 100%
numpy-1.21.5         | 25 KB     | ############################################################################ | 100%
astropy-5.0.4        | 6.3 MB    | ############################################################################ | 100%
mkl-2021.4.0         | 114.9 MB  | ############################################################################ | 100%
numpy-base-1.21.5    | 4.4 MB    | ############################################################################ | 100%
wheel-0.37.1         | 33 KB     | ############################################################################ | 100%
openssl-1.1.1n       | 4.8 MB    | ############################################################################ | 100%
wincertstore-0.2     | 15 KB     | ############################################################################ | 100%
tzdata-2022a         | 109 KB    | ############################################################################ | 100%
mkl_fft-1.3.1        | 139 KB    | ############################################################################ | 100%
pyerfa-2.0.0         | 359 KB    | ############################################################################ | 100%
certifi-2021.10.8    | 152 KB    | ############################################################################ | 100%
pyyaml-6.0           | 145 KB    | ############################################################################ | 100%
ca-certificates-2022 | 124 KB    | ############################################################################ | 100%
pyparsing-3.0.4      | 81 KB     | ############################################################################ | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
#     $ conda activate astropy
#
# To deactivate an active environment, use
#
#     $ conda deactivate
(base) C:\Users\epor>conda activate astropy
(astropy) C:\Users\epor>python
Python 3.9.0 (default, Nov 15 2020, 08:30:55) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import astropy.convolution
Traceback (most recent call last):
  File "C:\Users\epor\Anaconda3\envs\astropy\lib\site-packages\astropy\convolution\convolve.py", line 30, in <module>
    _convolve = load_library("_convolve", LIBRARY_PATH)
  File "C:\Users\epor\Anaconda3\envs\astropy\lib\site-packages\numpy\ctypeslib.py", line 154, in load_library
    raise OSError("no file with expected extension")
OSError: no file with expected extension
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\epor\Anaconda3\envs\astropy\lib\site-packages\astropy\convolution\__init__.py", line 8, in <module>
    from .convolve import convolve, convolve_fft, interpolate_replace_nans, convolve_models, convolve_models_fft  # noqa
  File "C:\Users\epor\Anaconda3\envs\astropy\lib\site-packages\astropy\convolution\convolve.py", line 32, in <module>
    raise ImportError("Convolution C extension is missing. Try re-building astropy.")
ImportError: Convolution C extension is missing. Try re-building astropy.
>>>

System Details

Python 3.9.0 (default, Nov 15 2020, 08:30:55) [MSC v.1916 64 bit (AMD64)] Numpy 1.21.5 pyerfa 2.0.0 astropy 5.0.4 Matplotlib and Scipy were not automatically installed with these installation commands (as expected as they are optional dependencies). Error occurs even if these are installed with conda in the same environment.

Stakeholders

@RemiSoummer @ivalaginja

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ehporcommented, May 5, 2022

Problem does not occur with Python 3.9.12. It only does for Python 3.9.0. The same for the latest patch of Python 3.8 vs. 3.8.0. I think this issue should be solved then.

0reactions
pllimcommented, May 5, 2022

OK, glad to hear. Thanks for letting us know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation — Astropy v5.2
Users of the Anaconda Python distribution should follow the instructions for Using Conda. To install astropy with pip, run: pip install astropy.
Read more >
Couldn't import convolution after python update to 3.7.4
Try re-building astropy.") 30 31 # The GIL is automatically released by default when calling functions imported ImportError: Convolution C ...
Read more >
conda-forge
_ipython_minor_entry_point, 8.7.0, BSD-3-Clause, X, A console script for starting IPython with a specific python major/minor version.
Read more >
python - Conda install and update do not work also solving ...
1) I cannot use conda install for any package. It will give me the error in solving environment list this: failed with initial...
Read more >
List of supported software
3¶. 3to2. 3to2¶. lib3to2 is a set of fixers that are intended to backport code written for Python version 3 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found