Skip to content

Instantly share code, notes, and snippets.

@yanndebray
Created September 12, 2025 15:35
Show Gist options
  • Save yanndebray/3d7e7f671795a957a3b4f1ceaf881729 to your computer and use it in GitHub Desktop.
Save yanndebray/3d7e7f671795a957a3b4f1ceaf881729 to your computer and use it in GitHub Desktop.
% % Install uv
!curl -LsSf https://astral.sh/uv/install.sh | sh
% % Set up uv
% 1) Point PATH to where uv was installed
setenv('PATH', getenv('HOME')+"/.local/bin:"+getenv('PATH'));
% Sanity checks
system('which uv'); % should print ~/.local/bin/uv
system('uv --version');
system('python --version');
% % Create and activate a virtual environment
% Setting the --clear flag to reset already existing environment called env that might exist in the same location
% 2) Create a venv OUTSIDE MATLAB Drive (symlinks are fine here)
system('uv venv --clear /home/matlab/venvs/env');
% 3) "Activate" it for this MATLAB session
setenv('VIRTUAL_ENV','/home/matlab/venvs/env');
setenv('PATH', "/home/matlab/venvs/env/bin:" +getenv('PATH'));
% % Install the required packages and dependencies
!uv pip install torch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment