Build a scikit-learn virtualenv with no internet connection

The previous post assumed you have an internet connection. If that’s not the situation on your prod server, you’ll need the following tweaks:

build the virtualenv using a local virtualenv.py

Download virtualenv.py from https://pypi.python.org/pypi/virtualenv scp it to the prod server, and then do this:

[ihadanny@prod ~]$ tar -xzvf virtualenv-1.11.6.tar.gz
[ihadanny@prod ~]$ ~/virtualenv-1.11.6/virtualenv.py svm_poc/test_scikit
New python executable in svm_poc/test_scikit/bin/python
Installing setuptools, pip...done.
[ihadanny@prod ~]$ source svm_poc/test_scikit/bin/activate

Download the python modules to local zips

On another machine that has internet connection, do this:
[ihadanny@dev ~]$ pip freeze > req.txt
[ihadanny@dev ~] $ pip install --download zips -r req.txt
[ihadanny@dev ~] $ tar -czvf zips.tar.gz zips

Now copy the tar.gz to the prod machine and unpack it.

Install python modules from the downloaded zips

back in the prod server, make sure you’ve installed BLAS, and then:

(test_scikit)[ihadanny@prod ~]$ which pip
~/svm_poc/test_scikit/bin/pip
(test_scikit)[ihadanny@prod ~]$ pip install --no-index --find-links=file:///x/home/ihadanny/webcat_svm_poc/zips numpy scipy scikit-learn pandas

1 thought on “Build a scikit-learn virtualenv with no internet connection

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s