I am trying to install the dev version of statsmodels in a machine with no internet connection. I have downloaded and installed the package on my own machine (tested and working fine) and I have copied the resulting folder under Anaconda\Lib\site-packages
on the offline machine.
I also kept the existing statsmodels folder (since this is what happened on my machine) so that the structure in both machines looks like
site-packages\
statsmodels
statsmodels-0.6.1-py2.7.egg-info
statsmodels-0.8.0-py3.5-win-amd64.egg\
EGG-INFO
statsmodels
The inner statsmodels folder (the one under 0.8.0) contains the newest version that I want to import. In order for the importer to pick up the correct version I replicated a file that appeared on my machine called easy-install.pth
with the following content
import sys; sys.__plen = len(sys.path)
./statsmodels-0.8.0-py3.5-win-amd64.egg
import sys; new = sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p = getattr(sys, '__egginsert', 0); sys.path[p:p] = new; sys.__egginsert = p + len(new)
Now the importer picks up the correct version (0.8.0) but it fails to import the DLLs giving me the following error
C:\Anaconda2\lib\site-packages\statsmodels-0.8.0-py3.5-win-amd64.egg\statsmodels\tsa\statespace\tools.py in set_mode(compatibility)
59 if not compatibility:
60 from scipy.linalg import cython_blas
---> 61 from . import (_representation, _kalman_filter, _kalman_smoother,
62 _simulation_smoother, _tools)
63 compatibility_mode = False
C:\Anaconda2\lib\site-packages\statsmodels-0.8.0-py3.5-win-amd64.egg\statsmodels\tsa\statespace\_representation.py in <module>()
6 print(__name__,__file__)
7 imp.load_dynamic(__name__,__file__)
----> 8 __bootstrap__()
C:\Anaconda2\lib\site-packages\statsmodels-0.8.0-py3.5-win-amd64.egg\statsmodels\tsa\statespace\_representation.py in __bootstrap__()
5 __loader__ = None; del __bootstrap__, __loader__
6 print(__name__,__file__)
----> 7 imp.load_dynamic(__name__,__file__)
8 __bootstrap__()
ImportError: DLL load failed: The specified module could not be found.
I have checked the variable __file__
on the last function call and it points to the DLL _representation.cp35-win_amd64.pyd
which exists under the statespace folder.
Anyone knows a workaround for this or how I can tell the importer to find the missing module?
I suggest you to use pip
to list all required libraries and download them, then distribute the downloaded libraries and install.
From a server/workstation which has the same configuration as the target server (same OS, same system-wide Python).
Create a new empty virtualenv and install statsmodels as usual:
virtualenv venv
source venv/bin/activate
pip install statsmodels
Then list all required packages with pip freeze:
pip freeze > requirements.txt
Create a directory to store all eggs/wheels, and use pip download to download the libraries:
mkdir libs
cd libs/
pip download --no-deps -r requirements.txt
Copy the libs
directory to your target server.
Create a virtualenv and install from your libs
directory:
virtualenv venv
source venv/bin/activate
pip install --find-links libs/ statsmodels
It should work.