python – ImportError: No module named yaml

python – ImportError: No module named yaml

pip install pyyaml

This should serve the purpose

Solution 1: install python 3.6(or use pyenv to manage py version) and ln python3 to it

export $PYPATH=`which python3`
wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
tar -Jxf Python-3.6.5.tar.xz
cd Python-3.6.5/
./configure && make && make altinstall
rm $PYPATH
ln -s `which python3.6` $PYPATH
python3 -m pip install pyyaml
python3 env/common_config/add_imagepullsecret.py

Solution 2: use virtualenv (or python -m venv)

pip3 install virtualenv
virtualenv --python=python3 venv
source venv/bin/activate
pip install pyyaml
python env/common_config/add_imagepullsecret.py

Solution 3: use python-poetry or pipenv

https://github.com/python-poetry/poetry

https://github.com/pypa/pipenv

python – ImportError: No module named yaml

Try the follwoing:
1. uninstall python-yaml and its dependencies.

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

Purging your config/data too.

$ sudo apt-get purge python3-yaml
$ sudo apt-get purge --auto-remove python3-yaml
  1. Install pyyaml

    $ sudo pip3 install pyyaml

this worked for me.

Leave a Reply

Your email address will not be published. Required fields are marked *