# Cannot import name 'Elasticsearch' from 'elasticsearch' (unknown location)

**URL:** <https://discuss.elastic.co/t/cannot-import-name-elasticsearch-from-elasticsearch-unknown-location/292991>\
**Category:** Elasticsearch\
**Created:** [December 27, 2021, 3:11pm UTC](https://discuss.elastic.co/t/cannot-import-name-elasticsearch-from-elasticsearch-unknown-location/292991 "2021-12-27T15:11:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Divyank\_Garg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_garg/32/99581_2.png) [@Divyank\_Garg](https://discuss.elastic.co/u/Divyank_Garg)\
**Post date:** [December 27, 2021, 3:11pm UTC](https://discuss.elastic.co/t/cannot-import-name-elasticsearch-from-elasticsearch-unknown-location/292991/1 "2021-12-27T15:11:57Z")

</div>

I have installed Elasticsearch library and trying to import Elasticsearch from Elasticsearch library but getting issue: cannot import name 'Elasticsearch' from 'Elasticsearch' (unknown location)

 ![Screenshot 2021-12-27 at 8.41.27 PM](https://us1.discourse-cdn.com/elastic/original/3X/8/a/8a96e9086240f48e192cc68035ca375552bb4db6.png)

---

<div class="post-metadata">

**Author:** ![Johnnycc1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/johnnycc1/32/26069_2.png) [@Johnnycc1](https://discuss.elastic.co/u/Johnnycc1)\
**Post date:** [December 28, 2021, 11:20am UTC](https://discuss.elastic.co/t/cannot-import-name-elasticsearch-from-elasticsearch-unknown-location/292991/2 "2021-12-28T11:20:27Z")

</div>

I don't think you need the first line.  
`import elasticsearch`

However the rest looks good assuming you have installed the Elasticsearch python client already.  
`python3 -mpip install elasticsearch`

And your not working in a folder called Elasticsearch or something similar. Python might be trying to import from the local folder.

---

<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:** [January 25, 2022, 11:20am UTC](https://discuss.elastic.co/t/cannot-import-name-elasticsearch-from-elasticsearch-unknown-location/292991/3 "2022-01-25T11:20:36Z")

</div>

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