Axel Carré
Axel Carré

Reputation: 185

How to change pip unpacking folder?

I need to install tensorflow on my Raspberry, but executing pip install tensorflow (or any other pip install) ends up with a Errno 28 "No space left on device".

I tried solution 2 of this with no effect, this but it says it's deprecated, and even this.

I understand the problem lies in the fact that I don't have enough space in the directory where the unpacking occurs (the first one below) because when I use df it produces this (sorry headers are in french) :

enter image description here

I even tried to export TMPDIR=PATH_TO_A_BIGGER_ONE but it still can't complete the download because of no space.

I just can't find a way to change this directory.

Upvotes: 10

Views: 18366

Answers (2)

Solmyr87
Solmyr87

Reputation: 11

I was following this guide and ran into the same problem you describe. These steps solved it for me:

  1. Create a temp folder on a disk that has a lot of space:

    mkdir -p /bigtempfolder

  2. Change TMPDIR env to the big folder you just created:

    export TMPDIR=/bigtempfolder

  3. Set generous access to the temp folder:

    sudo chmod 777 /bigtempfolder

  4. (Create a Swap file if you have limited RAM on the machine):

    1. Create a Swap of 4 GB:

      sudo dd if=/dev/zero of=/swapfile bs=1M count=4096

    2. Format the file for Swap usage:

      sudo mkswap /swapfile

    3. Activate Swap file:

      sudo swapon /swapfile

    4. Make the Swap permanent:

      echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

    5. Verify that the swap is now activated:

      sudo swapon --show

  5. Install the package(s) using the --cache-dir flag:

    pip --cache-dir /bigtempfolder install tensorflow

Upvotes: 0

BaiJiFeiLong
BaiJiFeiLong

Reputation: 4655

Both TMPDIR and Target directory should be big enough.

TMPDIR=PATH_TO_A_BIGGER_ONE pip install [package name] --target ANOTHER_PATH_TO_A_BIGGER_ONE

Upvotes: 20

Related Questions