mysqlclient icon indicating copy to clipboard operation
mysqlclient copied to clipboard

Failed building wheel for mysqlclient

Open epicserve opened this issue 10 years ago • 15 comments

I'm using Python 3.5.1 and pip 8.0.2 on OS X that I installed using pyenv. When installing mysqlclient I get the error "Failed building wheel for mysqlclient". The following is my terminal output.

$ pip install mysqlclient==1.3.7
Collecting mysqlclient==1.3.7
  Using cached mysqlclient-1.3.7.tar.gz
Building wheels for collected packages: mysqlclient
  Running setup.py bdist_wheel for mysqlclient ... error
  Complete output from command /Users/brento/.virtualenvs/pears-py3/bin/python3.5 -u -c "import setuptools, tokenize;__file__='/private/var/folders/q8/nr7dx6213ld0p451xxqm138h0000gp/T/pip-build-rayxd4we/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/q8/nr7dx6213ld0p451xxqm138h0000gp/T/tmpvg5zyj7upip-wheel- --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.11-x86_64-3.5
  copying _mysql_exceptions.py -> build/lib.macosx-10.11-x86_64-3.5
  creating build/lib.macosx-10.11-x86_64-3.5/MySQLdb
  copying MySQLdb/__init__.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb
  copying MySQLdb/compat.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb
  copying MySQLdb/converters.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb
  copying MySQLdb/connections.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb
  copying MySQLdb/cursors.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb
  copying MySQLdb/release.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb
  copying MySQLdb/times.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb
  creating build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants
  copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants
  copying MySQLdb/constants/CR.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants
  copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants
  copying MySQLdb/constants/ER.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants
  copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants
  copying MySQLdb/constants/REFRESH.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants
  copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants
  running build_ext
  building '_mysql' extension
  creating build/temp.macosx-10.11-x86_64-3.5
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -Dversion_info=(1,3,7,'final',1) -D__version__=1.3.7 -I/usr/local/Cellar/mysql/5.7.10/include/mysql -I/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c _mysql.c -o build/temp.macosx-10.11-x86_64-3.5/_mysql.o -fno-omit-frame-pointer
  clang -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk build/temp.macosx-10.11-x86_64-3.5/_mysql.o -L/usr/local/Cellar/mysql/5.7.10/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.11-x86_64-3.5/_mysql.cpython-35m-darwin.so
  installing to build/bdist.macosx-10.11-x86_64/wheel
  running install
  running install_lib
  creating build/bdist.macosx-10.11-x86_64
  creating build/bdist.macosx-10.11-x86_64/wheel
  copying build/lib.macosx-10.11-x86_64-3.5/_mysql.cpython-35m-darwin.so -> build/bdist.macosx-10.11-x86_64/wheel
  copying build/lib.macosx-10.11-x86_64-3.5/_mysql_exceptions.py -> build/bdist.macosx-10.11-x86_64/wheel
  creating build/bdist.macosx-10.11-x86_64/wheel/MySQLdb
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/__init__.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/compat.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/connections.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb
  creating build/bdist.macosx-10.11-x86_64/wheel/MySQLdb/constants
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants/__init__.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb/constants
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants/CLIENT.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb/constants
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants/CR.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb/constants
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants/ER.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb/constants
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants/FIELD_TYPE.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb/constants
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants/FLAG.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb/constants
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/constants/REFRESH.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb/constants
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/converters.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/cursors.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/release.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb
  copying build/lib.macosx-10.11-x86_64-3.5/MySQLdb/times.py -> build/bdist.macosx-10.11-x86_64/wheel/MySQLdb
  running install_egg_info
  running egg_info
  writing top-level names to mysqlclient.egg-info/top_level.txt
  writing dependency_links to mysqlclient.egg-info/dependency_links.txt
  writing mysqlclient.egg-info/PKG-INFO
  warning: manifest_maker: standard file '-c' not found

  reading manifest file 'mysqlclient.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'mysqlclient.egg-info/SOURCES.txt'
  Copying mysqlclient.egg-info to build/bdist.macosx-10.11-x86_64/wheel/mysqlclient-1.3.7-py3.5.egg-info
  running install_scripts
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/q8/nr7dx6213ld0p451xxqm138h0000gp/T/pip-build-rayxd4we/mysqlclient/setup.py", line 21, in <module>
      setuptools.setup(**metadata)
    File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/Users/brento/.virtualenvs/pears-py3/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 213, in run
      archive_basename = self.get_archive_basename()
    File "/Users/brento/.virtualenvs/pears-py3/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 161, in get_archive_basename
      impl_tag, abi_tag, plat_tag = self.get_tag()
    File "/Users/brento/.virtualenvs/pears-py3/lib/python3.5/site-packages/wheel/bdist_wheel.py", line 155, in get_tag
      assert tag == supported_tags[0]
  AssertionError

  ----------------------------------------
  Failed building wheel for mysqlclient
  Running setup.py clean for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
  Found existing installation: mysqlclient 1.3.6
    Uninstalling mysqlclient-1.3.6:
      Successfully uninstalled mysqlclient-1.3.6
  Running setup.py install for mysqlclient ... done
Successfully installed mysqlclient-1.3.7

epicserve avatar Feb 10 '16 17:02 epicserve

pip install -U wheel will fix your problem.

methane avatar Feb 11 '16 07:02 methane

Shouldn't this library be updated to work without having to use that extra flag?

epicserve avatar Feb 11 '16 14:02 epicserve

What the extra frag means? This is a compatibility problem between old wheel and Python 3.5.

https://bitbucket.org/pypa/wheel/issues/146/wheel-building-fails-on-cpython-350b3

methane avatar Feb 11 '16 22:02 methane

In case someone finds this page, what worked for me was reinstalling the XCode command line tools:

xcode-select --install

luizs81 avatar Dec 21 '16 15:12 luizs81

Anyway, it's not this project's issue. And issue tracker is not user forum.

methane avatar Dec 21 '16 15:12 methane

Download the pre-compiled whl file for mysql from from Christophe Gohlke’s Library of pre-compiled python packages for windows from the below location.

http://www.lfd.uci.edu/~gohlke/pythonlibs/#vlfd

Now got to directory where you downloaded that file and open command prompt there.

Now run below command

pip install xxx.whl

Best Luck !!

JayeshVaghasiya avatar Mar 13 '17 16:03 JayeshVaghasiya

I was successfully in installing for python 3.7.2

pip install mysqlclient-1.4.1-cp37-cp37m-win32.whl

arunkkumar2207j avatar Jan 26 '19 08:01 arunkkumar2207j

For me on OS X, this advice worked:

Step 1.

brew install openssl

Step 2.

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

dfrankow avatar Mar 20 '19 21:03 dfrankow

For me on OS X, this advice worked:

Step 1.

brew install openssl

Step 2.

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

This worked for me too on MacOS, not sure why this is necessary though...

justin-ad avatar Apr 12 '19 20:04 justin-ad

If you're using Anaconda (which I highly suggest you) then run these two commands

conda install -c anaconda mysql-connector-python

and

conda install -c bioconda mysqlclient

Akashdesarda avatar Apr 26 '19 10:04 Akashdesarda

For me on OS X, this advice worked:

Step 1.

brew install openssl

Step 2.

export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

Thanks! Worked for OS

Samiys avatar Jun 14 '19 05:06 Samiys

For me on OS X, this advice worked: Step 1. brew install openssl Step 2. export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/

This worked for me too on MacOS, not sure why this is necessary though...

I followed above steps and now I am not able to pip install anything keep getting following error: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Dharmadas avatar Nov 28 '19 08:11 Dharmadas

@Dharmadas Your issue is not the issue of this project. Please ask support on Python user community.

methane avatar Nov 28 '19 08:11 methane

This is still an issue on Windows. None of the above answers worked for 64bit python

timstallinger avatar Sep 24 '20 08:09 timstallinger

There are many MySQL and MySQL compatible libraries. And there are many ways to install them. So you shouldn't expect just "pip install" can build wheel. You need to manage it by yourself.

If you can not fix your environment issue, ask help on Python community, not me. OSS maintainer is not free tech suport. I can not support thousands of users.

methane avatar Sep 24 '20 09:09 methane