Tensorflow installation killed on AWS ec2 instance

Viewed 1514

I'm trying to use AWS EC2 instance for to test my ML project. During the package installation process of TensorFlow getting kills every time.

I'm using AWS trial EC2 t2.micro type instance for my testing purposes.

  • Type: t2.micro
  • vCPUs: 1
  • Memory: 1GB
  • Os: Ubuntu Server 20.04 LTS (HVM), SSD Volume Type

enter image description here

Is there any soulutions for this?

6 Answers

I had the exact same problem, and I finally fixed it by doing the following:

  • Using free tier instance, but with 25 Gib of hard disk storage (currently, free tier covers up to 30 Gib without extra cost)
  • Install tensorflow by running pip install tensorflow-cpu instead of just pip install tensorflow

It is difficult to state an exact memory requirement for installing Tensorflow and its dependencies, but most likely this instance size is too small. You could verify it works with a larger instance and/or try this

It can be fixed with the following command:

pip install tensorflow-cpu

instead of just:

pip install tensorflow

Found out that the issues is I have not enough space in my EC2 instance. By running this command.

sudo pip install --cache-dir=/data/jimit/ --build /data/jimit/ tensorflow TMPDIR==/data/jimit/

It outputs below error.

ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device

Found it here. Cradits to @bigmac

I had the same issue and pip install tensorflow-cpu was also getting killed. I used pip3 install tensorflow-cpu --no-cache-dir which worked.

Use --no-cache-dir argument with the pip installation command to resolve the tensorflow installation killed issue in aws ec2 instances.

pip3 install tensorflow --no-cache-dir

enter image description here

Related