No module named 'mlxtend'
I am unable to install the mlextend package in Jupyter Python3 notebook
I have tried pip install mlxtend or pip3 install mlxtend, but either it shows syntax error for some reason on Python2 or it tells to try on the command line in python3. I have tried installing it on command line but it shows "ERROR: Could not find a version that satisfies the requirement mlextend (from versions: none) ERROR: No matching distribution found for mlextend"
from mlxtend.frequent_patterns import apriori from mlxtend.frequent_patterns import association_rules ModuleNotFoundError Traceback (most recent call last) <ipython-input-3-73c97be96c5f> in <module>() ----> 1 from mlxtend.frequent_patterns import apriori 2 from mlxtend.frequent_patterns import association_rules ModuleNotFoundError: No module named 'mlxtend'`enter code here` 7 Answers
You need to use the following command:
pip install mlxtend You are currently trying to install mlextend (which does not exist) instead of mlxtend.
π For more insights, check out this resource.
I had the same issue recently. What worked was importing the module first, and then getting the components:
import mlxtend from mlxtend.frequent_patterns import apriori from mlxtend.frequent_patterns import association_rules To add to the above possible solutions. Under Anaconda/Miniconda environments it is also possible to use conda. Among the various options under the following worked for me
π Discover more in this in-depth guide.
conda install -c conda-forge mlxtend
'pip install' works on Python2,if you install for Python3, use pip3 install mlxtend instead
Use !pip install mlxtend. It will definitely work.
If you encounter difficulties with importing, follow these steps for resolving the issue:
Install the package:
!pip install mlxtendUpgrade the package without dependencies:
pip install mlxtend --upgrade --no-depsRestart the kernel:
After completing the installation and upgrade, restart the kernel and attempt to import mlxtend again. This should address any import-related challenges you may be facing.
#Import the libraries #To install mlxtend run : pip install mlxtend import pandas as pd from mlxtend.preprocessing import TransactionEncoder from mlxtend.frequent_patterns import association_rules,apriori