Failed installing pycrypto with pip

I fixed same problem in linux running sudo apt-get install pythonX.X-dev before installing pycrypto. Replace pythonX.X with your python version e.g. sudo apt-get install python3.6-dev


In some cases it is a dependency issue. It can be solved as follows: for python2 run the following command: sudo apt-get install build-essential libssl-dev libffi-dev python-dev

For python3 run

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev


The solution was simple

just

    pip uninstall pycrypto
    pip install pycryptodome

And every should just work fine, it worked for me!