Closed StatguyUser closed 5 years ago
I have python 2.7 and i work on windows10 operating system. I installed the lesk library as per documentation. When i try to import the module using
lesk
from pywsd.lesk import simple_lesk
I end up getting error
Warming up PyWSD (takes ~10 secs)... --------------------------------------------------------------------------- ImportError Traceback (most recent call last) c:\python35\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding) 51 1 1 6 ---> 52 2 2 7 53 3 3 8 c:\python35\lib\site-packages\pandas\core\indexes\base.py in <module>() 16 from pandas.core.accessor import CachedAccessor ---> 17 from pandas.core.arrays import ExtensionArray 18 from pandas.core.dtypes.generic import ( c:\python35\lib\site-packages\pandas\core\arrays\__init__.py in <module>() 1 from .base import ExtensionArray # noqa ----> 2 from .categorical import Categorical # noqa c:\python35\lib\site-packages\pandas\core\arrays\categorical.py in <module>() 13 ABCSeries, ABCIndexClass, ABCCategoricalIndex) ---> 14 from pandas.core.dtypes.missing import isna, notna 15 from pandas.core.dtypes.inference import is_hashable c:\python35\lib\site-packages\pandas\core\dtypes\missing.py in <module>() 9 ABCExtensionArray) ---> 10 from .common import (is_string_dtype, is_datetimelike, 11 is_datetimelike_v_numeric, is_float_dtype, c:\python35\lib\site-packages\pandas\core\dtypes\common.py in <module>() 16 ABCIndexClass, ABCDateOffset) ---> 17 from .inference import is_string_like, is_list_like 18 from .inference import * # noqa c:\python35\lib\site-packages\pandas\core\dtypes\inference.py in <module>() 7 from numbers import Number ----> 8 from pandas.compat import (PY2, string_types, text_type, 9 string_and_binary_types, re_type) ImportError: cannot import name 're_type' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) c:\python35\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding) 56 ---> 57 >>> unpickled_df = pd.read_pickle("./dummy.pkl") 58 >>> unpickled_df c:\python35\lib\site-packages\pandas\compat\pickle_compat.py in load(fh, encoding, compat, is_verbose) 116 --> 117 # 19939, add timedeltaindex, float64index compat from 15998 move 118 ('pandas.tseries.tdi', 'TimedeltaIndex'): c:\python35\lib\pickle.py in load(self) 1038 assert isinstance(key, bytes_types) -> 1039 dispatch[key[0]](self) 1040 except _Stop as stopinst: c:\python35\lib\pickle.py in load_global(self) 1333 name = self.readline()[:-1].decode("utf-8") -> 1334 klass = self.find_class(module, name) 1335 self.append(klass) c:\python35\lib\pickle.py in find_class(self, module, name) 1383 module = _compat_pickle.IMPORT_MAPPING[module] -> 1384 __import__(module, level=0) 1385 if self.proto >= 4: c:\python35\lib\site-packages\pandas\core\indexes\base.py in <module>() 16 from pandas.core.accessor import CachedAccessor ---> 17 from pandas.core.arrays import ExtensionArray 18 from pandas.core.dtypes.generic import ( c:\python35\lib\site-packages\pandas\core\arrays\__init__.py in <module>() 1 from .base import ExtensionArray # noqa ----> 2 from .categorical import Categorical # noqa c:\python35\lib\site-packages\pandas\core\arrays\categorical.py in <module>() 13 ABCSeries, ABCIndexClass, ABCCategoricalIndex) ---> 14 from pandas.core.dtypes.missing import isna, notna 15 from pandas.core.dtypes.inference import is_hashable c:\python35\lib\site-packages\pandas\core\dtypes\missing.py in <module>() 9 ABCExtensionArray) ---> 10 from .common import (is_string_dtype, is_datetimelike, 11 is_datetimelike_v_numeric, is_float_dtype, c:\python35\lib\site-packages\pandas\core\dtypes\common.py in <module>() 16 ABCIndexClass, ABCDateOffset) ---> 17 from .inference import is_string_like, is_list_like 18 from .inference import * # noqa c:\python35\lib\site-packages\pandas\core\dtypes\inference.py in <module>() 7 from numbers import Number ----> 8 from pandas.compat import (PY2, string_types, text_type, 9 string_and_binary_types, re_type) ImportError: cannot import name 're_type' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) c:\python35\lib\site-packages\pandas\io\pickle.py in read_pickle(path) 64 4 4 9 ---> 65 66 >>> import os c:\python35\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding) 61 1 1 6 ---> 62 2 2 7 63 3 3 8 c:\python35\lib\site-packages\pandas\compat\pickle_compat.py in load(fh, encoding, compat, is_verbose) 116 --> 117 # 19939, add timedeltaindex, float64index compat from 15998 move 118 ('pandas.tseries.tdi', 'TimedeltaIndex'): c:\python35\lib\pickle.py in load(self) 1038 assert isinstance(key, bytes_types) -> 1039 dispatch[key[0]](self) 1040 except _Stop as stopinst: c:\python35\lib\pickle.py in load_global(self) 1333 name = self.readline()[:-1].decode("utf-8") -> 1334 klass = self.find_class(module, name) 1335 self.append(klass) c:\python35\lib\pickle.py in find_class(self, module, name) 1383 module = _compat_pickle.IMPORT_MAPPING[module] -> 1384 __import__(module, level=0) 1385 if self.proto >= 4: c:\python35\lib\site-packages\pandas\core\indexes\base.py in <module>() 16 from pandas.core.accessor import CachedAccessor ---> 17 from pandas.core.arrays import ExtensionArray 18 from pandas.core.dtypes.generic import ( c:\python35\lib\site-packages\pandas\core\arrays\__init__.py in <module>() 1 from .base import ExtensionArray # noqa ----> 2 from .categorical import Categorical # noqa c:\python35\lib\site-packages\pandas\core\arrays\categorical.py in <module>() 13 ABCSeries, ABCIndexClass, ABCCategoricalIndex) ---> 14 from pandas.core.dtypes.missing import isna, notna 15 from pandas.core.dtypes.inference import is_hashable c:\python35\lib\site-packages\pandas\core\dtypes\missing.py in <module>() 9 ABCExtensionArray) ---> 10 from .common import (is_string_dtype, is_datetimelike, 11 is_datetimelike_v_numeric, is_float_dtype, c:\python35\lib\site-packages\pandas\core\dtypes\common.py in <module>() 16 ABCIndexClass, ABCDateOffset) ---> 17 from .inference import is_string_like, is_list_like 18 from .inference import * # noqa c:\python35\lib\site-packages\pandas\core\dtypes\inference.py in <module>() 7 from numbers import Number ----> 8 from pandas.compat import (PY2, string_types, text_type, 9 string_and_binary_types, re_type) ImportError: cannot import name 're_type' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) c:\python35\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding) 51 1 1 6 ---> 52 2 2 7 53 3 3 8 c:\python35\lib\site-packages\pandas\core\indexes\base.py in <module>() 16 from pandas.core.accessor import CachedAccessor ---> 17 from pandas.core.arrays import ExtensionArray 18 from pandas.core.dtypes.generic import ( c:\python35\lib\site-packages\pandas\core\arrays\__init__.py in <module>() 1 from .base import ExtensionArray # noqa ----> 2 from .categorical import Categorical # noqa c:\python35\lib\site-packages\pandas\core\arrays\categorical.py in <module>() 13 ABCSeries, ABCIndexClass, ABCCategoricalIndex) ---> 14 from pandas.core.dtypes.missing import isna, notna 15 from pandas.core.dtypes.inference import is_hashable c:\python35\lib\site-packages\pandas\core\dtypes\missing.py in <module>() 9 ABCExtensionArray) ---> 10 from .common import (is_string_dtype, is_datetimelike, 11 is_datetimelike_v_numeric, is_float_dtype, c:\python35\lib\site-packages\pandas\core\dtypes\common.py in <module>() 16 ABCIndexClass, ABCDateOffset) ---> 17 from .inference import is_string_like, is_list_like 18 from .inference import * # noqa c:\python35\lib\site-packages\pandas\core\dtypes\inference.py in <module>() 7 from numbers import Number ----> 8 from pandas.compat import (PY2, string_types, text_type, 9 string_and_binary_types, re_type) ImportError: cannot import name 're_type' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) c:\python35\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding) 56 ---> 57 >>> unpickled_df = pd.read_pickle("./dummy.pkl") 58 >>> unpickled_df c:\python35\lib\site-packages\pandas\compat\pickle_compat.py in load(fh, encoding, compat, is_verbose) 116 --> 117 # 19939, add timedeltaindex, float64index compat from 15998 move 118 ('pandas.tseries.tdi', 'TimedeltaIndex'): c:\python35\lib\pickle.py in load(self) 1038 assert isinstance(key, bytes_types) -> 1039 dispatch[key[0]](self) 1040 except _Stop as stopinst: c:\python35\lib\pickle.py in load_global(self) 1333 name = self.readline()[:-1].decode("utf-8") -> 1334 klass = self.find_class(module, name) 1335 self.append(klass) c:\python35\lib\pickle.py in find_class(self, module, name) 1383 module = _compat_pickle.IMPORT_MAPPING[module] -> 1384 __import__(module, level=0) 1385 if self.proto >= 4: c:\python35\lib\site-packages\pandas\core\indexes\base.py in <module>() 16 from pandas.core.accessor import CachedAccessor ---> 17 from pandas.core.arrays import ExtensionArray 18 from pandas.core.dtypes.generic import ( c:\python35\lib\site-packages\pandas\core\arrays\__init__.py in <module>() 1 from .base import ExtensionArray # noqa ----> 2 from .categorical import Categorical # noqa c:\python35\lib\site-packages\pandas\core\arrays\categorical.py in <module>() 13 ABCSeries, ABCIndexClass, ABCCategoricalIndex) ---> 14 from pandas.core.dtypes.missing import isna, notna 15 from pandas.core.dtypes.inference import is_hashable c:\python35\lib\site-packages\pandas\core\dtypes\missing.py in <module>() 9 ABCExtensionArray) ---> 10 from .common import (is_string_dtype, is_datetimelike, 11 is_datetimelike_v_numeric, is_float_dtype, c:\python35\lib\site-packages\pandas\core\dtypes\common.py in <module>() 16 ABCIndexClass, ABCDateOffset) ---> 17 from .inference import is_string_like, is_list_like 18 from .inference import * # noqa c:\python35\lib\site-packages\pandas\core\dtypes\inference.py in <module>() 7 from numbers import Number ----> 8 from pandas.compat import (PY2, string_types, text_type, 9 string_and_binary_types, re_type) ImportError: cannot import name 're_type' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) <ipython-input-4-a91d9624c173> in <module>() 1 #from pywsd.lesk import simple_lesk ----> 2 import pywsd.lesk c:\python35\lib\site-packages\pywsd\__init__.py in <module>() 17 start = time.time() 18 ---> 19 import pywsd.lesk 20 import pywsd.baseline 21 import pywsd.similarity c:\python35\lib\site-packages\pywsd\lesk.py in <module>() 24 EN_STOPWORDS = set(stopwords.words('english') + list(string.punctuation) + pywsd_stopwords) 25 signatures_picklefile = os.path.dirname(os.path.abspath(__file__)) + '/data/signatures/signatures.pkl' ---> 26 cached_signatures = pd.read_pickle(signatures_picklefile) 27 28 def synset_signatures_from_cache(ss, hyperhypo=True, adapted=False, original_lesk=False): c:\python35\lib\site-packages\pandas\io\pickle.py in read_pickle(path) 66 >>> import os 67 >>> os.remove("./dummy.pkl") ---> 68 """ 69 path = _stringify_path(path) 70 inferred_compression = _infer_compression(path, compression) c:\python35\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding) 60 0 0 5 61 1 1 6 ---> 62 2 2 7 63 3 3 8 64 4 4 9 c:\python35\lib\site-packages\pandas\compat\pickle_compat.py in load(fh, encoding, compat, is_verbose) 115 ('pandas.core.arrays', 'Categorical'), 116 --> 117 # 19939, add timedeltaindex, float64index compat from 15998 move 118 ('pandas.tseries.tdi', 'TimedeltaIndex'): 119 ('pandas.core.indexes.timedeltas', 'TimedeltaIndex'), c:\python35\lib\pickle.py in load(self) 1037 raise EOFError 1038 assert isinstance(key, bytes_types) -> 1039 dispatch[key[0]](self) 1040 except _Stop as stopinst: 1041 return stopinst.value c:\python35\lib\pickle.py in load_global(self) 1332 module = self.readline()[:-1].decode("utf-8") 1333 name = self.readline()[:-1].decode("utf-8") -> 1334 klass = self.find_class(module, name) 1335 self.append(klass) 1336 dispatch[GLOBAL[0]] = load_global c:\python35\lib\pickle.py in find_class(self, module, name) 1382 elif module in _compat_pickle.IMPORT_MAPPING: 1383 module = _compat_pickle.IMPORT_MAPPING[module] -> 1384 __import__(module, level=0) 1385 if self.proto >= 4: 1386 return _getattribute(sys.modules[module], name)[0] c:\python35\lib\site-packages\pandas\core\indexes\base.py in <module>() 15 16 from pandas.core.accessor import CachedAccessor ---> 17 from pandas.core.arrays import ExtensionArray 18 from pandas.core.dtypes.generic import ( 19 ABCSeries, ABCDataFrame, c:\python35\lib\site-packages\pandas\core\arrays\__init__.py in <module>() 1 from .base import ExtensionArray # noqa ----> 2 from .categorical import Categorical # noqa c:\python35\lib\site-packages\pandas\core\arrays\categorical.py in <module>() 12 from pandas.core.dtypes.generic import ( 13 ABCSeries, ABCIndexClass, ABCCategoricalIndex) ---> 14 from pandas.core.dtypes.missing import isna, notna 15 from pandas.core.dtypes.inference import is_hashable 16 from pandas.core.dtypes.cast import ( c:\python35\lib\site-packages\pandas\core\dtypes\missing.py in <module>() 8 ABCIndexClass, ABCGeneric, 9 ABCExtensionArray) ---> 10 from .common import (is_string_dtype, is_datetimelike, 11 is_datetimelike_v_numeric, is_float_dtype, 12 is_datetime64_dtype, is_datetime64tz_dtype, c:\python35\lib\site-packages\pandas\core\dtypes\common.py in <module>() 15 ABCSparseArray, ABCSparseSeries, ABCCategoricalIndex, 16 ABCIndexClass, ABCDateOffset) ---> 17 from .inference import is_string_like, is_list_like 18 from .inference import * # noqa 19 c:\python35\lib\site-packages\pandas\core\dtypes\inference.py in <module>() 6 from collections import Iterable 7 from numbers import Number ----> 8 from pandas.compat import (PY2, string_types, text_type, 9 string_and_binary_types, re_type) 10 from pandas._libs import lib ImportError: cannot import name 're_type'
Do note that Python2.7 would be deprecated soon... =)
No more Python 2 from pywsd>=1.2.0 onwards =)
pywsd>=1.2.0
I have python 2.7 and i work on windows10 operating system. I installed the
lesk
library as per documentation. When i try to import the module usingfrom pywsd.lesk import simple_lesk
I end up getting error