pixi
pixi copied to clipboard
Add `--offline` flag to pixi commands
Problem description
In case of limited internet access, it can be quite useful to force Pixi to rely on cached packages.
pixi add python --offline would then directly use Python 3.12 from the cache even though Python 3.13 is available on conda-forge.
That's a very good addition. There's so many cases where it's useful. I hope this enhancement get implanted very soon.
Yep, worth hoisting to PIXI_OFFLINE, probably, as well.
Yeah, like mamba --offline flag, skip fetching 10MB+ repodata.json file and use cache directly.
Any update on this ? Working on a pixi project offline (but with all deps already installed) is very frustrating as we still need internet to activate the env. There is a workaround if we manually save the shell-hook but VSCode tries to load the environment every time I run pytest and there is no easy way to change this behaviour.
@MathisTLD that sounds like a bug- can you run with -vvv to check why it thinks that it needs to update the environment? Usually, for running things, no internet access should be needed.
@wolfv I can't reproduce for now by disconnecting my computer from internet but I had the bug this morning while in a train with unstable connection. I'll remember to post logs here if I can reproduce in the future.
@MathisTLD that sounds like a bug- can you run with -vvv to check why it thinks that it needs to update the environment? Usually, for running things, no internet access should be needed.
Ok I finally managed to reproduce. See logs below.
I think pixi-build is the cause of my problem but not 100% sure. In my case everything is already downloaded there is no need for internet
➜ shyrun git:(main) ✗ pixi shell -vvv
INFO pixi_manifest::discovery: Found manifest in directory: "/Users/mathis/Documents/git/shynet/shynet/shyrun", continuing further.
DEBUG pixi_config: Loading config from /etc/pixi/config.toml
DEBUG pixi_config: Loading config from /Users/mathis/Library/Application Support/pixi/config.toml
DEBUG pixi_config: Loading config from /Users/mathis/.pixi/config.toml
DEBUG pixi_config: Loading config from /Users/mathis/Documents/git/shynet/shynet/shyrun/.pixi/config.toml
DEBUG pixi_config: Failed to load local config: /Users/mathis/Documents/git/shynet/shynet/shyrun/.pixi/config.toml (error: no file was found at /Users/mathis/Documents/git/shynet/shynet/shyrun/.pixi/config.toml)
INFO pixi::environment: verifying prefix location is unchanged, with prefix file: /Users/mathis/Documents/git/shynet/shynet/shyrun/.pixi/envs/conda-meta/pixi_env_prefix
INFO pixi::lock_file::update: the lock-file is up-to-date
DEBUG pixi::lock_file::update: Lock file contains source packages: ignore lock file hash and update the prefix
INFO pixi::lock_file::virtual_packages: Required virtual packages of environment 'default': __osx >=11.0, __unix, __osx >=11.0, __unix, __osx >=11.0
DEBUG pixi::lock_file::virtual_packages: Generic system virtual packages for env: 'default' : [__archspec: __archspec=1=m1, __unix: __unix=0=0, __osx: __osx=15.5=0]
DEBUG pixi::lock_file::virtual_packages: Required virtual package: __osx >=11.0 matches the system
DEBUG pixi::lock_file::virtual_packages: Skipping virtual package: __unix as it's not in the accepted packages
DEBUG pixi::lock_file::virtual_packages: Required virtual package: __osx >=11.0 matches the system
DEBUG pixi::lock_file::virtual_packages: Skipping virtual package: __unix as it's not in the accepted packages
DEBUG pixi::lock_file::virtual_packages: Required virtual package: __osx >=11.0 matches the system
INFO pixi::lock_file::update: Updating prefix: '/Users/mathis/Documents/git/shynet/shynet/shyrun/.pixi/envs/default'
DEBUG pixi_utils::reqwest: Using s3_config: {}
INFO rattler_networking::s3_middleware: Creating S3 middleware using {}
DEBUG pixi_utils::reqwest: s3_middleware: S3Middleware { s3: S3 { auth_storage: AuthenticationStorage { backends: [KeyringAuthenticationStorage { store_key: "rattler" }, FileStorage { path: "/Users/mathis/.rattler/credentials.json", cache: RwLock { data: FileStorageCache { content: {} }, poisoned: false, .. } }, NetRcStorage { machines: {} }], cache: Mutex { data: {}, poisoned: false, .. } }, config: {}, expiration: 300s } }
DEBUG pixi::environment::conda_prefix: updating prefix for 'default'
DEBUG pixi::rlimit: Attempted to set RLIMIT_NOFILE to 1024 but was already set to 2560
⠒ building packages [00:00:14] [────────────────────] 0/1