question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wheel file not used when installing mysql-python on MacOs

See original GitHub issue

Installing mysql-python with pip succeeds, but with pipenv it fails.

I see that pip is installing from MySQL_python-1.2.5-cp27-cp27m-macosx_10_13_x86_64.whl. When installing via pipenv the wheel file is not used and it fails with:

  Using version 1.2.5 (newest of versions: 1.2.5)
  Created temporary directory: /private/var/folders/_t/4fb22psj4079hxxtjj3bqt31b8jsc8/T/pip-unpack-vXegtZ
  Looking up "https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip" in the cache
  Ignoring unknown cache-control directive:
  Current age based on date: 89524
  Ignoring unknown cache-control directive: immutable
  Freshness lifetime from max-age: 365000000
  The response is "fresh", returning cached response
  365000000 > 89524
  Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
  Downloading from URL https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip#sha256=811040b647e5d5686f84db415efd697e6250008b112b6909ba77ac059e140c74 (from https://pypi.org/simple/mysql-python/)
  Running setup.py (path:/private/var/folders/_t/4fb22psj4079hxxtjj3bqt31b8jsc8/T/pip-install-785taV/mysql-python/setup.py) egg_info for package mysql-python
    Running command python setup.py egg_info
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/_t/4fb22psj4079hxxtjj3bqt31b8jsc8/T/pip-install-785taV/mysql-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 53, in get_config
        libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
      File "setup_posix.py", line 8, in dequote
        if s[0] in "\"'" and s[0] == s[-1]:
    IndexError: string index out of range

With pip (in an empty virtualenv with the same python):

$ pip install -v mysql-python
...
Using version 1.2.5 (newest of versions: 1.2.3, 1.2.4, 1.2.5)
Using cached wheel link: file:///Users/user/Library/Caches/pip/wheels/07/d2/5f/314860e4cb53a44bf0ee0d051d4b34465e4b4fbe9de6d42f42/MySQL_python-1.2.5-cp27-cp27m-macosx_10_13_x86_64.whl
Installing collected packages: mysql-python

Successfully installed mysql-python-1.2.5
Cleaning up...

Versions:

pipenv, version 2018.05.18
Python 2.7.15 (Homebrew python@2)
pip 10.0.1 from /usr/local/lib/python2.7/site-packages/pip (python 2.7)
MacOs: 10.13.5

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, Jun 28, 2018

Based on the log, your environment likely cannot build the wheel though… otherwise egg_info would not have failed 🤔

I suggest trying out if pipenv install mysqlclient works, and file any problems against it. It is a fork of MySQL-Python, but much better maintained and modern. The usage is completely identical.

https://github.com/PyMySQL/mysqlclient-python

0reactions
dresnick-sfcommented, Jun 28, 2018

Sorry about that. Was it previously automatically built on my mac and cached? I’m still learning python packaging. Thanks for explaining why it wasn’t working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't install mysql-python with pip on MacOS 10.12.4
Solved with this brew install mysql pip install MySQL-python.
Read more >
4.2 Installing Connector/Python from a Binary Distribution
msi file): To use the MSI Installer, launch it and follow the prompts in the screens it presents to install Connector/Python in the...
Read more >
Install MySQL Connector Python on Windows, MAC, Linux ...
In this lesson, You will learn how to Install MySQL Connector Python on Windows, macOS, Linux, Unix, and Ubuntu using pip and vis...
Read more >
Fixing “my_config.h” file not found in MySQL-python (Mac ...
This blog article summarizes how to quickly resolve the following error when installing the MySQL-python package…
Read more >
Install MySQL and MySQLClient (Python) in MacOS
In this post, we are going to see how to install MySQL and connect a Python application to it using mysqlclient. Table of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found