1

I have install fuzzywuzzy module and i can import in python shell when i import it in a jupyter notebook it gives error no module found.

>>> from fuzzywuzzy import fuzz
>>>'''

```import pandas as pd
import json
from fuzzywuzzy import fuzz```

```ModuleNotFoundError            
Traceback (most recent call last)
<ipython-input-2-a67086b59a14> in <module>
      1 import pandas as pd
      2 import json
---> 3 from fuzzywuzzy import fuzz
ModuleNotFoundError: No module named 'fuzzywuzzy'```
Nep_tune
  • 11
  • 1
  • 5
  • Compare `sys.executable` and `sys.path` in shell vs notebook. Are you running the same interpreter, with same site packages location? – Amadan Jul 17 '19 at 05:32
  • thanks Amadan You are right.shell Path = "C:\\Users\\gopesh\\AppData\\Local\\Programs\\Python\\Python37\\python.exe", Notebook Path = "['C:\\Users\\gopesh\\Anaconda3\\python37.zip', 'C:\\Users\\gopesh\\Anaconda3\\lib\\site-packages', 'C:\\Users\\gopesh\\Anaconda3\\lib\\site-packages\\win32', 'C:\\Users\\gopesh\\Anaconda3\\lib\\site-packages\\win32\\lib', 'C:\\Users\\gopesh\\Anaconda3\\lib\\site-packages\\Pythonwin', 'C:\\Users\\gopesh\\Anaconda3\\lib\\site-packages\\IPython\\extensions', 'C:\\Users\\gopesh\\.ipython']" how do i install in my notebook interpreter.... – Nep_tune Jul 17 '19 at 17:47
  • Not sure, I never used Anaconda. I think Anaconda should have its own `pip` or `pip3` in its `bin` directory, try to find it and use that to install stuff. – Amadan Jul 18 '19 at 02:02
  • Okay thanks again for your time.. – Nep_tune Jul 18 '19 at 12:11

2 Answers2

1

This error occurs a lot. I would recommend using a virtual environment and then doing pip install fuzzywuzzy This is the most optimal and sure fire solution. The following are the instructions for creating and activating a virtual environment with venv:

Mac OS & Linux: How To Setup Virtual Environment

1) After cloning the repo, cd into the repo and run the command: python3 -m venv venv

    This will create the virtual environment. Make sure to name it venv because the .gitignore file
    has been initialized to ignore it by default. 

2) Activate the virtual environment by running the following command: source venv/bin/activate

3) At any moment, you can run deactivate to leave the virtual environment.

Windows: How To Setup Virtual Environment

1) After cloning the repo, cd into the repo and run the command: python -m venv venv

    This will create the virtual environment. Make sure to name it venv because the .gitignore file
    has been initialized to ignore it by default. 

2) Activate the virtual environment by running the following command: venv\Scripts\activate.bat

    To activate the virtual environment inside of a code editor's bash, run: venv\Scripts\activate.ps1

3) At any moment, you can run deactivate to leave the virtual environment.

Zakariah Siyaji
  • 989
  • 8
  • 27
0

Compare sys.executable and sys.path in shell vs notebook. Are you running the same interpreter, with same site packages location? – Amadan Jul 17 '19 at 5:32

This was the answer for me! I have copied the sys.path results from my shell to assign sys.path within the notebook like this:

sys.path = ['list-of-paths-from-my-shell']

Then, it solved!

Bingo.