0

I tried installing mysql-python in ubuntu but I remained unsuccessful, I was using Win10 before and never encountered this problem.

I used pip3 install MySql-python

I have encountered following error:

Using cached MySQL-python-1.2.5.zip (108 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j3febudn/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j3febudn/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-j3febudn/mysql-python/pip-egg-info
         cwd: /tmp/pip-install-j3febudn/mysql-python/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-j3febudn/mysql-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/tmp/pip-install-j3febudn/mysql-python/setup_posix.py", line 2, in <module>
        from ConfigParser import SafeConfigParser
    ModuleNotFoundError: No module named 'ConfigParser'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Shadow
  • 33,525
  • 10
  • 51
  • 64
Hemant Sah
  • 59
  • 1
  • 10
  • MySQL on its page has special module for Python. Maybe use it instead of `MySql-python` - See [connector/python](https://dev.mysql.com/downloads/connector/python/) - there is even version specially for Ubuntu 20.04. I use it with Linux Mint 19.3 based on Ubuntu 18.04 – furas Jul 12 '20 at 13:43
  • 1
    BTW: doc for [connector/python](https://dev.mysql.com/doc/connector-python/en/connector-python-example-connecting.html) - you can use it directly or in SQLAlchemy. – furas Jul 12 '20 at 13:49
  • @furas THankyou, That actually worked for me. – Hemant Sah Jul 12 '20 at 18:23

1 Answers1

1

This seems to be related to: Python 3 ImportError: No module named 'ConfigParser'

In short, your module is not python3 compatible, use another module, or use python2, but this is not recommended, since python2 is going deprecated.

JBen
  • 108
  • 4
  • I tried the solution you gave in above comment. But nothing is working. I am facing same error with MySql-python, mysqlpython. – Hemant Sah Jul 12 '20 at 12:52
  • Does your error message contain ```ModuleNotFoundError: No module named 'ConfigParser'``` like before? – JBen Jul 12 '20 at 13:03
  • Yes, it's same. Maybe I will have to use some other library, but I was used to this library. – Hemant Sah Jul 12 '20 at 13:15