"Permission denied: '/lib/python2.7'" installing Python packages — worked for weeks

answered
#1

My Lektor site is failing to deploy with “Permission denied” when installing required Python packages. My dependencies haven’t changed, and this was working yesterday. I’ve retried deploying a few times, most recently with a clear cache.

Looks like an environment issue — I doubt this was previously set up to install to /lib/python2.7:

Yesterday:

4:25:36 PM: Installing collected packages: PyYAML, pathtools, argh, watchdog, mistune, functools32, EXIFRead, MarkupSafe, Jinja2, itsdangerous, click, Werkzeug, Flask, pytz, Babel, idna, chardet, urllib3, six, pycparser, cffi, asn1crypto, ipaddress, cryptography, pyOpenSSL, requests, inifile, lektor
4:25:39 PM: Successfully installed Babel-2.6.0 EXIFRead-2.1.2 Flask-1.0.2 Jinja2-2.10.1 MarkupSafe-1.1.1 PyYAML-5.1 Werkzeug-0.15.2 argh-0.26.2 asn1crypto-0.24.0 cffi-1.12.3 chardet-3.0.4 click-7.0 cryptography-2.6.1 functools32-3.2.3.post2 idna-2.8 inifile-0.4 ipaddress-1.0.22 itsdangerous-1.1.0 lektor-3.1.3 mistune-0.8.4 pathtools-0.1.2 pyOpenSSL-19.0.0 pycparser-2.19 pytz-2019.1 requests-2.21.0 six-1.12.0 urllib3-1.24.2 watchdog-0.9.0
4:25:39 PM: Pip dependencies installed

Today:

3:55:07 PM: Installing collected packages: PyYAML, pathtools, argh, watchdog, mistune, functools32, EXIFRead, MarkupSafe, Jinja2, itsdangerous, click, Werkzeug, Flask, pytz, Babel, idna, chardet, urllib3, six, pycparser, cffi, asn1crypto, ipaddress, cryptography, pyOpenSSL, requests, inifile, lektor
3:55:07 PM: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/lib/python2.7'
#2

Hi @istevens , can you provide a link to one of your failing builds so we can take a look? Thanks.

#3

Thanks @futuregerald!

https://app.netlify.com/sites/sharp-noyce-c7bf26/deploys/5cc219af5d1e550008f34d61

Ian.

#6

Just an FYI if you’re having the same issue, this is a Netlify bug introduced in Ubuntu Trusty 14.04 and Ubuntu Xenial 16.04 images for Python 2.7 and Python 3.7 as specified in runtime.cfg. I’ll respond here when I hear it’s fixed. :crossed_fingers:

1 Like
#7

We got a bug filed on this: https://github.com/netlify/build-image/issues/310

Feel free to follow it there, and sorry for the inconvenience!

1 Like
#8

After isolating the pip error to a few build commands, I found it was a setup.cfg in my repo causing the issue. I added the file to address an error when building an Atom feed, and assumed it would only take if my project was explicitly installed. Turns out, pip was using setup.cfg when run from the project dir to install dependencies.

The setup.cfg content in question, which seems like a very bad idea in retrospect:

[install]
prefix=