Getting ModuleNotFoundError in Conda environment even after package installation - python

I have Python 3.6 with my Anaconda env. The h2o package is already installed as shown below but still getting error while importing it.
As shown in the above snapshots, no module found error appears! Any ideas what is going wrong?

Related

ModuleNotFoundError: No module named 'mysql' continuously occuring in VS Code despite multiple attempts to resolve

I seem to be facing this error continuously despite:
Installing the mysql-connector via "python -m pip install mysql-connector-python"
Installing the MySQL package via "pip install MySQL"
I have confirmed that I have installed the package as it says "Requirement already satisfied everytime I run it again in the terminal". Additionally, I have tried installing and reinstalling the package as well.
But all the results are the same. Each time I run my script and try to "import mysql.connector", I always get the ModuleNotFoundError: No module named 'mysql' error
Would greatly appreciate some help. Thank you very much
Do you use virtual environments? If it is a virtual environment, please copy the contents in the expansion package folder of the virtual environment to the package folder under python.
If you have two versions of Python in your system, you may also encounter this problem. "CTRL+SHIFT+P" and choose the correct interpreter.
You can use the following method to check and see where pip installed the package:
pip show MySQL

Adding libraries in Spyder

I installed the libraries I needed by using these commands below:
conda install matplotlib
conda install numpy
I see the '# All requested packages already installed.' in terminal. But when I try to run the code again, I get this warning: ModuleNotFoundError: No module named 'matplotlib.pylot'
Can somebody help me how to fix this problem?
This is likely occurring because the environment in which you installed the packages is not the one set as interpreter in spyder. See how to change interpreter in spyder here

Own installed package not available in Spyder

I'm beginner in python, and I have to maintain a python code, which imports a self-made package.
I am able to install this package with pip, but somehow the Sypder(pyhton 3.9) does not accept it.
The error is: "ModuleNotFoundError: No module named 'myModule'
If I type the following command into the IPython console, then it says that the package is already installed.
pip install d:\MyFolder\myModule-0.2.0-py3-none-any.whl
Result:
Processing d:\MyFolder\myModule-0.2.0-py3-none-any.whl
myModule is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel.
Note: you may need to restart the kernel to use updated packages.
I already tried to solve this problem based this article: Spyder_modulenotfound
The packge is present in the Anaconda3 installation folder: d:\Anaconda3\Lib\site-packages\myPackage-0.2.0.dist-info\ and I added this folder into the PYTHONPATH manager tool. Already restarted the Spyder many times, still no change.
What am I missing? Please help...

Python, 'no module named {package}' error

I'm trying to use a package I installed using pip and it got installed in C:\Program Files\Python\Python38\Lib\site-packages, but when I import it in my IDE I get an error saying No module named instabot. I have had this error before and I'm unsure of what is happening
The problem might be that you are using a virtual environment in your IDE. If you using PyCharm, consider taking a look at this link.
Try pip or pip3 installing it in the right environment depending on your python version.

Missing required dependencies ['numpy'] for anaconda ver5.3.1 on pycharm

I just installed anaconda ver5.3.1 which uses python 3.7.
I encountered the following error;
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
I have upgraded numpy, pandas to the latest version using conda but the same error appears. To fix this problem, I have to downgrade to an older anaconda version which uses python 3.6
I am using Windows 10.
EDIT: I just discovered this problem is more related to pycharm than anaconda. I got this error while running pycharm in debug mode. However, when I run the same python script in Anaconda prompt console, there is no error.
What are some possible pycharm settings I should check to fix this problem? Are there ways to configure pycharm to output more verbose error messages?
It's a known issue in PyCharm https://youtrack.jetbrains.com/issue/PY-32366
For a workaround you can define the correct PATH in a run configuration in PyCharm (get the value by activating the conda env in the terminal and echo %PATH%).
Your pycharm created a new environment for your project I suspect. Maybe it copied across the anaconda python.exe but not all the global packages.
In pycharm you can go to the project properties where you can see a list of all the packages available, and add additional packages. Here you can install Numpy.
File --> Settings --> Project: --> Project Interpreter

Categories