clips / pattern

Web mining module for Python, with tools for scraping, natural language processing, machine learning, network analysis and visualization.
https://github.com/clips/pattern/wiki
BSD 3-Clause "New" or "Revised" License
8.72k stars 1.58k forks source link

Installing fails: mysql_config not found #275

Open ndvbd opened 5 years ago

ndvbd commented 5 years ago

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

abhijithneilabraham commented 5 years ago

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

brew install mysqlclient 

and then install pattern

ndvbd commented 5 years ago

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

abhijithneilabraham commented 5 years ago

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

ndvbd commented 5 years ago

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

ndvbd commented 5 years ago

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
amoux commented 4 years ago

I got it working with no errors.

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
knarrff commented 4 years ago

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.

Sjoerd82 commented 3 years ago

Related to #250

perfectm commented 1 year ago

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