I use VS Code as my main code editor while I'm compiling the code in multiple files it keeps giving me this error for multiple models for example
ModuleNotFoundError: No module named 'pandas'
ModuleNotFoundError: No module named 'mysql'
I reinstall these two packages using pip install pandas and pip install MySQL on my cmd but both of them give me this message requirement already satisfied which mean that both of the two libraries are installed
ps I use python 3.8.1 32-bit as my main interpreter path on VS code
how can I fix this issue?
If you are using virtual environment for your python project in the vscode, then you need to define the path of python(virtual environment) for your workspace.
So in your project, there is .vscode/setting.json where you need to add following.
{
"python.pythonPath": "/path/to/project/project_name/bin/python"
}
After that you can restart your project.
Related
I got an error with this code:
from td.client import TDClient
Error message:
ModuleNotFoundError: No module named 'tdclient'
and I installed tdclient through the command line:
pip install td-client
and it was successfully installed.
If you are using virtual environments (venv), ensure you installed the module in the right venv.
If you are indeed using the right virtual env, or you're not using virtual environments at all, there may be a typo in the import statement.
File "E:\nvn\Hacker_rank\Zoom_clone\main.py", line 4, in
from vidstream import *
ModuleNotFoundError: No module named 'vidstream'
In Pycharm by default you are with in a virtual environment and you would have already installed the specified/dependent module. But that module will only be installed into that virtualenv. So when you are running from command line that module wont be available.
So either you could point to the same virtualenv or you could create a new virtual environment and install the specific module into it and run the code.
Please let me know if it helps.
I successfully installed PIL.
But when create new project I can`t import PIL.
Error:
(ModuleNotFoundError: No module named 'PIL')
I am using Python 3.8 and tkinter.
Usually this happens when the python environment you're running is not the same environment that pip is updating. It's pretty common if you have more than one python installation.
Make sure that your OS environment variables for pip and python are directed toward appropriate script files of a particular install.
I downloaded the pandas package to my computer using the pip install. When I try to import pandas as pd into Pycharm I get the following error message:
ModuleNotFoundError: No module named 'pandas'
I know I have downloaded the package, but how do I get Pycharm to recognize that I have downloaded the package?
You almost certainly don't have your interpreter set correctly.
Go to preferences -> project -> project interpreter and make sure that the version of Python matches the environment where you did you pip install or conda install.
Also, if you aren't sure which Python you're using you can always run which python.
I wrote the following python line import scipy.io then I went to that folder's location in the cmd:
C:\Users\me\PycharmProjects\test>
and typed pip install scipy apparently it installed the dependencies then I went back to pycharm, ran my code and got error
ModuleNotFoundError: No module named 'scipy'
I'm just starting off with python I'm on windows 10.
PyCharm has a GUI for managing which python installation you use and packages installed:
https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html