ModuleNotFoundError: No module named 'kmodes' - python

I have tried installing it using pip install kmodes and it says that "Requirement is satisfied" but am not being able to import the library even after that.
The list of libraries doesn't have kmodes even after installing. Attaching screenshot for reference. What is happening here?
from kmodes.kprototypes import KPrototypes
ModuleNotFoundError: No module named 'kmodes'

Maybe your PIP is installing to the wrong version of python and the code you are running is being interreted by a later version
Try copying your python executable path and running this
C:\Users\username\AppData\Local\Programs\Python\Python39\python.exe -m pip install kmodes
Another reason is that kmodes did not install properly the first time
Try running this as an administrator
pip uninstall kmodes && pip install kmodes

Related

Can't install python libraries

got a new laptop (MacBook Air with Catalina) and installed python 3 thru Homebrew.
When trying to install and run some libraries in a jupyter notebook (also installed thru Homebrew) like:
!pip3 install pandas
and then:
import pandas as pd
I get the error:
ModuleNotFoundError: No module named 'pandas'
Same thing with numpy, matplotlib, bs4, etc. Even though when I rerun the !pip3 install something I get the message:
Requirement already satisfied: numpy in /usr/local/lib/python3.8/site-packages (1.19.2)
When I run:
!which python3
!which pip3
I get
/usr/local/bin/python3
/usr/local/bin/pip3
is there something I'm doing wrong?
I’ve catch like this problem
It helped me that:
Uninstall python
And install python
Then reboot system
I guess your Catalina use 3 version py3 this time
It’s need realias
I guess on Mac OS is better to use pip3 by terminal.
Problem seemed to be installing jupyter thru homebrew. Uninstalled it, and then reinstalled it with pip and now everything is working

Getting ImportError: No module named 'Crypto' after installation

I am getting ImportError: No module named 'Crypto' error when trying to run. I have installed pycrypto using pip install pycrypto and updated it also. Everything I have tried to far has been unsuccessful.
Tried:
reinstalling pycrypto,
updating both python and pycrypto
Any suggestions?
The error messages says, it does not able to find the module so please try to run below command,
#pip list -- # what does it show to you, if it would have installed successfully it will show you up there.
if "pip install pycrypto" doesn't work so try to download the source tar ball and try to install it from prompt.
pip download pycrypto
it will download tar.gz file.. so you can install using with pip install --no-index --find-links /path/to/some/dir/ pycrypto
for python3.5 version
python3.5 -m pip install pycrypto
this will install in python3.5 environment and after that you can able to import pycrypto module
Is python defined properly on your machine?
Make sure PATH environment variable has python's installation folder in it

Import Error: No module named requests

I know there are many posts on this, and I've tried using the solutions provided, but to no avail. I tried pip install requests and pip install requests --upgrade:
pip install requests --upgrade
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already up-to-date: requests in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
I then tried running pip install --upgrade pip, yet when I run my file I still get
Import Error: No module named requests
I am able to use requests in PyCharm, so I don't know what's causing this. Can someone please help?
You installed requests into a different Python installation. The /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages is the site-packages directory for the Mac OS X /usr/bin/python installation.
PyCharm is not currently configured to use that Python installation; check what Python is being used either by looking at your PyCharm settings, or by asking Python directly with:
import sys
print(sys.executable)
Note that PyCharm can handle package installations for you as well; rather than use the command line pip consider using PyCharm, as it'll use the currently configured Python installation in that case.
install package name "request" from pychram package setting. then it will be work fine.
If you are having this issue in Pycharm and you have configured your Pycharm to create projects in virtual environments, then you can use the Terminal in Pycharm to run the
pip3 install requests
to resolve this issue. This is by design to ensure you control dependencies.

ImportError using pip install on Mac OSX

I installed a module called mrjob using sudo pip install mrjob. When I start python and try to import it, I get ImportError: No module named mrjob.
Using iname, I find out that mrjob is installed in /lib/python2.7/site-packages/, while all my Python modules are in /usr/local/lib/python2.7/site-packages. So I add the new folder to my PATH with export PATH=/lib/python2.7/site-packages:$PATH.
But even after I do that, I still get ImportError. If I cd to /lib/python2.7/site-packages/ and start python from there, it imports the module correctly.
I also tried to uninstall the module:
> sudo pip uninstall mrjob
Password:
Cannot uninstall requirement mrjob, not installed
If I do:
>>> import site; site.getsitepackages()
['/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/site-python', '/Library/Python/2.7/site-packages']
The folder /lib/python2.7/site-packages/ isn't there.
== UPDATE ==
The following command worked
pip install --install-option="--prefix=/usr/local" mrjob
I can now import mrjob correctly. But I still don't understand what is going on.
I got this problem too. Cause python use the system pre-install python at
/Libarary/Python
But this python without pip. while I install pip, it will install at
/usr/local/Libarary/Python
My solution is install pip for the system by this:
sudo easy_install -U pip

pip setup and setting PYTHONPATH

I'm not experienced in Python, and I need the requests module.
I've tried installing it using pip install requests
The installation went successfully, but when I try to import the module, I get an error like "no module named requests".
Should I add the install location to PYTHONPATH? If yes, how can I find the location where pip installed the files? I don't know about virtualenv, and I am using Ubuntu.
You should install pip for python3 first
How to install pip with Python 3?
then with the pip-3.X install the required module.

Categories