uv icon indicating copy to clipboard operation
uv copied to clipboard

failed to copy file from /home/runstone/.cache/uv/archive-v0/xxx/h11-0.14.0.dist-info/RECORD to /home/runstone/work/git/deer-flow/.venv/lib/python3.12/site-packages/h11-0.14.0.dist-info/RECORD: Cannot allocate memory (os error 12)

Open Abeautifulsnow opened this issue 6 months ago • 6 comments

Summary

when I use uv to add some package or uv sync my project, I frequently encouter an error like this: Cannot allocate memory (os error 12)

╰─ uv sync
Resolved 117 packages in 2ms
Uninstalled 21 packages in 32ms
error: Failed to install: urllib3-2.3.0-py3-none-any.whl (urllib3==2.3.0)
  Caused by: failed to copy file from /home/runstone/.cache/uv/archive-v0/1AKRcdkKZzDz8LMvn-ZG7/urllib3-2.3.0.dist-info/RECORD to /home/runstone/work/git/deer-flow/.venv/lib/python3.12/site-packages/urllib3-2.3.0.dist-info/RECORD: Cannot allocate memory (os error 12)

╰─ uv add urllib3
Resolved 117 packages in 1.41s
warning: `aiohttp==3.11.13` is yanked (reason: "Regression: https://github.com/aio-libs/aiohttp/issues/10617")
warning: `aiohttp==3.11.13` is yanked (reason: "Regression: https://github.com/aio-libs/aiohttp/issues/10617")
      Built deer-flow @ file:///home/runstone/work/git/deer-flow
Prepared 1 package in 416ms
Uninstalled 17 packages in 26ms
error: Failed to install: h11-0.14.0-py3-none-any.whl (h11==0.14.0)
  Caused by: failed to copy file from /home/runstone/.cache/uv/archive-v0/MgAPJACNb6eRs6YxwdROY/h11-0.14.0.dist-info/RECORD to /home/runstone/work/git/deer-flow/.venv/lib/python3.12/site-packages/h11-0.14.0.dist-info/RECORD: Cannot allocate memory (os error 12)


╰─ uv add uvicorn
Resolved 117 packages in 1ms
      Built deer-flow @ file:///home/runstone/work/git/deer-flow
Prepared 1 package in 1.15s
Uninstalled 17 packages in 35ms
error: Failed to install: urllib3-2.3.0-py3-none-any.whl (urllib3==2.3.0)
  Caused by: failed to copy file from /home/runstone/.cache/uv/archive-v0/1AKRcdkKZzDz8LMvn-ZG7/urllib3-2.3.0.dist-info/RECORD to /home/runstone/work/git/deer-flow/.venv/lib/python3.12/site-packages/urllib3-2.3.0.dist-info/RECORD: Cannot allocate memory (os error 12)

╰─ uv run server.py
      Built deer-flow @ file:///home/runstone/work/git/deer-flow
Uninstalled 17 packages in 36ms
error: Failed to install: h11-0.14.0-py3-none-any.whl (h11==0.14.0)
  Caused by: failed to copy file from /home/runstone/.cache/uv/archive-v0/MgAPJACNb6eRs6YxwdROY/h11-0.14.0.dist-info/RECORD to /home/runstone/work/git/deer-flow/.venv/lib/python3.12/site-packages/h11-0.14.0.dist-info/RECORD: Cannot allocate memory (os error 12)

╰─ uv run python --version
Uninstalled 16 packages in 34ms
error: Failed to install: h11-0.14.0-py3-none-any.whl (h11==0.14.0)
  Caused by: failed to copy file from /home/runstone/.cache/uv/archive-v0/MgAPJACNb6eRs6YxwdROY/h11-0.14.0.dist-info/RECORD to /home/runstone/work/git/deer-flow/.venv/lib/python3.12/site-packages/h11-0.14.0.dist-info/RECORD: Cannot allocate memory (os error 12)

Platform

wsl1(Ubuntu-22.04) Linux 4.4.0-26100-Microsoft x86_64 GNU/Linux

Version

uv 0.7.3

Python version

Python 3.12.10

Abeautifulsnow avatar May 16 '25 02:05 Abeautifulsnow

How much RAM does the machine have, and are there any limits set on WSL1? Do you have any other processes running allocating a lot of memory?

konstin avatar May 16 '25 08:05 konstin

How much RAM does the machine have, and are there any limits set on WSL1? Do you have any other processes running allocating a lot of memory?

Image

As you can see from the above, there is still several GB of RAM space available.

Abeautifulsnow avatar May 16 '25 09:05 Abeautifulsnow

Can you share a pyproject.toml that reproduces the problem? Does this happen with any package installation or only with specific packages?

konstin avatar May 16 '25 09:05 konstin

Can you share a pyproject.toml that reproduces the problem? Does this happen with any package installation or only with specific packages?

Yes, here are the packages in pyproject.toml file.

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "deer-flow"
version = "0.1.0"
description = "DeerFlow project"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "httpx>=0.28.1",
    "langchain-community>=0.3.19",
    "langchain-experimental>=0.3.4",
    "langchain-openai>=0.3.8",
    "langgraph>=0.3.5",
    "readabilipy>=0.3.0",
    "python-dotenv>=1.0.1",
    "socksio>=1.0.0",
    "markdownify>=1.1.0",
    "fastapi>=0.110.0",
    "uvicorn>=0.27.1",
    "sse-starlette>=1.6.5",
    "pandas>=2.2.3",
    "numpy>=2.2.3",
    "yfinance>=0.2.54",
    "litellm>=1.63.11",
    "json-repair>=0.7.0",
    "jinja2>=3.1.3",
    "duckduckgo-search>=8.0.0",
    "inquirerpy>=0.3.4",
    "arxiv>=2.2.0",
    "mcp>=1.6.0",
    "langchain-mcp-adapters>=0.0.9",
]

Does this happen with any package installation or only with specific packages?

No, I think it is almost random and unpredictable.

I believe the situation is quite complex. When I have the following configurations in place, installation consistently fails.

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

However, in the absence of these configurations, some packages can be installed successfully. Yet, with certain other packages added to the mix, the installation fails again.

may success

[project]
name = "demo"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "pandas>=2.2.3",
    "sqlalchemy>=2.0.38",
    "jinja2",
    "pydantic"
]

may fail

readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "pandas>=2.2.3",
    "sqlalchemy>=2.0.38",
    "jinja2",
    "pydantic",
    "langchain"
]

Error msg:

╰─ uv sync
Resolved 42 packages in 1.41s
Uninstalled 21 packages in 2ms
error: Failed to install: pyyaml-6.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (pyyaml==6.0.2)
  Caused by: failed to copy file from /home/runstone/.cache/uv/archive-v0/faPVSNCp4ed1tazaCCLvN/PyYAML-6.0.2.dist-info/RECORD to /home/runstone/work/test/demo/.venv/lib/python3.10/site-packages/PyYAML-6.0.2.dist-info/RECORD: Cannot allocate memory (os error 12)

Abeautifulsnow avatar May 16 '25 15:05 Abeautifulsnow

Does reducing the number of concurrent installs, concurrent downloads and concurrent builds help (https://docs.astral.sh/uv/reference/settings/#concurrent-installs)?

konstin avatar May 16 '25 15:05 konstin

Does reducing the number of concurrent installs, concurrent downloads and concurrent builds help (https://docs.astral.sh/uv/reference/settings/#concurrent-installs)?

Thank you for your response. I have now set the concurrency level to 4, and the builds are mostly successful. I also tried setting it to 8, 10, and 20, but in those cases, failures became much more frequent. My machine has 20 CPU cores as reported by nproc. This behavior does seem quite strange. 😂

PS: By the way, on my Windows host machine, everything behaves normally — there's no need to manually set the concurrency level.

Abeautifulsnow avatar May 17 '25 07:05 Abeautifulsnow

That means it's a limitation by the platform (WSL1), not by uv.

konstin avatar May 19 '25 08:05 konstin

I ran into the same “Cannot allocate memory (os error 12)” issue when installing the github-specify tool with uv on WSL1.

Just leaving this here in case it helps anyone — following @konstin suggestion to limit concurrent installs fixed it for me:

UV_CONCURRENT_INSTALLS=1 uv tool install specify-cli --from git+https://github.com/github/spec-kit.git

vuljormp avatar Oct 07 '25 07:10 vuljormp

https://github.com/astral-sh/uv/issues/13481#issuecomment-3375527015 this is useful for me.

bangbao avatar Nov 12 '25 05:11 bangbao