Keyboard module installed but not detected - python

I am on MacOS and have installed the Keyboard module. It took a while to install the first time, but eventually it finished and, when I try running my script in Pycharm, I get ModuleNotFoundError: No module named 'keyboard'.
The first time I installed it was within Terminal with pip3. After that I tried with Git Clone and it told me that Keyboard was alredy installed. I know this to be correct because when I enter help("modules") into a Python window, it shows up on the list.
Edit: I have also tried restarting Pycharm

The problem is most probably in PyCharm's interpreter. You may try to reset the interpreter to your latest python3.
In this link (https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html), please see the section "Changing the project interpreter in the project settings".
Hope it works!

Related

How to I fix the “ModuleNotFound” error when importing PyQt5? [duplicate]

I installed bottle on Python 3.4 with pip install. In the terminal, when I do:
$ python3.4
>>>import bottle # shows no import error
>>>
but when I do it in PyCharm, it says:
import bottle ImportError: No module named 'bottle'
in your PyCharm project:
press Ctrl+Alt+s to open the settings
on the left column, select Project Interpreter
on the top right there is a list of python binaries found on your system, pick the right one
eventually click the + button to install additional python modules
validate
In some cases no "No module ..." can appear even on local files. In such cases you just need to mark appropriate directories as "source directories":
The settings are changed for PyCharm 5+.
Go to File > Default Settings
In left sidebar, click Default Project > Project Interpreter
At bottom of window, click + to install or - to uninstall.
If we click +, a new window opens where we can decrease the results by entering the package name/keyword.
Install the package.
Go to File > Invalidate caches/restart and click Invalidate and Restart to apply changes and restart PyCharm.
Settings:
Install package:
I am using Ubuntu 16.04. For me, it was the incorrect interpreter, which was by default using the virtual interpreter from the project.
So, make sure you select the correct one, as the pip install will install the package to the system Python interpreter.
PyCharm 2019.3, my solution is below:
For me, none of the above worked, and curiously even within one file some imports worked, some didn't:
from folder1.folder2.folder3.my_python_file import this_function # worked
from folder1.folder2.folder3.my_python_file import that_function # didn't work
Follow the above advice, but if it doesn't fix it additionally, (in PyCharm) click File >> Repair IDE and confirm all the 6 steps one after another.
I had virtual env site package problem and this solved it:
In the case where you are able to import the module when using the CLI interpreter but not in PyCharm, make sure your project interpreter in PyCharm is set to an actual interpreter (eg. /usr/bin/python2.7) and not venv (~/PycharmProject/venv/...)
I had the same problem, I tried all fixes like installing from the project interpreter and installing from python console, nothing worked. What worked was just going to the project folder from the terminal and installing it from there.

VS Code doesn't see the installed modules

For some reason VS Code asked me to choose the default program for running code, I missed and chose NotePad. When I would hit "run" all it would do is open Notepad. Then I changed the default app to VS Code (in Windows settings), and nothing would happen after hitting "run".
I reinstalled VS Code. Now it doesn't see the installed modules (from PyPi):
ModuleNotFoundError: No module named 'pandas'
The modules are installed and were seen in the past (before I accidentally changed the settings).
You need to select the correct python interpreter version and try importing pandas again. If it doesn't work then you need install pandas using python version used by your VS Code. You can do this by opening terminal in VS Code and executing the following command
python3 -m pip install pandas

PYTHON-DOTENV: not working when running from vscode fun button

Hello I have a weird situation where I run my python code from VScode run button, which brings me into Python terminal in VScode, I hvae this error message.
ModuleNotFoundError: No module named 'dotenv'
But if I run the same code in a regular terminal in VScode not Python terminal, I can run the code no error regarding dotenv.
Can you please explain why it is happening?
thank you
Next time, please provide more information, be more clear, and would be better to attach some pictures. Otherwise, it's hard to understand what's your mean, and the people hard to give you suitable suggestions.
I guess the problem you meet just because you run your code with a different environment. The environment which you run across the problem because you haven't installed the 'dotenv' package. It looks like you had installed the package in your global python environment, but you haven't installed the package in your virtual environment. You can add this code in your python file to distinguish which python, which environment you are using:
import sys
print(sys.executable)
If I am right, then you just need to activate your virtual environment(Ctrl+Shift+`), and run the command "pip install dotenv". Before install, you should check which pip you are using, through the command "pip --version". Be sure you had installed the package into your virtual environment.

Pycharm win32api module install Error: Non-zero exit code (1)

so i got this problem when I try to: import win32api on my Pycharm project.py code. I got this error: Non-zero exit code (1)
I also tried with pypiwin32 and I still got the same error.
What is strange is when I executed the pip install pypiwin32 command on my CMD the instalation of pypiwin32 worked. But it still doesnt work on Pycharm. Thanks for the help
Looks like you're having trouble finding the win32api module.
Don't worry. I will help you solve this issue.
First, if you are using virtualenv, please make sure you have activated your environment.
If you don't know how to activate, please refer these links below:
How to activate virtualenv?
Activate venv (Python 3.7.2) for Windows [duplicate]
Second, when you create the project, please choose New environment using Virtualenv.
Then select Inherit global site-packages and Make available to all projects and press Create button.
This is a screensnap for reference.
Third, you need to edit configuartions.
Like this screensnap shows below, you need to choose .py file by selecting Script Path.
Finally, after everything is configured, it can work well.

ModuleNotFoundError: No module named 'pymc'

I am trying to us 'pymc' to run my code however i have a problem with it
first , i use anaconda to manage my pycharm , my anaconda show i have successfully install 'pymc'
and then i try to import the module to my project so does my pycharm shows 'pymc' have successfully installed
enter image description herecheck pycharm have numpy module
watch this https://youtu.be/dxwB8KBLMcs and follow steps form 0.51
You are running the wrong python interpreter in your command line. According to your PyCharm settings, your packages are installed for "D:\Anaconda\python.exe" and that is the python.exe that you should be calling. But according to your console output, executed interpreter is in another path.
In PyCharm, go to "Run" > "Edit Configurations" and make sure that the "Python interpreter" configuration there is also set to the one in "D:\Anaconda".
There also seems to be an issue that may be caused by PyCharm about the project settings. If the solution above does not work try the solution explained here:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000164624-SOLVED-pycharm-seem-to-fail-to-add-to-PYTHONPATH

Categories