dL0008
dL0008

Reputation: 33

How to install 3rd party Python libraries for a single script running on AWS EC2?

I have a script that uses the nltk python library. I'm just trying to wrap my head around how one would install this library and potentially other libraries as well on AWS/EC2. This is a standalone script.

I figured it might be done with the aws cli but the documentation on Amazon seems to be lacking a bit.

Can someone help a complete Python newb with some Python and AWS?!?! :) Thanks!

Upvotes: 1

Views: 2741

Answers (2)

xue
xue

Reputation: 2475

Here is the way I used:

curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
# Then use pip to install 3rd party libraries
pip install selenium
# works now

I did as this article points: also using Ubuntu

http://docs.aws.amazon.com/cli/latest/userguide/installing.html

Upvotes: 1

James Mills
James Mills

Reputation: 19050

Normally when you fire up an AWS instance you select an "Image".

These are called Amazon Machine Images or AMI for short.

Typically you would select say (for example) an "Ubuntu" AMI.

Example: https://cloud-images.ubuntu.com/locator/ec2/

Select the appropriate AMI and then perform some steps similar to:

  1. Configure and Start your Instance
  2. Shell into your Instance
  3. Run: apt-get install python-setuptools
  4. Run: easy_install nltk

You may also find the Python package(s) you're looking for already available in the repositories of the Distribution/Image you've selected.

Upvotes: 2

Related Questions