Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrapped Python Failed to hardlink files; Error #6397

Closed
beratcmn opened this issue Aug 22, 2024 · 7 comments
Closed

Bootstrapped Python Failed to hardlink files; Error #6397

beratcmn opened this issue Aug 22, 2024 · 7 comments
Labels
question Asking for clarification or support

Comments

@beratcmn
Copy link

beratcmn commented Aug 22, 2024

Here is the full flow that leads to this warning:

[03:54:11] berat /e/Projects/python/uv_test>uv init
Initialized project `uv-test`
[03:54:12] berat /e/Projects/python/uv_test>uv add fastapi
Using Python 3.10.14
Creating virtualenv at: .venv
Resolved 11 packages in 46ms
   Built uv-test @ file:///E:/Projects/Python/uv_test
Prepared 11 packages in 1.16s
░░░░░░░░░░░░░░░░░░░░ [0/11] Installing wheels...                                                                                                                                                                                            warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 11 packages in 112ms
 + annotated-types==0.7.0
 + anyio==4.4.0
 + exceptiongroup==1.2.2
 + fastapi==0.112.1
 + idna==3.7
 + pydantic==2.8.2
 + pydantic-core==2.20.1
 + sniffio==1.3.1
 + starlette==0.38.2
 + typing-extensions==4.12.2
 + uv-test==0.1.0 (from file:///E:/Projects/Python/uv_test)
[03:54:18] berat /e/Projects/python/uv_test>

System: Windows 11 Pro
Python Version: Python 3.10.14 Installed via UV
UV Version: uv 0.3.1 (be17d13 2024-08-21)

I removed Python 3.10.11 that was installed through official website in order to bootstrap the Python, but it gave this warning with major performance loss after installing the Python from the cli.

@beratcmn beratcmn changed the title Bootstrapped Python Failed to hardlink files; Error Bootstrapped Python Failed to hardlink files; Error Aug 22, 2024
@charliermarsh
Copy link
Member

The Python itself shouldn't be relevant here -- this is about the relationship between the cache directory and the drive you're installing on. I'm guessing your cache is not on file:///E:? You can use --cache-dir or UV_CACHE_DIR to set a different cache directory on file:///E:.

@charliermarsh charliermarsh added the question Asking for clarification or support label Aug 22, 2024
@zanieb
Copy link
Member

zanieb commented Aug 22, 2024

This is briefly discussed at https://docs.astral.sh/uv/concepts/cache/#cache-directory — let me know if think the documentation needs more.

@beratcmn
Copy link
Author

Thank you both @charliermarsh and @zanieb! Setting the env variable UV_CACHE_DIR = "E:\uv\cache" worked!

Here are the terminal outputs:

[08:21:02] berat /e/Projects/python/uv_test>uv --help
An extremely fast Python package manager.

Usage: uv.exe [OPTIONS] <COMMAND>

Commands:
  run      Run a command or script
  init     Create a new project
  add      Add dependencies to the project
  remove   Remove dependencies from the project
  sync     Update the project's environment
  lock     Update the project's lockfile
  tree     Display the project's dependency tree
  tool     Run and install commands provided by Python packages
  python   Manage Python versions and installations
  pip      Manage Python packages with a pip-compatible interface
  venv     Create a virtual environment
  cache    Manage uv's cache
  self     Manage the uv executable
  version  Display uv's version
  help     Display documentation for a command

Cache options:
  -n, --no-cache               Avoid reading from or writing to the cache,
                               instead using a temporary directory for the
                               duration of the operation [env: UV_NO_CACHE=]
      --cache-dir <CACHE_DIR>  Path to the cache directory [env:
                               UV_CACHE_DIR=E:\uv\cache]

Python options:
      --python-preference <PYTHON_PREFERENCE>
          Whether to prefer uv-managed or system Python installations [possible
          values: only-managed, managed, system, only-system]
      --no-python-downloads
          Disable automatic downloads of Python

Global options:
  -q, --quiet
          Do not print any output
  -v, --verbose...
          Use verbose output
      --color <COLOR_CHOICE>
          Control colors in output [default: auto] [possible values: auto,
          always, never]
      --native-tls
          Whether to load TLS certificates from the platform's native
          certificate store [env: UV_NATIVE_TLS=]
      --offline
          Disable network access
      --no-progress
          Hide all progress outputs
      --config-file <CONFIG_FILE>
          The path to a `uv.toml` file to use for configuration [env:
          UV_CONFIG_FILE=]
      --no-config
          Avoid discovering configuration files (`pyproject.toml`, `uv.toml`)
          [env: UV_NO_CONFIG=]
  -h, --help
          Display the concise help for this command
  -V, --version
          Display the uv version

Use `uv help` for more details.
[08:21:10] berat /e/Projects/python/uv_test>uv init
Initialized project `uv-test`
[08:21:26] berat /e/Projects/python/uv_test>uv add requests
Using Python 3.10.14
Creating virtualenv at: .venv
Resolved 6 packages in 240ms
   Built uv-test @ file:///E:/Projects/Python/uv_test
Prepared 6 packages in 1.98s
Installed 6 packages in 61ms
 + certifi==2024.7.4
 + charset-normalizer==3.3.2
 + idna==3.7
 + requests==2.32.3
 + urllib3==2.2.2
 + uv-test==0.1.0 (from file:///E:/Projects/Python/uv_test)
[08:21:33] berat /e/Projects/python/uv_test>

@T-256
Copy link
Contributor

T-256 commented Aug 22, 2024

let me know if think the documentation needs more.

I think it %LOCALAPPDATA%\uv\cache could be more familiar for Windows user instead of {FOLDERID_LocalAppData}.

@tejinderss
Copy link

Hi, I am having same issues on a linux file system, and my target is a virtualenv and .cache is set to same file path as well. Is there a way to debug this further?

@rafaeljcd
Copy link

Hello

on windows 11 there is dev drive https://learn.microsoft.com/en-us/windows/dev-drive/#storing-package-cache-on-dev-drive

It would be great if the user have updated their pip cache directory, uv would be able to detect it too

Pip cache (Python): Create a pip cache directory in your Dev Drive, for example D:\packages\pip, then set a global environment variable PIP_CACHE_DIR to that path, for example setx /M PIP_CACHE_DIR D:\packages\pip. If you have already restored pip packages and Wheels on your machine, move the contents of %LocalAppData%\pip\Cache to this directory. Learn more in the pip docs: pip caching and see StackOverflow to Change directory of pip cache on Linux?.

@zanieb
Copy link
Member

zanieb commented Sep 29, 2024

We can't read pip environment variable, their cache is quite different from ours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Asking for clarification or support
Projects
None yet
Development

No branches or pull requests

6 participants