From 8308bbc61759c23566bf727bc592aca1dee80b45 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 29 Mar 2018 00:14:55 +0200 Subject: [PATCH] Get msgpack and msgpack_numpy via Thinc, to avoid potential version conflicts --- requirements.txt | 2 -- setup.py | 4 +--- spacy/pipeline.pyx | 4 +++- spacy/util.py | 7 ++++--- spacy/vectors.pyx | 7 ++++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/requirements.txt b/requirements.txt index dfc08447b..4fda2da37 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,5 +11,3 @@ dill>=0.2,<0.3 regex==2017.4.5 pytest>=3.0.6,<4.0.0 mock>=2.0.0,<3.0.0 -msgpack-python==0.5.4 -msgpack-numpy==0.4.1 diff --git a/setup.py b/setup.py index a1d32584f..b453ec1f4 100755 --- a/setup.py +++ b/setup.py @@ -194,9 +194,7 @@ def setup_package(): 'pathlib', 'ujson>=1.35', 'dill>=0.2,<0.3', - 'regex==2017.4.5', - 'msgpack-python==0.5.4', - 'msgpack-numpy==0.4.1'], + 'regex==2017.4.5'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', diff --git a/spacy/pipeline.pyx b/spacy/pipeline.pyx index 743f6ac85..6d14c4ca3 100644 --- a/spacy/pipeline.pyx +++ b/spacy/pipeline.pyx @@ -8,7 +8,9 @@ cimport numpy as np import cytoolz from collections import OrderedDict import ujson -import msgpack + +from .util import msgpack +from .util import msgpack_numpy from thinc.api import chain from thinc.v2v import Affine, SELU, Softmax diff --git a/spacy/util.py b/spacy/util.py index dc51e467d..04cc3c7aa 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -23,9 +23,10 @@ from .symbols import ORTH from .compat import cupy, CudaStream, path2str, basestring_, input_, unicode_ from .compat import import_file -import msgpack -import msgpack_numpy -msgpack_numpy.patch() +# Import these directly from Thinc, so that we're sure we always have the +# same version. +from thinc.neural._classes.model import msgpack +from thinc.neural._classes.model import msgpack_numpy LANGUAGES = {} diff --git a/spacy/vectors.pyx b/spacy/vectors.pyx index 1b265e189..30fce439c 100644 --- a/spacy/vectors.pyx +++ b/spacy/vectors.pyx @@ -3,9 +3,10 @@ from __future__ import unicode_literals import numpy from collections import OrderedDict -import msgpack -import msgpack_numpy -msgpack_numpy.patch() + +from .util import msgpack +from .util import msgpack_numpy + cimport numpy as np from thinc.neural.util import get_array_module from thinc.neural._classes.model import Model