4

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?

Nipun Ravisara
  • 3,629
  • 3
  • 20
  • 35
  • 1
    Have you checked [this](https://stackoverflow.com/questions/58760516/setting-up-aws-ec2-instance-with-tensorflow-2-0-ami-versus-building-it-yourse) thread? – amitd May 04 '21 at 09:29
  • yeah I read it before but It's for gpu support and also required docker. – Nipun Ravisara May 04 '21 at 10:16

7 Answers7

7

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
marsolmos
  • 748
  • 9
  • 24
3

It can be fixed with the following command:

pip install tensorflow-cpu

instead of just:

pip install tensorflow
Ethan
  • 876
  • 8
  • 18
  • 34
Dinesh Raj
  • 31
  • 1
3

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

Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
1

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

bigmac
  • 145
  • 1
  • 6
  • Thanks for the help. I followed instructions on your link and then its says "ERROR: Could not install packages due to an EnvironmentError: [Errno 28] No space left on device". So seems like the instance is too small. – Nipun Ravisara May 04 '21 at 10:17
0

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

Nipun Ravisara
  • 3,629
  • 3
  • 20
  • 35
0

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.

0

For me, running:

pip3 install tensorflow-cpu --no-cache-dir

Fixed it on the free tier

Tyler2P
  • 2,324
  • 26
  • 22
  • 31