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`

You need to use the following command:

pip install mlxtend

You are currently trying to install mlextend (which does not exist) instead of mlxtend.

3

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

conda install -c conda-forge mlxtend

'pip install' works on Python2,if you install for Python3, use pip3 install mlxtend instead

2

Use !pip install mlxtend. It will definitely work.

If you encounter difficulties with importing, follow these steps for resolving the issue:

  1. Install the package:

    !pip install mlxtend
    
  2. Upgrade the package without dependencies:

    pip install mlxtend --upgrade --no-deps
    
  3. 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.

1
#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
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.