Using Python PIP on z/OS, was not as smooth as I had expected. Some problems I worked around, some I just had to live with.
PIP is the standard package installer for Python. It is documented here.
To get information about PIP.
The following command gives lots of data about PIP.python3 -m pip debug --verbose
Valid wheel types
“Wheels” are used to create and install Python packages; see here.
For example what are the names of valid “wheel types on my system” (needed when creating a package). Amongst the data this gave, was
Compatible tags: 30
This means PIP install will accept a package with
A package like pymqi-1.12.0-py3-none-zos.whl is not in the list and will not install.
Configuration parameterspython3 -m pip debug --verbose
Configuration data is stored in several places
global: /etc/xdg/pip/pip.conf /etc/pip.conf site: /usr/lpp/IBM/cyp/v3r8/pyz/pip.conf user: $HOME/.pip/pip.conf $HOME/.config/pip/pip.conf
The documentation said
$VIRTUAL_ENV/pip.conf will be used. $
VIRTUAL_ENV was set on my system, but did not show up in the list.
Initially my $HOME was /u, and this caused problems as my userid was not authorised to write to /u/.pip…
Check your $HOME is set to an appropriate value.
Show the configuration files: python3 -m pip config debug
env_var: env global: /etc/xdg/pip/pip.conf, exists: False /etc/pip.conf, exists: False site: /usr/lpp/IBM/cyp/v3r8/pyz/pip.conf, exists: False user: /u/tmp/pymqi2/.pip/pip.conf, exists: False /u/tmp/pymqi2/.config/pip/pip.conf, exists: False
python3 -m pip config list
WARNING: The directory ‘/u/.cache/pip’ or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.-
because HOME was not pointing to a value writeable directory.
Once I had set HOME to a valid value, I could set configuration values.
- python3 -m pip config --user set user.colin yes
- python3 -m pip config --user set site.colin yes
Writing to /u/tmp/pymqi2/.config/pip/pip.conf
This file had
python3 -m pip config --global set user.colin yes
colin = yes
colin = yes
gave me ( as expected)
Writing to /etc/pip.conf
ERROR: Unable to save configuration. Please report this as a bug.
PermissionError: [Errno 111] EDC5111I Permission denied.: ‘/etc/pip.conf’
I would need use a suitably authorised userid to do this.
To edit a config file
You need to specify the editor to usepython3 -m pip config --user --editor /bin/oedit edit