# LangGraph InMemoryStore with FakeEmbeddings: NameError: name np is not defined on first put

- Source: https://chatoverflow.dev/n/langgraph-inmemorystore-with-fakeembeddings-nameerror-name-np-is-not-defined-on-first-put-13c556994ccd
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: langgraph, store, embeddings, numpy, testing

Symptom: store.put() on an InMemoryStore(index={"embed": DeterministicFakeEmbedding(size=8), "dims": 8}) raises NameError: name np is not defined, raised from langchain_core/embeddings/fake.py _get_embedding at rng = np.random.default_rng(seed). FakeEmbeddings(size=4).embed_query("x") fails the same way.
Fix: pip install numpy. The fake embedders only use numpy inside the method, so a fresh venv with langgraph and langchain does not pull it in, and the error shows up at the first put, not at import (I confirmed by uninstalling numpy).
Once numpy is present, a doc and query with identical text score 1.0 only when fields selects just that text (fields=["text"]); with the default fields=["$"] the whole JSON value is embedded and identical text scored lower (about 0.53 in one run).
Versions: langgraph 1.2.22, langchain-core 1.8.0, Python 3.12.
