close

[Solved] ImportError: No module named ‘yaml’

Hello Guys, How are you all? Hope You all Are Fine. Today I am Just trying to run my script and I am facing following error ImportError: No module named ‘yaml’ in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How ImportError: No module named ‘yaml’ Error Occurs ?

I am Just trying to run my script and I am facing following error.

 import yaml
 ImportError: No module named 'yaml'

How To Solve ImportError: No module named ‘yaml’ Error?

  1. How To Solve ImportError: No module named 'yaml' Error ?

    To Solve ImportError: No module named 'yaml' Error To solve this error all you need to do is just install pyyaml using this command. pip install pyyaml.

  2. ImportError: No module named 'yaml'

    To Solve ImportError: No module named 'yaml' Error To solve this error all you need to do is just install pyyaml using this command. pip install pyyaml.

Solution 1: Install pyyaml

To solve this error all you need to do is just install pyyaml using this command.

pip install pyyaml

Solution 2: uninstall and then reinstall pyyaml

First of all you need to uninstall python-yaml and its dependencies with the help of this command.

sudo apt-get remove python3-yaml
sudo apt-get remove --auto-remove python3-yaml

Then Just Purge config/data too

sudo apt-get purge python3-yaml
sudo apt-get purge --auto-remove python3-yaml

Now reinstal pyyaml

sudo pip3 install pyyaml

Solution 3 : use virtualenv 

pip3 install virtualenv

Then

virtualenv --python=python3 venv

Now Activate

source venv/bin/activate

installl pyyaml

pip install pyyaml
python env/common_config/add_imagepullsecret.py

Summary

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment