'WinError 126 "The specified module could not be found" when importing spiceypy

I have read half dozen SE answers regarding WinError 126 and could not find one that I could apply, or maybe I am still too ignorant to understand them at this moment and see how they apply to my case.

The following error is display when I import spiceypy

Traceback (most recent call last):
  File ".\test_spiceypy.py", line 2, in <module>
    import spiceypy
  File "C:\Python37\lib\site-packages\spiceypy\__init__.py", line 27, in <module>
    from .spiceypy import *
  File "C:\Python37\lib\site-packages\spiceypy\spiceypy.py", line 36, in <module>
    from .utils.libspicehelper import libspice
  File "C:\Python37\lib\site-packages\spiceypy\utils\libspicehelper.py", line 57, in <module>
    libspice = CDLL(libspice_path)
  File "C:\Python37\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

This is the setup:

  • Windows 10
  • Python 3.7.3 (32-bit)
  • pip 22.0.4 from c:\python37\lib\site-packages\pip
  • spiceypy==5.0.1 (installed thru pip install spiceypy)
  • Packages that seem relevant (mentioned in the documentation) setuptools==61.3.1 and wheel==0.37.1 are up-to-date

In order to avoid any issues with wheel, I re-installed spiceypy as suggested, but the problem persists: pip install spiceypy --no-cache-dir --no-binary :all:

Could you explain what I am missing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source