Issue After Installing psycopg2

I have two Conda environments with and without psycopg2. After installing psycopg2, prodigy starts to throw this error:

alistairmayo@Alistairs-MBP prodigy-test % prodigy
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/", line 188, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/", line 147, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/", line 111, in _get_module_details
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/site-packages/prodigy/", line 1, in <module>
    from .util import init_package
  File "cython_src/prodigy/util.pyx", line 16, in init prodigy.util
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/site-packages/spacy/", line 11, in <module>
    from thinc.api import prefer_gpu, require_gpu, require_cpu  # noqa: F401
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/site-packages/thinc/", line 2, in <module>
    from .initializers import normal_init, uniform_init, glorot_uniform_init, zero_init
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/site-packages/thinc/", line 4, in <module>
    from .backends import Ops
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/site-packages/thinc/backends/", line 8, in <module>
    from .cupy_ops import CupyOps, has_cupy
  File "/opt/homebrew/Caskroom/miniforge/base/envs/spacy-test/lib/python3.9/site-packages/thinc/backends/", line 19, in <module>
    from .numpy_ops import NumpyOps
  File "thinc/backends/numpy_ops.pyx", line 1, in init thinc.backends.numpy_ops
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 80 from PyObject

Hi @alistairmayo , welcome to Prodigy! I haven't tested this, but usually this error shows up when you have multiple installations of spaCy and your application (in this case, Prodigy) is accessing something different. In general, you'd want to keep your installations within a single env.

You can probably work with a virtualenv instead. Install spaCy, psycopg2, and prodigy within that virtualenv and try running Prodigy. You should be able to achieve the same setup if you're using conda.

Awesome thank you! I had been using Conda (with much frustration), as recommended by Apple for Tensorflow M1 support. I found you can completely forgo the tensorflow-deps package that they recommend by manually installing that package's dependencies! Thank you, this is so much easier...

1 Like