diff --git a/src/zipline/_protocol.pxd b/src/zipline/_protocol.pxd index e93e3b9a94..20c57ad283 100644 --- a/src/zipline/_protocol.pxd +++ b/src/zipline/_protocol.pxd @@ -1,5 +1,5 @@ cimport numpy as np - +import numpy; numpy.import_array() from zipline.assets._assets cimport Asset diff --git a/src/zipline/assets/_assets.pyx b/src/zipline/assets/_assets.pyx index 50a2e6bbea..69de80f504 100644 --- a/src/zipline/assets/_assets.pyx +++ b/src/zipline/assets/_assets.pyx @@ -33,6 +33,7 @@ import numpy as np from numpy cimport int64_t import warnings cimport numpy as np +import numpy; numpy.import_array() from zipline.utils.calendar_utils import get_calendar diff --git a/src/zipline/assets/continuous_futures.pyx b/src/zipline/assets/continuous_futures.pyx index f673a3ce07..496b879a0f 100644 --- a/src/zipline/assets/continuous_futures.pyx +++ b/src/zipline/assets/continuous_futures.pyx @@ -27,7 +27,7 @@ from cpython.object cimport ( Py_LT, ) from cpython cimport bool - +import numpy; numpy.import_array() from functools import partial from numpy import array, empty, iinfo diff --git a/src/zipline/data/_adjustments.pyx b/src/zipline/data/_adjustments.pyx index a85ba462c1..458bc17618 100644 --- a/src/zipline/data/_adjustments.pyx +++ b/src/zipline/data/_adjustments.pyx @@ -25,6 +25,8 @@ from numpy import ( zeros, ) from numpy cimport float64_t, int64_t, ndarray +import numpy +numpy.import_array() from pandas import Timestamp ctypedef object Timestamp_t diff --git a/src/zipline/data/_equities.pyx b/src/zipline/data/_equities.pyx index a052804964..784e2351f6 100644 --- a/src/zipline/data/_equities.pyx +++ b/src/zipline/data/_equities.pyx @@ -32,7 +32,7 @@ from numpy cimport ( uint8_t, ) from numpy.math cimport NAN - +import numpy; numpy.import_array() ctypedef object carray_t ctypedef object ctable_t ctypedef object Timestamp_t diff --git a/src/zipline/data/_minute_bar_internal.pyx b/src/zipline/data/_minute_bar_internal.pyx index 8dee07b2da..76788f5aa7 100644 --- a/src/zipline/data/_minute_bar_internal.pyx +++ b/src/zipline/data/_minute_bar_internal.pyx @@ -1,4 +1,5 @@ from numpy cimport ndarray, int64_t +import numpy; numpy.import_array() from numpy import searchsorted from cpython cimport bool cimport cython diff --git a/src/zipline/data/_resample.pyx b/src/zipline/data/_resample.pyx index 22bd9f8d32..d79771890f 100644 --- a/src/zipline/data/_resample.pyx +++ b/src/zipline/data/_resample.pyx @@ -14,6 +14,7 @@ from cython cimport boundscheck, wraparound from numpy import finfo, float64, nan, isnan from numpy cimport intp_t, float64_t, uint32_t +import numpy; numpy.import_array() @boundscheck(False) @wraparound(False) diff --git a/src/zipline/gens/sim_engine.pyx b/src/zipline/gens/sim_engine.pyx index b15a70fcc9..a8eb51bc24 100644 --- a/src/zipline/gens/sim_engine.pyx +++ b/src/zipline/gens/sim_engine.pyx @@ -15,6 +15,7 @@ cimport cython cimport numpy as np +import numpy; numpy.import_array() import numpy as np import pandas as pd from cpython cimport bool diff --git a/src/zipline/lib/_factorize.pyx b/src/zipline/lib/_factorize.pyx index 6774286740..5e269d2392 100644 --- a/src/zipline/lib/_factorize.pyx +++ b/src/zipline/lib/_factorize.pyx @@ -5,6 +5,7 @@ from cpython cimport Py_LT from libc.math cimport log cimport numpy as np import numpy as np +np.import_array() from zipline.utils.numpy_utils import unsigned_int_dtype_with_size_in_bytes diff --git a/src/zipline/lib/_float64window.pyx b/src/zipline/lib/_float64window.pyx index 1747b014e3..07c279d625 100644 --- a/src/zipline/lib/_float64window.pyx +++ b/src/zipline/lib/_float64window.pyx @@ -2,6 +2,7 @@ float specialization of AdjustedArrayWindow """ from numpy cimport float64_t +import numpy; numpy.import_array() ctypedef float64_t[:, :] databuffer include "_windowtemplate.pxi" diff --git a/src/zipline/lib/_int64window.pyx b/src/zipline/lib/_int64window.pyx index d30b97cac4..84b8b56467 100644 --- a/src/zipline/lib/_int64window.pyx +++ b/src/zipline/lib/_int64window.pyx @@ -2,6 +2,7 @@ datetime specialization of AdjustedArrayWindow """ from numpy cimport int64_t +import numpy; numpy.import_array() ctypedef int64_t[:, :] databuffer diff --git a/src/zipline/lib/_uint8window.pyx b/src/zipline/lib/_uint8window.pyx index 8b8ce98b2b..7e2aeb4756 100644 --- a/src/zipline/lib/_uint8window.pyx +++ b/src/zipline/lib/_uint8window.pyx @@ -2,6 +2,7 @@ bool specialization of AdjustedArrayWindow """ from numpy cimport uint8_t +import numpy; numpy.import_array() ctypedef uint8_t[:, :] databuffer diff --git a/src/zipline/lib/adjustment.pyx b/src/zipline/lib/adjustment.pyx index bd0e4794ea..71c4872fb4 100644 --- a/src/zipline/lib/adjustment.pyx +++ b/src/zipline/lib/adjustment.pyx @@ -6,6 +6,7 @@ from pandas import isnull, Timestamp cimport numpy as np from numpy cimport float64_t, uint8_t, int64_t from numpy import asarray, datetime64, float64, int64, bool_, uint8 +import numpy; numpy.import_array() from zipline.utils.compat import unicode diff --git a/src/zipline/lib/rank.pyx b/src/zipline/lib/rank.pyx index 1a45e54724..d807276d3b 100644 --- a/src/zipline/lib/rank.pyx +++ b/src/zipline/lib/rank.pyx @@ -3,7 +3,7 @@ Functions for ranking and sorting. """ cimport cython cimport numpy as np - +import numpy; numpy.import_array() import numpy as np from cpython cimport bool from scipy.stats import rankdata