4

Steps Followed:

  1. Downloaded Elastic Search from https://www.elastic.co/downloads/elasticsearch
  2. Installed and it is running in my localhost:9200
  3. opened CMD as admin and Ran pip install elasticsearch and got below result
    Requirement already satisfied: elasticsearch in c:\users\cpatil\python\python37\lib\site-packages (7.10.1)
    Requirement already satisfied: urllib3<2,>=1.21.1 in c:\users\userid\python\python37\lib\site-packages (from elasticsearch) (1.26.2)
    Requirement already satisfied: certifi in c:\users\userid\python\python37\lib\site-packages (from elasticsearch) (2020.12.5)
  4. Opened Jupyter Notebook and ran from elasticsearch import Elasticsearch Got the below error
    ModuleNotFoundError Traceback (most recent call last)
    ModuleNotFoundError: No module named 'elasticsearch'

I explored that we should add some paths from other posts here but I am not understanding exactly the issue here. User Variables for python is path : C:\Users\userid\Python\Python37**

I am not understanding the issue here

Chaitanya Patil
  • 183
  • 2
  • 16
  • Try with `pip3 install elasticsearch`, maybe? Often `pip` installs packages for python2 – Dawid Gacek Jan 04 '21 at 17:45
  • Sorry, I missed that these requirements are already satisfied in proper directory. So the other idea is to check which environment is JupyterNotebook using. – Dawid Gacek Jan 04 '21 at 17:46
  • @DawidGacek I saw that if I import from Command Prompt it runs. But if I run in jupyter notebook, I get an error, Is there a way where I can link PIP to Jupyter Notebook. If I install using pip, I should be able to use it even in the Jupyter – Chaitanya Patil Jan 04 '21 at 17:48
  • You are right if you have only one Python environment installed. If you could check linked post, please confirm if version of Python you use in Jupyter, is the same as you installed elasticsearch to. https://stackoverflow.com/questions/37085665/in-which-conda-environment-is-jupyter-executing – Dawid Gacek Jan 04 '21 at 18:11
  • Also what came to my mind, you can check `import os os.environ['PYTHONPATH']` if it's the python env that you want :) – Dawid Gacek Jan 04 '21 at 18:23

0 Answers0