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?
I installed PIP with Conda
conda install pip
and then installed Pattern with
pip install Pattern3
it worked :)
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!
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.