Module Not Found, but Requirement already satisfied [duplicate] - python

This question already has answers here:
ImportError: No module named 'pygame'
(25 answers)
How to import pygame in visual studio code?
(4 answers)
Closed 1 year ago.
In my code I have:
'''import pygame'''
When I run:
ModuleNotFoundError: No module named 'pygame'
When I pip install pygame (also tried pip3 install pygame and pip3.7 install pygame):
Requirement already satisfied: pygame in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (2.0.1)
Really lost here any help appreciated.
python --version = Python 3.7.4
pip --version =
pip 21.2.4 from /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip (python 3.7)

While getting such error even after installing the required module, check for the following:
The python environment/ installation used by your IDE should be same as the environment where the module is installed.
Else, change the environment to the Python environment
paste the path to python.exe inside bin folder of your environment
And install the package again.
Specific for VS Code
Click on python followed by version number or venvin the bottom ribbon of the editor and add the path to interpreter or choose an existing interpreter you want to use.

Related

Why python didn't see nltk module? [duplicate]

This question already has answers here:
How do I use installed packages in PyCharm?
(14 answers)
Closed 4 months ago.
I cant run my programm because nltk module is missing but i just intstalled it and it just right here in the folder
I tried to reinstall my python, and tried to change python interpreter but nothing worked
How have you actually installed nltk?
You can check if it's actually installed with pip freeze.
What might be happening here is that you could have another version of python installed, so make sure that you actually call the same interpreter for checking and installing with pip, in your case E:/pythonProject1/Scripts/python.exe -m pip freeze and E:/pythonProject1/Scripts/python.exe -m pip install nltk

Can`t import pygame to VScode despite having it installed

I'm using pip 21.2.4 and python 3.9.7
I'm pretty sure I have pip installed since if I run pip --version in the terminal it gives me pip 21.2.4 from C:\Users\rohaan\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\pip (python 3.9)
If I run pip install pygame in the terminal I get Requirement already satisfied: pygame in c:\users\rohaan\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\site-packages (2.0.1)
Despite the requirement being satisfied when I import pygame I get ModuleNotFoundError: No module named 'pygame'
Does anybody know how to fix this?
It looks like you are not using the python interpreter which you have installed the pygame package.
You can execute this code to verify which python interpreter you are using:
import sys
print(sys.executable)
Then you can switch the python interpreter to which you have installed the packages or you need to activate the environment before you want to install the package in order to install the package to the right place.
This means you have multiple versions of python installed on your device, one has the module and the other tries to run the file, go to the control panel and check it out.

Unable to install pyodbc and win32API [duplicate]

This question already has answers here:
PyCharm doesn't recognize installed module
(23 answers)
Closed 1 year ago.
I am using Python 3.9.6 with Pycharm. I need to install the packages pyodbc and win32api. Though I have installed it, reinstalled it multiple times, it still says module not found. I have installed the MS build tools, tried with multiple versions of python such as 3.9.5 and 3.8, restarted pycharm invalidating caches. Changed the interpretes to virtual environment and the system interpreter. When i run the command pip install pyodbc, it says requirement already satisfied which means it is already installed.
See if pycharm is using another virtual environment

Can't install modules 'os' and 'os.path' [duplicate]

This question already has an answer here:
How to install the os module?
(1 answer)
Closed 27 days ago.
I am trying to install 'os' module and 'os.path' module on a red hat machine. I tries following commands.
pip install os
yum install os
But I keep gettin the following error
Could not find a version that satisfies the requirement os.path (from versions: )
No matching distribution found for os.path
I am able to install other modules using aforementioned command but not able to install these.
I need to install both os and os.path.
Using version python 3.4.3
Take a look into this extensive list of Python Library 3.4. If it's mentioned there that means it's already included in the original installation of Python. More specifically os.path
The reason you're getting this specific error because you're trying to install something that doesn't exist. The hint for that is os.path (from versions: ) meaning there isn't an external package that matches "os.path" or any proper version of it.
Try this command. It worked in my system.
pip install path.py

Python, Django with PyCharm. Message error: "No module named M2Crypto" How resolve? [duplicate]

This question already has answers here:
How do I use installed packages in PyCharm?
(14 answers)
Why isn't PyCharm's autocomplete working for libraries I install?
(2 answers)
Closed 4 years ago.
I received this message: "No module named M2Crypto"
I have already install M2Crypto with the command "pip install M2Crypto" and when I re-run it, I got the message: "Requirement already satisfied"
What's the problem with M2Crypto?
Thanks
ps:
I use Linux: 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:12:00 UTC 2013 i686 i686 i686 GNU/Linux, Pycharm and Python2.7 (/usr/bin/python2.7)
Maybe some interpreter option in PyCharm configuration for running the project?
First of all, verify that the version of pip is in line with your interpreter.
So for python2.7,
pip --version
should print something like
pip 6.0.8 from /usr/local/lib/python2.7/dist-packages (python 2.7)
depending on how you've installed it. The important part is in the end, where your interpreter ("python 2.7") should be shown.
Once you're sure to have the right pip-version, ensure your package is correctly installed. It should usually be installed in the directory printed out previously by pip (e.g. /usr/local/lib/python2.7/dist-packages/).
Assume you've already done this, what else can go wrong to make your interpreter not finding the 'M2Crypto' package?
python uses the PYTHONPATH environment variable for module lookups. So, there's the possibility, that your PYTHONPATH variable has been changed. Try running your program by adding the above-mentioned path to PYTHONPATH and either exporting it before running your webserver:
export PYTHONPATH=/usr/local/lib/python2.7/dist-packages/:$PYTHONPATH
# run your server here
or by prepending the same variable to your command:
PYTHONPATH=/usr/local/lib/python2.7/dist-packages/:$PYTHONPATH python <run-stuff-here>
This should make your program find the M2Crypto module.

Categories

Resources