title: Pymysql failing to import into python3
body: <p>I am working with a LAMP install from GCP on a debian 9 machine.
  <a href="https://i.stack.imgur.com/dDzA0.png" rel="nofollow noreferrer">Default GCP Lamp settings</a> <a href="https://cloud.google.com/solutions/web-hosting" rel="nofollow noreferrer">https://cloud.google.com/solutions/web-hosting</a></p>
  <p>I am having some dependency error trying to import pymysql into a project. I don't fully understand the error, or exactly what I am missing. This is the error I am getting:</p>
  <pre><code>    &gt;&gt;&gt; import pymysql
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/home/philip_plachta/.local/lib/python3.5/site-packages/pymysql/__init__.py&quot;, line 59, in &lt;module&gt;
      from . import connections  # noqa: E402
    File &quot;/home/philip_plachta/.local/lib/python3.5/site-packages/pymysql/connections.py&quot;, line 206
      ):
  </code></pre>
  <p>Here are the python packages I currently have installed</p>
  <pre><code>~$ python3 -m pip list
  DEPRECATION: The default format will switch to columns in the future. You can use --format= 
  (legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
  certifi (2020.12.5)
  chardet (4.0.0)
  connect.py (0.4.2)
  cryptography (1.7.1)
  idna (2.10)
  keyring (10.1)
  keyrings.alt (1.3)
  mysql-connector-python (8.0.23)
  pip (9.0.1)
  protobuf (3.15.3)
  pyasn1 (0.1.9)
  pycrypto (2.6.1)
  pycurl (7.43.0)
  pygobject (3.22.0)
  PyMySQL (1.0.0)
  python-apt (1.4.3)
  pyxdg (0.25)
  requests (2.25.1)
  SecretStorage (2.3.1)
  setuptools (33.1.1)
  six (1.10.0)
  unattended-upgrades (0.1)
  urllib3 (1.26.3)
  wheel (0.29.0)
  </code></pre>
  <p><a href="https://i.stack.imgur.com/4WPok.png" rel="nofollow noreferrer">Python3 import Error</a></p>
  <p>Below is roughly what I have tried. Its gotten a little bit messy because I've tried many things and uninstalled things and reinstalled them and so on. I am not opposed to starting again from scratch, but if I can get a little direction from someone with more experience than me it would be greatly appreciated!</p>
  <pre><code>sudo apt-get install python3-pip
  sudo apt-get install python3-pymysql    
  sudo python3 -m pip install Pymysql
  sudo python3 -m pip install mysql-connector-python
  </code></pre>
  <p><strong>Edit / Solution</strong></p>
  <p>snakecharmerb offered the advice of using sudo apt install python3-pymysql. This fixed it for me on a new instance of the GCP Lamp Server. I couldn't get (gave up) to work on the other one. I'm assuming something I installed or uninstalled messed something up as snakecharmerb is suggesting, but it's not worth the time for me to try to find it when I can make a new server and just do apt install python3-mysql from the start.</p>
  <p>Thank you.</p>
  <p><strong>Edit Edit</strong>
  Here is the process I followed on the new server that seemed to set things up correctly for me</p>
  <pre><code>FROM THE START:
  (First Goal is to access mysql from my local machine)
      sudo apt update
      sudo apt install php7.4-mbstring -y
      
  (Create a mysql user)
      sudo mysql -u root -p
      CREATE USER 'username'@'%.%.%.%' IDENTIFIED BY 'password';
      GRANT ALL PRIVILEGES ON *. * TO 'username'@'%.%.%.%';
      
  (Open to the outside world)
      https://phoenixnap.com/kb/mysql-remote-connection
      Also had to create an ingress rule to allow sql to be accessed (via firewall in gcp) on 0.0.0.0/0 on port 3306
  
  (Then...)
      sudo apt update
      sudo apt list --upgradable
      sudo apt upgrade
      
  (Second goal is to allow my scripts to run on the machine)
      sudo apt install python3-pip -y
      sudo apt install python3-pymysql -y
      sudo apt install python3-mysql.connector -y
  </code></pre>