New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL config error on Mac OSX installation #203

Open
alvations opened this Issue Jan 3, 2018 · 5 comments

Comments

Projects
None yet
5 participants
@alvations

alvations commented Jan 3, 2018

With Python3 and pip3 on Mac OSX, there's a sql config error

$ sudo pip3 install -U https://github.com/clips/pattern/archive/development.zip

Collecting https://github.com/clips/pattern/archive/development.zip
  Downloading https://github.com/clips/pattern/archive/development.zip (24.8MB)
    100% |████████████████████████████████| 24.8MB 40kB/s 
Collecting future (from Pattern==2.6)
  Downloading future-0.16.0.tar.gz (824kB)
    100% |████████████████████████████████| 829kB 850kB/s 
Collecting backports.csv (from Pattern==2.6)
  Downloading backports.csv-1.0.5-py2.py3-none-any.whl
Collecting mysqlclient (from Pattern==2.6)
  Downloading mysqlclient-1.3.12.tar.gz (89kB)
    100% |████████████████████████████████| 92kB 2.5MB/s 
    Complete output from command python setup.py egg_info:
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-c2voibrz/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/private/tmp/pip-build-c2voibrz/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/private/tmp/pip-build-c2voibrz/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-c2voibrz/mysqlclient/
@derNarr

This comment has been minimized.

derNarr commented Jan 4, 2018

I had the same error in linux (debian 9) and could solve it by installing mysql_config over the package manager with sudo apt-get install libmariadbclient-dev (this is the mariadb drop-in replacement for mysql_config).

This might solve you problem: https://stackoverflow.com/questions/25459386/mac-os-x-environmenterror-mysql-config-not-found (I cannot judge if this is the proper way to install mysql_config on your system).

@curiousrohan

This comment has been minimized.

curiousrohan commented Mar 3, 2018

I had the same error in MacOS High Sierra
Doing:
brew install mysql
PATH=$PATH:/usr/local/mysql/bin
solved the problem

@MohamedAlFahim

This comment has been minimized.

MohamedAlFahim commented May 20, 2018

I found downloading Pattern from source allows you to use Pattern without worrying about SQL, until you actually need to use the database feature.

@evanmiltenburg

This comment has been minimized.

evanmiltenburg commented Oct 22, 2018

I got the same error as @alvations using the version from PyPI:

Emiel$ pip install pattern
Collecting pattern
  Downloading https://files.pythonhosted.org/packages/1e/07/b0e61b6c818ed4b6145fe01d1c341223aa6cfbc3928538ad1f2b890924a3/Pattern-3.6.0.tar.gz (22.2MB)
    100% |████████████████████████████████| 22.3MB 1.4MB/s
Collecting future (from pattern)
  Downloading https://files.pythonhosted.org/packages/00/2b/8d082ddfed935f3608cc61140df6dcbf0edea1bc3ab52fb6c29ae3e81e85/future-0.16.0.tar.gz (824kB)
    100% |████████████████████████████████| 829kB 18.4MB/s
Collecting backports.csv (from pattern)
  Downloading https://files.pythonhosted.org/packages/71/f7/5db9136de67021a6dce4eefbe50d46aa043e59ebb11c83d4ecfeb47b686e/backports.csv-1.0.6-py2.py3-none-any.whl
Collecting mysqlclient (from pattern)
  Downloading https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz (90kB)
    100% |████████████████████████████████| 92kB 5.5MB/s
    Complete output from command python setup.py egg_info:
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/p0/dfmctn613mj8l2q3rpksnsz80000gn/T/pip-install-xcr99rmb/mysqlclient/setup.py", line 18, in <module>
        metadata, options = get_config()
      File "/private/var/folders/p0/dfmctn613mj8l2q3rpksnsz80000gn/T/pip-install-xcr99rmb/mysqlclient/setup_posix.py", line 53, in get_config
        libs = mysql_config("libs_r")
      File "/private/var/folders/p0/dfmctn613mj8l2q3rpksnsz80000gn/T/pip-install-xcr99rmb/mysqlclient/setup_posix.py", line 28, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found
@evanmiltenburg

This comment has been minimized.

evanmiltenburg commented Oct 23, 2018

Because I don't need the database feature, I bluntly solved the issue by commenting out line 140 in setup.py. So this:

    install_requires = [
        "future",
        "backports.csv",
        "mysqlclient",
        "beautifulsoup4",
        "lxml",
        "feedparser",
        "pdfminer" if sys.version < "3" else "pdfminer.six",
        "numpy",
        "scipy",
        "nltk",
        "python-docx",
        "cherrypy",
        "requests"
    ],

Becomes:

    install_requires = [
        "future",
        "backports.csv",
#        "mysqlclient",
        "beautifulsoup4",
        "lxml",
        "feedparser",
        "pdfminer" if sys.version < "3" else "pdfminer.six",
        "numpy",
        "scipy",
        "nltk",
        "python-docx",
        "cherrypy",
        "requests"
    ],

This way, python setup.py install runs without any errors. It's not pretty but it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment