nakagami/CyMySQL

Package requires Crypto module, but makes no mention of this.

skilly-lily opened this issue · 2 comments

While connecting to a local mysql instance, running in docker, I encountered this error. I checked through the pymysql docs and the readme provided here, and found no mention of pycrypto (or the more current pycryptodome) in any capacity, much less as a necessary package.

I checked the code, and it seems like it's not always needed, though I only took a quick look at it. GitHub does not support searching through forked repositories, so I cannot tell if it's used anywhere other than connections.py:535.

If it's always needed, then it should probably be added to setup.py as a dependency.
If it's not always needed, then it could be added to setup.py as an optional dependency.

In either case, I'd be happy to submit a patch to that effect.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/path/to/venv/xxx/lib/python3.7/site-packages/cymysql/__init__.py", line 84, in Connect
    return Connection(*args, **kwargs)
  File "/path/to/venv/xxx/lib/python3.7/site-packages/cymysql/connections.py", line 248, in __init__
    self._connect()
  File "/path/to/venv/xxx/lib/python3.7/site-packages/cymysql/connections.py", line 416, in _connect
    self._request_authentication()
  File "/path/to/venv/xxx/lib/python3.7/site-packages/cymysql/connections.py", line 513, in _request_authentication
    self._caching_sha2_authentication2(auth_packet, next_packet)
  File "/path/to/venv/xxx/lib/python3.7/site-packages/cymysql/connections.py", line 535, in _caching_sha2_authentication2
    from Crypto.PublicKey import RSA
ModuleNotFoundError: No module named 'Crypto'
```

Is your mysql server version 8.0 ?
MySQL 8.0 and insecure connection need pyCrypto

Add install step in README.rst