Description
It is always headache to import statsmodels.
I have the statmodels installed in the target environment but PyCall insist that is not there.
julia> sm = PyCall.pyimport("statsmodels.api")
ERROR: PyError (PyImport_ImportModule
The Python package statsmodels.api could not be imported by pyimport. Usually this means
that you did not install statsmodels.api in the Python version being used by PyCall.
PyCall is currently configured to use the Python version at:
C:\Users\sinan\anaconda3\envs\py38\python.exe
and you should use whatever mechanism you usually use (apt-get, pip, conda,
etcetera) to install the Python package containing the statsmodels.api module.
One alternative is to re-configure PyCall to use a different Python
version on your system: set ENV["PYTHON"] to the path/name of the python
executable you want to use, run Pkg.build("PyCall"), and re-launch Julia.
Another alternative is to configure PyCall to use a Julia-specific Python
distribution via the Conda.jl package (which installs a private Anaconda
Python distribution), which has the advantage that packages can be installed
and kept up-to-date via Julia. As explained in the PyCall documentation,
set ENV["PYTHON"]="", run Pkg.build("PyCall"), and re-launch Julia. Then,
To install the statsmodels.api module, you can use pyimport_conda("statsmodels.api", PKG)
,
where PKG is the Anaconda package the contains the module statsmodels.api,
or alternatively you can use the Conda package directly (via
using Conda
followed by Conda.add
etcetera).
) <class 'ImportError'>
ImportError('DLL load failed while importing ufuncs: The specified module could not be found.')
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\statsmodels\api.py", line 9, in
from . import regression
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\statsmodels\regression_init.py", line 1, in
from .linear_model import yule_walker
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\statsmodels\regression\linear_model.py", line 40, in
from scipy import stats
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\scipy\stats_init_.py", line 388, in
from .stats import *
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\scipy\stats\stats.py", line 174, in
from scipy.spatial.distance import cdist
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\scipy\spatial_init_.py", line 102, in
from .geometric_slerp import geometric_slerp
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\scipy\spatial_geometric_slerp.py", line 8, in
from scipy.spatial.distance import euclidean
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\scipy\spatial\distance.py", line 121, in
from ..special import rel_entr
File "C:\Users\sinan\anaconda3\envs\py38\lib\site-packages\scipy\special_init.py", line 633, in
from . import _ufuncs
Stacktrace:
[1] pyimport(::String) at C:\Users\sinan.julia\packages\PyCall\BcTLp\src\PyCall.jl:547
[2] top-level scope at none:1
julia>