replicate / replicate-python

Python client for Replicate
https://replicate.com
Apache License 2.0
763 stars 219 forks source link

[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed #393

Open kamaldsingh opened 1 week ago

kamaldsingh commented 1 week ago

Hi,

I recently purchased a API token to try out Replicate. However I face SSL error when running the Client or API with - replicate.models.list() .

Error - [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

While I already tried setting - os.environ['CURL_CA_BUNDLE'] = '' . Does anyone have any suggestions on how to fix this issue?

Thanks Kamal

evilstreak commented 3 days ago

The only communication replicate-python does is to https://api.replicate.com, which shouldn't need any special settings for certificate verification.

What version of replicate-python are you using? Are you able to open https://api.replicate.com/ in your browser? It should show a text response of {}.

kamaldsingh commented 3 days ago

yes I can open https://api.replicate.com/ and it does give me the {} response and my replicate-python version is '1.0.3'

evilstreak commented 2 days ago

It sounds like your Python install might have some outdated certificates. What version of Python are you running? Can you try running pip install --upgrade certifi and see if that fixes it?

kamaldsingh commented 2 days ago

Unfortunately that didn't help . I see now that even trying to get predictions with curl -s -X POST command doesn't seem to return any output /comment back.

evilstreak commented 2 days ago

Oh interesting. Can you run your curl command with --verbose and dump the command and the output (with any API tokens and private model information redacted!) here?

kamaldsingh commented 2 days ago

great advice. it seems like it couldn't resolve host and is for some reason taking the prompt as host


* shutting down connection #0
* Could not resolve host: short
* shutting down connection #1
* Could not resolve host: poem
* shutting down connection #2
* Could not resolve host: about
* shutting down connection #3
* Could not resolve host: the
* shutting down connection #4```

` curl.exe -s -X POST  -d '{"input": {"prompt": "Write a short poem about the weather."}}' `
evilstreak commented 2 days ago

The host you queried is missing from your command. Is that because you redacted it out? That definitely looks like something weird is going on with string quoting and arguments in your shell, rather than something wrong with networking.