Spacy

Modulenotfounderror: no module named ‘click._bashcomplete’ ( Fix it )

Modulenotfounderror: no module named ‘click._bashcomplete’  error occurs because of the incompatibility between click module and spacy module.  Basically, the spacy dependency file has specific requirements for the click version. In that case, if we somehow upgrade the click module or downgrade it after installing spacy, The interpreter throws the same error.

 

Modulenotfounderror: no module named ‘click._bashcomplete’ ( Solution ) –

As we already explained the root cause ( Incompatibility between click and spacy version )for the above error. In this section, we will explore the easiest way to fix the same.

Solution 1:  Downgrade the click version & Installing Exit Module –

We can fix the error by downgrading the current click package version to remove the incompatibility. It is because spacy works fine with a lower version of click ( 7.0 or less ).  The only thing we need to take care of is to install Exit module immediately after the same. We can use the pip package manager for downgrading click and installing the Exit module. Here is the command for the same.

pip install click==7.0
pip install exit
Modulenotfounderror no module named ‘click._bashcomplete’

Solution 2: Reinstalling Spacy after uninstalling the click module –

As you know that every package has its own dependencies which the package manager installs while installing that particular package. The same happens with Spacy If any incompatible version overrides the required version of click we get this error. Hence if uninstall the existing click version and then reinstall the same spacy version. The package manager will install the compatible version only. Also to do the uninstall and install of click and spacy, we can use the pip package manager. Here is the command for the same.

pip uninstall click==7.0
pip install spacy
spacy installation

Actually, this article is not only about no module named ‘click._bashcomplete’  error. But the same base concept you can apply to fix several similar errors in day-to-day development. If you need more clarity on the same topic, please comment back to us.

Thanks 

Data Science Learner Team