import pystan._api failed:ImportError: DLL load failed: The specified module could not be found
Asked Answered
M

3

10

I have installed python 3.7 and want to do some forecasting using fbprophet (https://facebook.github.io/prophet/docs/installation.html#python)

But I get this error when installing the package using the command (pip install fbprophet)

import pystan
  File "e:\repos\usf\venv\lib\site-packages\pystan\__init__.py", line 9, in <module>
    from pystan.api import stanc, stan
  File "e:\repos\usf\venv\lib\site-packages\pystan\api.py", line 13, in <module>
    import pystan._api  # stanc wrapper
ImportError: DLL load failed: The specified module could not be found.

I have done some research and got to know that this is possible with conda. But I am looking for a solution without using conda.

Thanks in advance.

Microcurie answered 25/2, 2020 at 6:45 Comment(0)
V
5

It says in the Pystan documentation that configuring a C++ compiler can be challenging on Windows. Following approach worked for me to install Pystan 2.17.1 and FBProphet 0.6:

  1. Install C++ compiler, mingw-w64 (http://mingw-w64.org/doku.php/download) -> I selected this one https://sourceforge.net/projects/mingw-w64/files/

  2. Add C:<MinGW_w64 installation directory>\bin to the PATH environment variable

  3. Create a distutils.cfg file with the following contents in the folder \Lib\distutils in Python install directory (in venv):

    [build] compiler=mingw32

    [build_ext] compiler=mingw32

  4. pip install numpy cython

  5. pip install pystan==2.17.1

  6. Verify the Pystan installation (https://pystan.readthedocs.io/en/latest/windows.html)

  7. pip install fbprophet==0.6

Valli answered 6/11, 2020 at 11:15 Comment(2)
Which version of Python did you use? On Python 3.8.10 I can successfully compile pystan 2.17.1 but when I try to verify it, importing the module fails with: ImportError: DLL load failed while importing _apiShaniqua
I'm sorry, it's been some time and I can't be sure what python version I had when posting this answer. It's most probably 3.7.7.Valli
O
3

Follow https://github.com/facebook/prophet/issues/1939 I had similar issues even after installing Mingw

conda install libpython m2w64-toolchain -c msys2 Solved all the errors and i am able to install fbprophet finally Thanks

Overlord answered 16/6, 2021 at 18:41 Comment(0)
B
0

I had similar issues with my Python3.6 (anaconda)

I reinstalled anaconda for all users (with admin privileges) then "conda install -c conda-forge pystan" later i updated all other modules

it works without any error now

Brayton answered 3/1, 2022 at 9:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.