# ImportError: cannot import name ‘decodestring’ from ‘base64’ (/usr/lib64/python3.9/base64.py)

**URL:** <https://discuss.elastic.co/t/importerror-cannot-import-name-decodestring-from-base64-usr-lib64-python3-9-base64-py/262248>\
**Category:** Elasticsearch\
**Created:** [January 26, 2021, 3:33pm UTC](https://discuss.elastic.co/t/importerror-cannot-import-name-decodestring-from-base64-usr-lib64-python3-9-base64-py/262248 "2021-01-26T15:33:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Green\_Max](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/green_max/32/80282_2.png) [@Green\_Max](https://discuss.elastic.co/u/Green_Max)\
**Post date:** [January 26, 2021, 3:33pm UTC](https://discuss.elastic.co/t/importerror-cannot-import-name-decodestring-from-base64-usr-lib64-python3-9-base64-py/262248/1 "2021-01-26T15:33:25Z")

</div>

can you help me to fix bug that says

```auto
    Traceback (most recent call last):
      File "/home/fofive/PycharmProjects/pythonProject/main.py", line 1, in <module>
        from elasticsearch import Elasticsearch, RequestsHttpConnection
      File "/usr/local/lib/python3.9/dist-packages/elasticsearch/ __init__.py", line 24, in <module>
        from .client import Elasticsearch
      File "/usr/local/lib/python3.9/dist-packages/elasticsearch/client/ __init__.py", line 4, in <module>
        from ..transport import Transport
      File "/usr/local/lib/python3.9/dist-packages/elasticsearch/transport.py", line 5, in <module>
        from .connection import Urllib3HttpConnection
      File "/usr/local/lib/python3.9/dist-packages/elasticsearch/connection/ __init__.py", line 2, in <module>
        from .http_requests import RequestsHttpConnection
      File "/usr/local/lib/python3.9/dist-packages/elasticsearch/connection/http_requests.py", line 3, in <module>
        from base64 import decodestring
    ImportError: cannot import name 'decodestring' from 'base64' (/usr/lib/python3.9/base64.py)

    Process finished with exit code 1

```

when I’m trying to import elasticsearch 7.10.1 to python 3.9 on kali linux PyCharm Community

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 27, 2021, 4:07am UTC](https://discuss.elastic.co/t/importerror-cannot-import-name-decodestring-from-base64-usr-lib64-python3-9-base64-py/262248/2 "2021-01-27T04:07:44Z")

</div>

Welcome to our community! 😃

What does your code look like?

---

<div class="post-metadata">

**Author:** ![Green\_Max](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/green_max/32/80282_2.png) [@Green\_Max](https://discuss.elastic.co/u/Green_Max)\
**Post date:** [January 27, 2021, 9:44am UTC](https://discuss.elastic.co/t/importerror-cannot-import-name-decodestring-from-base64-usr-lib64-python3-9-base64-py/262248/3 "2021-01-27T09:44:18Z")

</div>

Glad to find feedback I really need in 🙂  
It happends with no matter wich code is in. All begins when I try import next modules:

```auto
from elasticsearch import Elasticsearch, RequestsHttpConnection
print('Hello, World!')

```

Maybe will be helpfull to note next notification I get when I boot PyCharm Community on, but it's pretty common issue most of my projects are not conflict with, so I do believe Elasticsearch don't mess with \_JAVA\_OPTIONS variable neither: ![Screenshot from 2021-01-27 15-35-15](https://us1.discourse-cdn.com/elastic/original/3X/3/4/3437446d280ca4008c23523255571ec470477b3a.png)

---

<div class="post-metadata">

**Author:** ![Green\_Max](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/green_max/32/80282_2.png) [@Green\_Max](https://discuss.elastic.co/u/Green_Max)\
**Post date:** [January 27, 2021, 10:12am UTC](https://discuss.elastic.co/t/importerror-cannot-import-name-decodestring-from-base64-usr-lib64-python3-9-base64-py/262248/4 "2021-01-27T10:12:27Z")

</div>

Another reason I think it definitely was not IDE variables is because same problem comes up on GuitHub almost a year ago with some browser-support python IDE, that use site-packages instead of dist-packages like Conda. There is no answer as well: [https://github.com/Hironsan/bertsearch/issues/27](https://github.com/Hironsan/bertsearch/issues/27)

---

<div class="post-metadata">

**Author:** ![Green\_Max](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/green_max/32/80282_2.png) [@Green\_Max](https://discuss.elastic.co/u/Green_Max)\
**Post date:** [January 27, 2021, 12:53pm UTC](https://discuss.elastic.co/t/importerror-cannot-import-name-decodestring-from-base64-usr-lib64-python3-9-base64-py/262248/5 "2021-01-27T12:53:49Z")

</div>

As I can guess problem is caused by the version of base64 module I am running, while the version of elasticsearch I installed dependent on a different version of base64 module. But I'm pretty sure I have last versions of both.

So am I suppose to downgrade something? I tried to let it go on different interpreters of python, and the only difference I got after using python bellow 3.9 is the output that elasticsearch module does not installed for such a low version. While in python 3.9 I have the output that base 64 undecodeble.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 24, 2021, 12:53pm UTC](https://discuss.elastic.co/t/importerror-cannot-import-name-decodestring-from-base64-usr-lib64-python3-9-base64-py/262248/6 "2021-02-24T12:53:56Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
