1

I use python vitrualenv and when I want to install any packages by pip install <package name> I take that error:

ERROR: Command errored out with exit status 1:
     command: /home/user/project/some_project_name/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sifdsjjx/MySQL-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-sifdsjjx/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-sifdsjjx/MySQL-python/pip-egg-info
         cwd: /tmp/pip-install-sifdsjjx/MySQL-python/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-sifdsjjx/MySQL-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/tmp/pip-install-sifdsjjx/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.

I use python 3.7.0 pip 20.0.2

phd
  • 82,685
  • 13
  • 120
  • 165
Maksym Shchedrov
  • 59
  • 1
  • 2
  • 8
  • https://stackoverflow.com/search?q=%5Bmysql-python%5D+ModuleNotFoundError%3A+No+module+named+ConfigParser – phd Apr 30 '20 at 18:44

2 Answers2

6

Try to upgrade setuptools:

pip install --upgrade setuptools

UPDATE

As mentioned in the comments, you are attempting to install MySQL-python which is a very old package (last release was made back in 2014).

You can however install a more recent one, called MySQLdb which is a thin python wrapper around C module which implements API for MySQL database:

pip install mysqlclient
Giorgos Myrianthous
  • 36,235
  • 20
  • 134
  • 156
1

Did you install the SQL client dev pacakge on your system?

sudo apt install libmysqlclient-dev

if you are using mariadb, the drop in replacement for mysql, then run

sudo apt install libmariadbclient-dev

then try again