ImportError: No module named redis ( Stepwise Fix)

No module named redis featured image

ImportError: No module named redis error comes if redis module is not installed. Wrongly set path of redis also cause the same error. The easy fix for this error is to reinstall the redis module. This reinstalling can also solve the problem of incompatibility over an older version of Redis module.

 

No module named redis ( Steps) –

As I have already mentioned at the beginning of the article to reinstall the redis module. In this section we will look into various alternative methods of installing redis python module.

 

Method 1: pip package manager

This is mostly preferred and easiest way to install the Redis module. It(pip)  is a generalized way of installing every python module. All we need to follow the below command.

pip install redis

For Linux OS, You may use sudo before the above command.

sudo easy_install redis

 

Method 2: Using Source Code

 

Another way to install the Redis python module is by using source code. You need to download the source code from Github repo of redis. Once you download the code. Then we need to change the directory for redis-py. Once you are in redis-py directory, Use the setup.py file for installation.

git clone https://github.com/andymccurdy/redis-py
cd redis-py
sudo python setup.py install

It will reinstall the Redis module. That will probably fix the error ImportError: No module named redis.

 

Method 3: Using easy_install –

This is the third way to install the Redis module. It is as simple as the pip package manager. All we need to use the below command.

easy_install redis

Like pip, For the Linux platform, we need to add sudo before the same command. Actually, sudo gives the admin control.

sudo easy_install redis

Conclusion –

I hope now you have understood the way to fix the error “ImportError: No module named redis”. Still, if you have any confusion or you stuck somewhere, please comment below in the comment box. We will definitely help you out.

Thanks
Data Science Learner Team

Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for signup. A Confirmation Email has been sent to your Email Address.

Something went wrong.

Meet Abhishek ( Chief Editor) , a data scientist with major expertise in NLP and Text Analytics. He has worked on various projects involving text data and have been able to achieve great results. He is currently manages Datasciencelearner.com, where he and his team share knowledge and help others learn more about data science.
 
Thank you For sharing.We appreciate your support. Don't Forget to LIKE and FOLLOW our SITE to keep UPDATED with Data Science Learner