"No Module Named Mouse" error though mouse is installed - python

my code is having an issue in which when i run the program it gives the error message :
ImportError: No module named 'mouse'
this happens even though the module is installed???
Code below:
import mouse
print(mouse.get_position())

If you can't use the module globally, please try to install it and use the module using a virtual environment as an example you can use anaconda.

If you are using IDE like PyCharm make sure you download the package on the IDE.
In pycharm go to Setting->Python Interpretor->Click + ->search your package name (in this case mouse) -> install the package

Related

Why Python does not recognize "kivy" module for me?

After I install the "kivy" python module, the python console and IDEs don't recognize it as a module, as if it doesn't exist.
ModuleNotFoundError: No module named 'kivy'
I do the installation normally like any other. I reinstalled the module several times and looked for all possible solutions, but nothing. Also, pip list and pip3 list tells me the module is there. What should I do?
When I completely reinstalled the system the problem was solved.

Module importing works in python console (pycharm) but not works on terminal

Hi i'm recently working on a module in python (package named pykiwoom)
I installed a module in conda 32-bit environment pip install pykiwoom and tried to import this
from pykiwoom.kiwoom import Kiwoom
This works perfectly fine when I execute this in python console in pycharm
However, when I try this in terminal error occurs
ModuleNotFoundError: No module named 'pykiwoom.kiwoom'; 'pykiwoom' is not a package
internal structure of package pykiwoom looks like this
pykiwoom
init.py
kiwoom.py
parser.py
Can somebody tell me why this error occurs?
I think where you install your package is important in your case. You can check the packages installed using pip list in terminal, and check if you find it there.
This solution provides overview of how to setup your files as packages and modules.
Nevertheless, I think if you install your package in the terminal using pip, you could possibly access it.

SpeechRecognition module not importing into program

So I was working on an AI voice assistant and I tried importing the speech_recognition module into my code but it didn't work.
I installed the module using:
pip install SpeechRecognition
It got installed correctly.
Then when I tried to import the module using:
import speech_recognition as sr
The name of the module wasn't auto suggested or highlighted while typing so I'm assuming the interpreter was unable to find the module.
And none of the functions I called got highlighted either and gave an error on execution. Any idea how I can fix this?
I think there is two ways of trying to solve this
1- Try Restarting your Editor
2- Try this:
python -m pip install SpeechRecognition
then restart the Editor.

Pycharm and FEniCS

I have installed Fenics using this
https://fenics.readthedocs.io/projects/containers/en/latest/introduction.html#running-fenics-in-docker
and everything works so far.
Now I wanted to use Pycharm to try to write a program using fenics. It starts with
from fenics import *
and I get the error
ModuleNotFoundError: No module named 'fenics'.
I use Python 3.9, PyCharm 2021.1.2.
Can the problem come from some wring directories?
Make sure you've installed fenics on your local machine, as well as added it to your Pycharm package library.
https://fenics.readthedocs.io/en/latest/installation.html
https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html

Downloaded package ImportError

I have recently installed python 2.17.14 to use a package which I installed in the command prompt with:
python -m pip install packageName
However, whenever I try to use it with a script provided by the package authors, I get Import Errors:
ImportError: cannot import X from YX
ImportError: attempted relative import with no known parent package.
I don't know what I'm doing wrong, as I am really new to Python. Does anyone have any ideas?
The package is called neurodesign and I downloaded the try out script from the official website "neuropowertools.org"
Best,
Max
In case anyone (who is also new to python^^) fails ridiculously at this task as well: I had to manually install all the modules used within this package for it to work as they weren't installed automatically.

Categories