Create a gist now

Instantly share code, notes, and snippets.

@dacamo76 /README.md
Last active Sep 26, 2017

Embed
What would you like to do?
Installing scikit-learn on Amazon Linux AMI on EC2

To install scikit-learn easily run the following command.

curl https://gist.githubusercontent.com/dacamo76/4780765/raw/c3779996d8f6b13caaaa48d33aa1585684c7f8e6/scikit-learn-install.sh | sh

Please look over the shell file being run to make sure no evil is done to your machine.

sudo yum -y install gcc-c++ python27-devel atlas-sse3-devel lapack-devel
wget https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.11.6.tar.gz
tar xzf virtualenv-1.11.6.tar.gz
python27 virtualenv-1.11.6/virtualenv.py sk-learn
. sk-learn/bin/activate
pip install numpy
pip install scipy
pip install scikit-learn
@sohailbud

This comment has been minimized.

Show comment
Hide comment
@sohailbud

sohailbud Apr 20, 2014

Hello, I am trying to run mrjob script on amazon ec2 and in order to do that, I need to install scikit learn on amazon. Can you please explain how exactly to run your code, I am pretty new to this. Thanks!

sohailbud commented Apr 20, 2014

Hello, I am trying to run mrjob script on amazon ec2 and in order to do that, I need to install scikit learn on amazon. Can you please explain how exactly to run your code, I am pretty new to this. Thanks!

@dacamo76

This comment has been minimized.

Show comment
Hide comment
@dacamo76

dacamo76 May 9, 2014

To run it blindly just copy the command in README.md and run it in your console.

For a more detailed explanation check out my blog post http://dacamo76.com/blog/2012/12/07/installing-scikit-learn-on-amazon-ec2 which details what each step does.

Owner

dacamo76 commented May 9, 2014

To run it blindly just copy the command in README.md and run it in your console.

For a more detailed explanation check out my blog post http://dacamo76.com/blog/2012/12/07/installing-scikit-learn-on-amazon-ec2 which details what each step does.

@rongyuan124

This comment has been minimized.

Show comment
Hide comment
@rongyuan124

rongyuan124 Jul 3, 2015

I copied the above link but it still doesn't work. Does it depend on Python version?

rongyuan124 commented Jul 3, 2015

I copied the above link but it still doesn't work. Does it depend on Python version?

@duhaime

This comment has been minimized.

Show comment
Hide comment
@duhaime

duhaime Aug 4, 2015

@rongyuan124 it depends on your OS, among other things. Are you on Redhat or the Amazon Linux OS? If not, you may need to change the yum install to apt-get install

duhaime commented Aug 4, 2015

@rongyuan124 it depends on your OS, among other things. Are you on Redhat or the Amazon Linux OS? If not, you may need to change the yum install to apt-get install

@TamakiSakura

This comment has been minimized.

Show comment
Hide comment
@TamakiSakura

TamakiSakura Apr 10, 2016

I recommend adding
pip install -U pip
command before doing any of the pip install stuff.

There seems to be some issue with the default pip version, which give out the following error sometimes when installing scipy

Traceback (most recent call last):
File "/home/ec2-user/sk-learn/bin/pip", line 11, in
sys.exit(main())
File "/home/ec2-user/sk-learn/local/lib/python2.7/dist-packages/pip/init.py", line 185, in main
return command.main(cmd_args)
File "/home/ec2-user/sk-learn/local/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 51: ordinal not in range(128)

TamakiSakura commented Apr 10, 2016

I recommend adding
pip install -U pip
command before doing any of the pip install stuff.

There seems to be some issue with the default pip version, which give out the following error sometimes when installing scipy

Traceback (most recent call last):
File "/home/ec2-user/sk-learn/bin/pip", line 11, in
sys.exit(main())
File "/home/ec2-user/sk-learn/local/lib/python2.7/dist-packages/pip/init.py", line 185, in main
return command.main(cmd_args)
File "/home/ec2-user/sk-learn/local/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main
text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 51: ordinal not in range(128)

@olivetechnologies

This comment has been minimized.

Show comment
Hide comment
@olivetechnologies

olivetechnologies Jun 15, 2016

Tamaki thanks for your input.
It really helped me.

olivetechnologies commented Jun 15, 2016

Tamaki thanks for your input.
It really helped me.

@estwanick

This comment has been minimized.

Show comment
Hide comment
@estwanick

estwanick Jul 29, 2017

This script did not install scikit-learn for me, I instead made my own bootstrap script:

#!/bin/bash
sudo pip install numpy
sudo pip install scipy
sudo pip install -U scikit-learn

estwanick commented Jul 29, 2017

This script did not install scikit-learn for me, I instead made my own bootstrap script:

#!/bin/bash
sudo pip install numpy
sudo pip install scipy
sudo pip install -U scikit-learn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment