0

I am having issues on Mac OS installing PyDictionary into a Django project. When I pip3 install PyDictionary it says Requirement already satisfied: when I enter the command pip3 freeze it shows me PyDictionary==2.0.1 is already installed.

But it can't find the module for some reason:

from django.shortcuts import render
from PyDictionary import PyDictionary

# Create your views here.
def index(request):
    return render(request, 'index.html')

def word(request):
    search = request.GET.get('search')
    dictionary = PyDictionary()
    meaning = dictionary.meaning(search)
    synonyms = dictionary.synonym(search)
    antonyms = dictionary.antonym(search)
    context = {
        'meaning': meaning,
        'synonyms': synonyms,
        'antonyms': antonyms
    }
    return render(request, 'word.html')

I get the error:

  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/natelampros/PycharmProjects/english_dictionary/englishdictionary/dictionary/urls.py", line 2, in <module>
    from . import views
  File "/Users/natelampros/PycharmProjects/english_dictionary/englishdictionary/dictionary/views.py", line 2, in <module>
    from PyDictionary import PyDictionary
ModuleNotFoundError: No module named 'PyDictionary'

I've looked and can not find out why it can't find the module. I've tried installing PyDictionary on vs code and in terminal and it says it's installed every time.

CSLAMPY
  • 1
  • 1
  • Does this solve your problem? [requirement already satisfied](https://stackoverflow.com/a/73398463/19290081) – Jamiu S. Oct 09 '22 at 22:26
  • maybe you have two Pythons installed and `pip3` installs module for one Python but you run code with other Python. Try `python3.10 -m pip install ...`, or `pip3.10 install ...` – furas Oct 09 '22 at 22:28

0 Answers0