Encounter /tmp error while installing?

Moses Liao GZ
1 min readNov 13, 2023

Have you encounter errors that is related to tmpfolder while trying to install a library via PIP or yum? Most likely you are trying to install libraries in an OS that is hardened with restricted access to the /tmp folder which is normal but you still need the library. So how are you going to install then?

There is a provision in linux OS that you can set the TMP_DIR in the env. Once that variable is set all temporary files in the duration of the installation will use that folder as a temporary holding directory for their file.

So this is the steps you can take to install:
1) Make a new directory mkdir /aaa/bbb/tmp.

2) Set the environment variable.

export TMPDIR=/aaa/bbb/tmp

3) do your whatever pip or yum install and see it works

Do remember to set the full path because it is important that the directory is correct.

--

--

Moses Liao GZ

Cloud and site reliability enthusiasts. AWS SA Associate certified