can't install mysql==0.0.2 in python==3.8.1 environment

Viewed 30

I can't install mysql==0.0.2. I am able to install mysql==0.0.3. The error looks like. Seems to me setuptools error.

(venv) C:\Users\xyz\Envs\>pip install mysql==0.0.2
Collecting mysql==0.0.2
  Using cached mysql-0.0.2.tar.gz (1.9 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\xyz\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xyz\\AppData\\Local\\Temp\\pip-install-rygxsfpt\\mysql\\setup.py'"'"'; __file__='"'"'C:\\Users\\xyz\\AppData\\Local\\Temp\\pip-install-rygxsfpt\\mysql\\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 'C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info'
         cwd: C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\
    Complete output (32 lines):
    WARNING: `mysql` is a virtual package. Please use `%s` as a dependency directly.

    running egg_info
    creating C:\Users\xyzAppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info\mysql.egg-info
    writing C:\Users\xyzAppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info\mysql.egg-info\PKG-INFO
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\setup.py", line 33, in <module>
        setup(
      File "c:\users\xyz\lib\site-packages\setuptools\__init__.py", line 87, in setup
        return distutils.core.setup(**attrs)
      File "c:\users\xyz\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
 .....
 .....
 .....
 
        lines = header.split('\n')
    AttributeError: 'list' object has no attribute 'split'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

1 Answers

You shouldn't install mysql at all.

This package is a ‘virtual package’, which requires MySQL-python (Python 2) or mysqlclient (Python 3) to install. In effect, this means ‘pip install mysql’ will actually install MySQL-python. Instead of depending on this package, please depend on the relevant package directly.

In a Python 3 world, use either

  • pip install mysqlclient (for MySQLdb), or
  • pip install mysql-connector-python (for mysql.connector).
Related