I had various problems installing Python packaged on z/OS.

Firstly the Python file system was read only - that's ok. I can try to install in a virtual environment. This also had it's problems!

The main problem was, I had the HOME environment variable pointing to a directory which my userid did not have write access to - /u/. When I changed it to my working directory /u/tmp/pymi2, it worked with no problems.

I'll document in the blog the debugging I did.

Preparation

I FTP'd the wheels package in binary from my Linux machine, into /tmp on z/OS.

I switched to my virtual environment using

. env/bin/activate

This gave a command line like

(env) COLIN:/u/tmp/pymqi2:

I used the command

python3 -m pip install /tmp/wheel-0.37.1-py2.py3-none-any.whl /tmp/wheel-0.37.1-py2.py3-none-any.whl --no-cache-dir

But this gave

Installing collected packages: wheel
ERROR: Could not install packages due to an EnvironmentError: [Errno 111] EDC5111I Permission denied.: '/u/.local'

Using the --verbose argument

python3 -m pip --verbose install /tmp/wheel-0.37.1-py2.py3-none-any.whl /tmp/wheel-0.37.1-py2.py3-none-any.whl --no-cache-dir

gave more information, but not enough to resolve the problem.
Using

export DISTUTILS_DEBUG=1
python3 -m pip --verbose install..

gave much more information including

config vars:
{'abiflags': '',
'base': '/usr/lpp/IBM/cyp/v3r8/pyz',
'dist_fullname': 'UNKNOWN-0.0.0',
'dist_name': 'UNKNOWN',
'dist_version': '0.0.0',
'exec_prefix': '/usr/lpp/IBM/cyp/v3r8/pyz',
'platbase': '/usr/lpp/IBM/cyp/v3r8/pyz',
'prefix': '/usr/lpp/IBM/cyp/v3r8/pyz',
'py_version': '3.8.5',
'py_version_nodot': '38',
'py_version_short': '3.8',
'sys_exec_prefix': '/usr/lpp/IBM/cyp/v3r8/pyz',
'sys_prefix': '/usr/lpp/IBM/cyp/v3r8/pyz',
'userbase': '/u/.local',
'usersite': './lib/python3.8/site-packages'}

where I could see where the /u/.local came from.

You can change the userbase (see here) using

export PYTHONUSERBASE=.

and the product installed. When I fixed my HOME environment variable to point to my working directory this also worked!

What is installed?

Using the command

python3 -m pip --verbose list

This gave

Package      Version Location                                                   Installer           ------------ ------- ---------------------------------------------------------- ---------           cffi         1.14.0  /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages                     cryptography 2.8     /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages                     ebcdic       1.1.1   /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages pip                 numpy        1.18.2  /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages pip                 pip          20.2.1  /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages pip                 pycparser    2.20    /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages pip                 setuptools   47.1.0  /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages pip                 six          1.15.0  /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages                     wheel        0.37.1  /u/tmp/pymqi2/lib/python3.8/site-packages                  pip                 zos-util     1.0.0   /Z24C/usr/lpp/IBM/cyp/v3r8/pyz/lib/python3.8/site-packages                    

so we can see the wheel package was installed in my user directory.

Without the --verbose just package and version were displayed, no location or installer.

Uninstall it

I used

python3 -m pip --verbose uninstall wheel

to uninstall it