"pattern" package for python 3.6 Anaconda

Viewed 9497

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?

3 Answers

Using Windows Subsystem for Linux, I made pattern to work using miniconda in Python 3.7:

conda create -n test -c conda-forge python=3.7 pattern
conda activate test

I discovered that there is a bug with StopInteration due to PEP-479, and replacing raise StopIteration with return in pattern\text\__init__.py fixes it.

To find the location if the file, I executed

cd $(python -c "from distutils.sysconfig import get_python_lib;print(get_python_lib())")
nano pattern/text/__init__.py

Line 605, just above class Lexicon(lazydict): ... replace raise StopIteration with return.

And all is working fine.

enter image description here

Related