Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I pip install pattern packages in python 3.5?

How do I pip install pattern packages in python 3.5?

While in CMD:

pip install pattern
syntaxerror: missing parentheses in call to 'print'

Shows error:

messageCommand "python setup.py egg_info" failed with error 
      code 1 in temp\pip-build-3uegov4d\pattern

seaborn and tweepy were all successful.

How can I solve this problem?

like image 500
Naiqing Avatar asked Jan 25 '16 17:01

Naiqing


3 Answers

pip install pattern3 - Python 3.x

pip install pattern - Python 2.7.x

like image 99
ThReSholD Avatar answered Oct 17 '22 03:10

ThReSholD


As of writing, Python 3.6 support is still not merged with master. However, it is available in the python3 branch.

To install via pip:

pip install https://github.com/clips/pattern/archive/python3.zip

Note that ThReSholD's answer for Python 3 (pattern3) is for a:

deprecated pattern3 repository which contains a completely different code base that is not maintained anymore

like image 26
modelbuilder42 Avatar answered Oct 17 '22 02:10

modelbuilder42


It looks like from the documentation that, for python 3, pattern is only supported in 3.6 and up. https://github.com/clips/pattern#installation

This worked for me to get pattern.en working in python 3.6:

git clone -b development https://github.com/clips/pattern
cd pattern
sudo python3.6 setup.py install

https://github.com/clips/pattern/issues/62

I had some SSL errors during installation on my mac (10.11.6) that were fixed by running this code in python (3.6):

import nltk
import ssl 

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    pass
else:
    ssl._create_default_https_context = _create_unverified_https_context

nltk.download('wordnet_ic')

apparently there's a better way to deal with ssl stuff like this fwiw: https://stackoverflow.com/a/41351871/8870055

sanity check:

user@USDR00253 ~> python3.6
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from pattern.en import conjugate, lemma, lexeme, parse
>>>
>>> print(parse('ridden', relations=True, lemmata=True))
ridden/VBN/B-VP/O/O/ride
>>>

pattern.en finally running in python 3!

like image 7
stuart Avatar answered Oct 17 '22 03:10

stuart