Skip to content
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 · 11 comments
Open

SQL config error on Mac OSX installation #203

alvations opened this issue Jan 3, 2018 · 11 comments

Comments

@alvations
Copy link

@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
Copy link

@derNarr 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
Copy link

@curiousrohan 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
Copy link

@MohamedAlFahim 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
Copy link

@evanmiltenburg 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
Copy link

@evanmiltenburg 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.

@falconair
Copy link

@falconair falconair commented Jun 19, 2019

I am coming across this issue when I install pattern via pip (on python 3.6). I am installing this library as a dependency for gensim. I just need pattern for lemmatization features, is a mysql installation really required?

Several people have suggested installing mysql via brew or apt, but I need to install this library in an environment where things are pretty locked down. Not having a mysql dependency will make this much easier.

@evanmiltenburg
Copy link

@evanmiltenburg evanmiltenburg commented Jun 19, 2019

No. Mysql is needed for storing results. My solution above would work for you as well.

@cheneypinata
Copy link

@cheneypinata cheneypinata commented Jun 20, 2019

Having the same issue with OS Mojave 10.15.5 and the workaround from @curiousrohan seemed to work.

@vizzerdrix55
Copy link

@vizzerdrix55 vizzerdrix55 commented Jun 25, 2019

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

Performing these lines in terminal worked also for solving the problem in Jupyter Notebook 5.7.4 with Python 3.7.1 on macOS Mojave

@flekschas
Copy link

@flekschas flekschas commented Aug 27, 2019

In case you don't want to install mysql system-wide, you can easily create a Conda environment. The following works for me:

name: pattern
channels:
  - conda-forge

dependencies:
  - python>=3.7
  - mysql # Needed by pattern
  - pip
  - pip:
    - pattern==3.6
@TailaneBrito
Copy link

@TailaneBrito TailaneBrito commented Nov 20, 2019

I solved the problem using
brew install mysql

as mentioned above! thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants