When trying to install any module through the Linux Ubuntu 16.04 LTS Linux operating system console on a VirtualBox virtual machine using the pip module, an Error Import error occurs.
Example:

pip install dm-sonnet Traceback (most recent call last): File "/usr/bin/pip", line 9, in <module> from pip import main ImportError: cannot import name main 

Tell me how to fix

    1 answer 1

     sudo -H pip3 install --upgrade pip sudo -H pip3 install --upgrade pipenv 

    This is still possible, if not as root.

     pip install --user dm-sonnet