Pip install fails with permission error in CPU architecture s390x

Hi,
I have started using the s390x CPU architecture for one of our Python
projects, and found the following issue when pip attempts to install
a package that requires producing a wheel archive at install time:

$ pip install --upgrade --upgrade-strategy eager -r dev-requirements.txt
...
Collecting cryptography
  Downloading cryptography-2.9.2.tar.gz (517 kB).
  Installing build dependencies: started
  ...
  WARNING: Building wheel for prometheus-client failed: [Errno 13] Permission denied: '/home/travis/.cache/pip/wheels/a7'
  WARNING: Building wheel for distlib failed: [Errno 13] Permission denied: '/home/travis/.cache/pip/wheels/eb'
  WARNING: Building wheel for MarkupSafe failed: [Errno 13] Permission denied: '/home/travis/.cache/pip/wheels/0c'
  WARNING: Building wheel for pyrsistent failed: [Errno 13] Permission denied: '/home/travis/.cache/pip/wheels/17'
  WARNING: Building wheel for cryptography failed: [Errno 13] Permission denied: '/home/travis/.cache/pip/wheels/25'
  WARNING: Building wheel for cffi failed: [Errno 13] Permission denied: '/home/travis/.cache/pip/wheels/89'
Failed to build PyYAML FormEncode coverage sphinx-git sphinxcontrib-fulltoc typed-ast wrapt lazy-object-proxy backcall tornado pyzmq pandocfilters prometheus-client distlib MarkupSafe pyrsistent cryptography cffi

Investigating the permissions reveals that directory /home/travis/.cache/pip/wheels and directories below it have owner and group set to root, which is the reason for the permission error:

drwxr-xr-x 19 travis travis 33 Apr 24 16:18 /home/travis
drwxrwxr-x 4 travis travis 4 Jan 20 10:43 /home/travis/.cache
drwxrwxr-x 5 travis travis 5 Jan 20 10:44 /home/travis/.cache/pip
drwxr-xr-x 10 root root 10 Jan 20 10:45 /home/travis/.cache/pip/wheels

For details, the Travis log with the error and the investigation commands is here:
https://travis-ci.org/github/zhmcclient/python-zhmcclient/jobs/679106467

I’m not aware that any of the commands I am running cause this, so likely it is already set incorrectly in the container image.

This error happens with arch=s390x. With the default arch, the jobs run fine.

Could you please fix the owner and group of that subtree for arch=s390x?

Also, since I did not try arch=ppc64le, you may want to double check the permissions there as well.

Thanks

PS: After reporting this, I found this topic Pip cache directory owned by root on s390x that reports the same issue.

A workaround is suggested here: Permission issue while building wheels for various python packages

You can put this into before_install; you can see how I applied the workaround for a project I work on here: https://github.com/gap-system/gap/blob/5d2fe4aad4721b03a24dd47af239b27765c49f19/.travis.yml#L163

Sadly, the arm64/s390x/ppc64le “support” in Travis seems to be essentially unsupported resp. unmaintained… Plenty of issues are reported, but they are not even acknowledge, not to mention fixed, and that’s been going on for a couple of months now.