dll error while importing statsmodel.api

I have used the conda environment propagator to point to the environment that I have used while coding in jupyter notebook.

However, when I put the same code in python script, it fails with the following error

FileNotFoundError: Could not find module ‘C:\Users****.conda\envs\sys_virt_env\lib\site-packages\scipy.libs\libbanded5x.UGR6EUQPIWHQH7SL62IWIXB5545VDNQZ.gfortran-win_amd64.dll’ (or one of its dependencies). Try using the full path with constructor syntax.

The line of code that doesnt execute is
import statsmodels.api as sm

Attaching the screenshots for conda environment propagation and the workflow.

err1

The complete error is
ERROR Python Script 3:2466 Execute failed: Could not find module 'C:\Users*.conda\envs\sys_virt_env\lib\site-packages\scipy.libs\libbanded5x.UGR6EUQPIWHQH7SL62IWIXB5545VDNQZ.gfortran-win_amd64.dll’ (or one of its dependencies). Try using the full path with constructor syntax.
Traceback (most recent call last):
File “”, line 7, in
File "C:\Users*
.conda\envs\sys_virt_env\lib\site-packages\statsmodels\api.py", line 5, in
from . import iolib
File “C:\Users*.conda\envs\sys_virt_env\lib\site-packages\statsmodels\iolib_init_.py", line 1, in
from .foreign import StataReader, genfromdta, savetxt
File "C:\Users*
.conda\envs\sys_virt_env\lib\site-packages\statsmodels\iolib\foreign.py”, line 14, in
from statsmodels.compat.python import (lzip, lmap, lrange,
File “C:\Users*.conda\envs\sys_virt_env\lib\site-packages\statsmodels\compat_init_.py", line 1, in
from statsmodels.tools._testing import PytestTester
File "C:\Users*
.conda\envs\sys_virt_env\lib\site-packages\statsmodels\tools_init_.py”, line 1, in
from .tools import add_constant, categorical
File “C:\Users*.conda\envs\sys_virt_env\lib\site-packages\statsmodels\tools\tools.py", line 7, in
import scipy.linalg
File "C:\Users*
.conda\envs\sys_virt_env\lib\site-packages\scipy_init_.py”, line 136, in
from . import distributor_init
File "C:\Users*.conda\envs\sys_virt_env\lib\site-packages\scipy_distributor_init.py", line 59, in
WinDLL(os.path.abspath(filename))
File "C:\Users*
.conda\envs\sys_virt_env\lib\ctypes_init
.py", line 373, in init
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module ‘C:\Users****.conda\envs\sys_virt_env\lib\site-packages\scipy.libs\libbanded5x.UGR6EUQPIWHQH7SL62IWIXB5545VDNQZ.gfortran-win_amd64.dll’ (or one of its dependencies). Try using the full path with constructor syntax.

Hi @ashhad,

Just to isolate the problem as good as possible, and to make sure that it’s really a problem with KNIME (although this seems probable as the environment seems to work in Jupyter), could you please:

  1. Open the Anaconda Prompt
  2. In the prompt, execute conda activate sys_virt_env
  3. Then execute python
  4. In Python, execute import statsmodels.api as sm

And let me know if the import works there or if it fails with the same error?

Marcel

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.