Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"pattern" package for python 3.6 Anaconda

I have Anaconda environment on my machine for python 3.6 When I try to install pattern package through pip, it gave an error saying something like

parentheses around print n

Then I tried conda install -c asmeurer pattern=2.5; as well as conda install -c asmeurer pattern. It says

UnsatisfiableError: The following specifications were found to be in conflict: - pattern -> python 2.7* - python 3.6*"

Finally, I got to know that python 3 does not have pattern directly.

So, I tried downloading pattern zip from http://www.clips.ua.ac.be/pattern. Now, when I ran python ./setup.py install. It again give errors related to parentheses around print n

I have tried almost everything, but unable to install pattern package in my python 3.6 Anaconda environment. Can someone please help me out here , some workaround for this?

like image 347
jatin kinra Avatar asked May 29 '17 04:05

jatin kinra


People also ask

Does Anaconda come with Python packages?

Anaconda includes Python plus about 600 additional Python packages. The Anaconda distribution of Python is advantageous because it includes Python as well as about 600 additional Python packages.

How do I add packages to Anaconda?

Go to Environments tab just below the Home tab and from there we can check what all packages are installed and what is not. It is very easy to install any package through anaconda navigator, simply search the required package, select package and click on apply to install it.

Does Python 3.7 come with anaconda?

Jul 23, 2020. We are pleased to announce the release of Anaconda Individual Edition 2020.07! For the first time, the installers ship with Python 3.8. There are Python 3.6, Python 3.7, and Python 3.8 metapackages available with this release, so you can work with Anaconda in other versions of Python as you wish.


2 Answers

I installed PIP with Conda

conda install pip

and then installed Pattern with

pip install Pattern3

it worked :)

like image 170
Masume Ebhami Avatar answered Sep 22 '22 11:09

Masume Ebhami


I'm not sure how this relates to Anaconda, but 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 python3!

like image 35
stuart Avatar answered Sep 24 '22 11:09

stuart