Quick and dirty solution for pip dependency errors is:

pip install --upgrade pymysql --ignore-installed pyasn1

The errors are:

pyasn1-modules 0.2.1 has requirement pyasn1<0.5.0,>=0.4.1, but you'll have pyasn1 0.1.9 which is incompatible.

is extremely often when you are trying to install new module, updating or upgrading pip and so on.

In this post:

In this post we will see a quick and easy solution for this error. The solution is to ignore dependencies in case that you don't need them or you don't care about dependencies.

You can be interested in these:

Quick solution for incompatible modules

Let say that I need to install: pymysql with pip:

pip install pymysql

Entering the command I get this error:

pyasn1-modules 0.2.1 has requirement pyasn1<0.5.0,>=0.4.1, but you'll have pyasn1 0.1.9 which is incompatible.

Trying to update, uninstall or upgrade the module ends in another error:

Cannot uninstall 'pyasn1'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

So in order to install pymysql you can ignore pyasn1 as dependency. This can be done with command:

pip install --upgrade pymysql --ignore-installed pyasn1

this result in:

Installing collected packages: pymysql, pyasn1
Successfully installed pyasn1-0.4.2 pymysql-0.8.0

Uninstalling and Reinstall modules with pip

Let say that this time module idna is causing the same problem. Then you can uninstall it and reinstalled by:

pip uninstall idna
pip install idna

you may need also to upgrade your pip:

pip install --upgrade  pip