Search code examples
pythonpippycharmpackagepynput

Pycharm doesn't show pynput as package to install


My pycharm 2020-2.3 doesn't recognize pynput as a package for installation this is what it shows. I've been trying to get this to run.

import pynput
from pynput.mouse import Controller


def controlMouse():
     mouse = Controller()
     mouse.position = (10,20)

controlMouse()

But then i get this error message below.

ModuleNotFoundError: No module named 'pynput.mouse'; 'pynput' is not 
a package

it runs on other IDEs and pip says it's installed. Please help.


Solution

  • Okay. i was able to fix the issue with pycharm recognizing libraries by trying two different things one was toggling 'Use Conda Package Manager from conda' off. see here under python intrepreter. I then searched for the package pynput which i was able to install. The other was renaming the file ('shouldn't have named it as pynput.py).

    i also selected File > invalidate Caches/ restart > restart now. after i made these changes.