question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AttributeError: module 'certifi' has no attribute 'where'

See original GitHub issue

Hello,

I found the following issue when using elasticsearch==5.0.0

It seems to be a problem when setting up the connection due to the module ‘certifi’ because it has no attribute ‘where’

Thanks for your help on beforehand.

/opt/conda/lib/python3.5/site-packages/elasticsearch/__init__.py in <module>()
     15     logger.addHandler(logging.NullHandler())
     16 
---> 17 from .client import Elasticsearch
     18 from .transport import Transport
     19 from .connection_pool import ConnectionPool, ConnectionSelector, \

/opt/conda/lib/python3.5/site-packages/elasticsearch/client/__init__.py in <module>()
      2 import logging
      3 
----> 4 from ..transport import Transport
      5 from ..exceptions import TransportError
      6 from ..compat import string_types, urlparse

/opt/conda/lib/python3.5/site-packages/elasticsearch/transport.py in <module>()
      2 from itertools import chain
      3 
----> 4 from .connection import Urllib3HttpConnection
      5 from .connection_pool import ConnectionPool, DummyConnectionPool
      6 from .serializer import JSONSerializer, Deserializer, DEFAULT_SERIALIZERS

/opt/conda/lib/python3.5/site-packages/elasticsearch/connection/__init__.py in <module>()
      1 from .base import Connection
      2 from .http_requests import RequestsHttpConnection
----> 3 from .http_urllib3 import Urllib3HttpConnection

/opt/conda/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py in <module>()
      8 try:
      9     import certifi
---> 10     CA_CERTS = certifi.where()
     11 except ImportError:
     12     pass

AttributeError: module 'certifi' has no attribute 'where'

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ohadravidcommented, Nov 8, 2016

Hi,

I encountered this as well.

For a minimal reproduction, run:

docker run -it jupyter/minimal-notebook /bin/bash
$ pip install elasticsearch
$ python -c "import elasticsearch"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/conda/lib/python3.5/site-packages/elasticsearch/__init__.py", line 17, in <module>
    from .client import Elasticsearch
  File "/opt/conda/lib/python3.5/site-packages/elasticsearch/client/__init__.py", line 4, in <module>
    from ..transport import Transport
  File "/opt/conda/lib/python3.5/site-packages/elasticsearch/transport.py", line 4, in <module>
    from .connection import Urllib3HttpConnection
  File "/opt/conda/lib/python3.5/site-packages/elasticsearch/connection/__init__.py", line 3, in <module>
    from .http_urllib3 import Urllib3HttpConnection
  File "/opt/conda/lib/python3.5/site-packages/elasticsearch/connection/http_urllib3.py", line 10, in <module>
    CA_CERTS = certifi.where()
AttributeError: module 'certifi' has no attribute 'where'

What happen is that import certifi give a weird namespace, which has nothing:

>>> import certifi
>>> certifi
<module 'certifi' (namespace)>
>>> dir(certifi)
['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

I think you should just add certifi to your install_requires (or improve the check using hasattr).

For now I can use the workaround of pip install -U certifi, but it’s annoying.

1reaction
braunmagrincommented, Jan 24, 2017

I just had the same problem here. Installing certifi (using pip) fixed the problem as mentioned above. I’m using both conda and pip. Maybe that’s the problem, because before reinstalling certifi it wasn’t being displayed in the pip freeze listing. Maybe the conda version is somehow broken. I’ll try and investigate it further later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I import wikipedia, I get the error... AttributeError: module ' ...
python - I import wikipedia, I get the error... AttributeError: module 'certifi' has no attribute 'where' - Stack Overflow. Stack Overflow for Teams...
Read more >
certifi
Certifi provides Mozilla's carefully curated collection of Root Certificates for validating the trustworthiness of SSL certificates while verifying the ...
Read more >
[Fixed] ModuleNotFoundError: No module named 'certifi'
How to Fix “ModuleNotFoundError: No module named 'certifi'” in PyCharm · Open File > Settings > Project from the PyCharm menu. · Select...
Read more >
`mach vendor python` is broken (AttributeError: module 'pip ...
mach vendor python glean-parser==1.14.0. And I'm receiving this error: AttributeError: module 'pip._internal.download' has no attribute 'is_file_url'
Read more >
Hello. Try deleting the packag...
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/certifi/init.py", ... AttributeError: type object 'Callable' has no attribute '_abc_registry'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found