Hello Divyanshu,
Pip should not usually install packages to /tmp but your setup looks unusual since it looks like you may have actually installed python to /tmp. However, you should note pip almost always needs some space in /tmp to hold temporary files that it creates during the downloading and installation process, if there is no space in /tmp, you can set the TMPDIR environment variable to a path on a filesystem that you know to have space, for example `export TMPDIR=$HOME/.tmp`.
As for how to change the installation directory of Python, if you're on z/OS I would suggest using the `mv` command to move your installation somewhere else (example: `mv /SYSTEM/tmp/my_div $HOME/`). z/OS Python is distributed in a pax tarball and is relocatable, so the installation can be moved in the same way as any other directory. If you have moved many other files into the the same directory prefix you have installed your Python installation to, so you are no longer sure of what is part of that Python installation, I would recommend downloading the pax archive from IBM and extracting it in some location of your choosing. If you are not on z/OS and instead on some other unix, I would recommend installing python through your system's package manager, or homebrew if you are on MacOS.
Regards,
Giancarlo
------------------------------
Giancarlo Frix
Software Engineer, Open-Source Porting
Rocket Software Inc.
------------------------------
Original Message:
Sent: 02-09-2024 03:00
From: Divyanshu Singh
Subject: pip directing installs in /tmp rather than it's own directory
Hi,
I am facing problem with python where it is using /tmp to install pip modules and libraries instead of it's own directory site-packages.
- I want python to re-direct to /shrd/python and not to /tmp
# python3 -m pip install --upgrade virtualenv
WARNING: The directory '/SYSTEM/tmp/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled
ERROR: Could not install packages due to an OSError: [Errno 133] EDC5133I No space left on device.
2. Getting this error while creating environment variable
# python3 -m venv my_div
Error: Command '['/SYSTEM/tmp/my_div/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status
Can someone help me here with a solution or command through which I can change the installation directory of python?
Thanks,
Divyanshu.
------------------------------
Divyanshu Singh
MVS system programmer
BMC Software
Kanpur IN
------------------------------