I was also not able to install the cv2 on Anaconda-Jupyter notebook which was running on Ubuntu on Google Cloud Platform. But I found the way to do it as below :
Please run the below command from your ssh terminal and follow the instructions:
sudo apt-get install libsm6 libxrender1 libfontconfig1
Once its installed please Open the Jupyter notebook and try to run the below command:
!pip install opencv-contrib-python
Please Note: I had tried to run below command:
"sudo python3 -m pip install opencv-contrib-python"
But it was showing me an error. But above command really worked for me.
Now just refresh your notebook page and check whether it is installed or not by running the import cv2 in your notebook.