Python, 'no module named {package}' error - python

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.

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

ImportError when using pip install

I tried installing 'pandas' and 'xlrd' using pip install but I get this error from python when I try and use the modules: ImportError: No module named xlrd. Same error when I use pandas. I have tried various methods from the internet to solve this issue including:
changing package permissions
using sudo pip install
adding PYTHONPATH export in the bash_profile file.
using pip3 because I have python 3
I even tried this approach https://stackoverflow.com/a/49602260, but in my case I already had the package location(which I got using pip show xlrd) inside the sys.path list.
None of the above approaches have worked for me.
Edit: I use VSCode as my IDE and I run my files through the inbuilt terminal.

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...

Getting ModuleNotFoundError in Conda environment even after package installation

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?

Modules that Have been installed in PIP not appearing in PyCharm via the import function

I have recently started learning Python using PyCharm on Windows 10. I am trying to use PIP to install modules (I have tried Pillow, Pygame and randomword). When I try to install these, PIP says that I was successful and the module comes up when I use Pip freeze. However When I try to import them into Pycharm using the from import function. The module is not found. I cannot locate the module in the LIB folder as well. What do I need to do to have these modules appear in python,
Many Thanks,
Did you make sure you installed the module with the right pip?
I mean, many people with have more than one python editor installed, and so, there will be multiple pips. If you installed a module with the pip from IDLE-3.8, the module will only be installed for that IDLE-3.8.

Categories