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
.
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
'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 mlxtend
Upgrade the package without dependencies:
pip install mlxtend --upgrade --no-deps
Restart 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