pattern icon indicating copy to clipboard operation
pattern copied to clipboard

Installing fails: mysql_config not found

Open ndvbd opened this issue 6 years ago • 9 comments

I want to upgrade from pattern 2.6 to 3.6 I uninstalled, and now I do:

sudo pip install pattern

and get EnvironmentError: mysql_config not found

ndvbd avatar Apr 22 '19 14:04 ndvbd

Try installing mysqlclient separately and then try the sudo pip install pattern for macos try

brew install mysqlclient 

and then install pattern

abhijithneilabraham avatar Apr 23 '19 18:04 abhijithneilabraham

Hi, but I don't want to install mysql... I just want to use the Pattern for the English textual skills, like singularize, etc.

ndvbd avatar Apr 23 '19 19:04 ndvbd

When you install pattern mysqlclient is a dependency. It is not made optional yet.(That's what I faced anyway)

abhijithneilabraham avatar Apr 23 '19 19:04 abhijithneilabraham

So we can install the client, but don't have to install the database itself, right?

ndvbd avatar Apr 23 '19 19:04 ndvbd

I managed to install 3.6 after I did sudo apt-get install libmysqlclient-dev and then sudo pip2 install pattern==3.6

However, when I am now doing from pattern.en import singularize It fails:


    from pattern.en import singularize
  File "/usr/local/lib/python2.7/dist-packages/pattern/text/en/__init__.py", line 61, in <module>
    from pattern.text.en.inflect import (
  File "/usr/local/lib/python2.7/dist-packages/pattern/text/en/__init__.py", line 80, in <module>
    from pattern.text.en import wordnet
  File "/usr/local/lib/python2.7/dist-packages/pattern/text/en/wordnet/__init__.py", line 57, in <module>
    nltk.data.find("corpora/" + token)
  File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 653, in find
    return find(modified_name, paths)
  File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 639, in find
    return ZipFilePathPointer(p, zipentry)
  File "/usr/local/lib/python2.7/dist-packages/nltk/compat.py", line 221, in _decorator
    return init_func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 486, in __init__
    zipfile = OpenOnDemandZipFile(os.path.abspath(zipfile))
  File "/usr/local/lib/python2.7/dist-packages/nltk/compat.py", line 221, in _decorator
    return init_func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 1012, in __init__
    zipfile.ZipFile.__init__(self, filename)
  File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
    self._RealGetContents()
  File "/usr/lib/python2.7/zipfile.py", line 811, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

ndvbd avatar Apr 29 '19 13:04 ndvbd

I got it working with no errors.

  • OS: Ubuntu 19.04
  • Anaconda environment: python 3.6

make sure you install libmysqlclient-dev first!

sudo apt install libmysqlclient-dev
git clone https://github.com/clips/pattern
cd pattern/
# activate conda environment.
python setup.py install

output after running python setup.py install:

Using /home/<USER-NAME>/anaconda3/envs/<ENV-NAME>/lib/python3.6/site-packages
Finished processing dependencies for Pattern==3.6

amoux avatar Oct 01 '19 18:10 amoux

You don't have root on all machines where you might want to use pattern, and I also do not see a reason why mysql-client should be a required dependency. Especially when the documentation mentions:

The module has no external dependencies except when using LSA in the pattern.vector module, which requires NumPy

Please make optional dependencies optional.

knarrff avatar Apr 09 '20 09:04 knarrff

Related to #250

Sjoerd82 avatar Jan 21 '21 14:01 Sjoerd82

Please....We are unable to use Pattern because of this error message from MySQL.....

perfectm avatar Aug 30 '23 23:08 perfectm