5

I am trying to upload a new python project from my mac to PyPI via:

python setup.py sdist upload -r pypi

When I try to upload a package, I get the following error on OSX:

Submitting dist/PyTreasuryDirect-0.1.0.tar.gz to https://pypi.python.org/pypi
error: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>

This question is slightly related to these two questions, ssl with pip and when importing the ssl library. However I need setup.py to work in my case, how can I get past this ssl error?

I also get the same error on Python 2.7.9 and Python 3.5 using OSX 10.10.2 (14C109)

4
  • MacOSX 10.9+ switched from OpenSSL to SecureTransport for the SSL module. This is a major change in the way tools handle self-signed or unknown signed certificates. (e.g. this impacts [curl][1] for example) Is it possible you have an SSL proxy in the middle, and it does not like the self signed cert of the MitM proxy? [1]: curl.haxx.se/mail/archive-2013-10/0036.html Commented Apr 24, 2015 at 15:13
  • @cgseller I think its a problem with how setup.py is handling ssl and I'm not sure how to fix it. I can get ssl to work on my mac via the other soltuion's but that invovles pip or the openssl package. Commented Apr 24, 2015 at 15:16
  • 1
    On OS X 10.10 with python 2.7.6 no such problem. You might be affected by this issue: "Python 2.7.9 enabled certificate validation by default for HTTP connections, see PEP476." Commented Apr 24, 2015 at 16:04
  • @baf make this an answer, I simply had to use the default python from /usr/bin/python and not the macports or anaconda or hombrew version..... Commented Apr 24, 2015 at 16:37

1 Answer 1

1

The solution for OS X 10.10 is to use its default Python version 2.7.6.

This problem is related to the fact that starting from Python version 2.7.9 certificate validation for stdlib http clients is enabled by default (PEP 476). This issue is described in Python bug tracker.

Sign up to request clarification or add additional context in comments.

1 Comment

That's not at all a solution. Various setup.py scripts simply don't run on Python 2.7, so what should they do?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.