How do I install a Python package from a URL in Rhino 8 Script Editor?

Hello!

I’m trying to install PyTorch in Rhino 8 using the new script editor, and I want to install it from the official PyTorch URL for CUDA 12.6. https://pytorch.org/get-started/locally/

In my script file, I added the following header:

#! python 3
# venv: torch_env
# r: torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126

Using pip would be like:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

However, this doesn’t seem to be the correct way to install packages via a URL in Rhino 8 as torch doesn’t get installed with this requirement.

Any help or clarification would be appreciated!
@eirannejad

@hesham.k.shawqy

At the moment you would need to open the python shell from Tools > Advanced menu and install the packages from non-pypi sources manually. You will have access to pip that is shipped with Rhino in the shell

I have a ticket to implement support for other pip options in the # requirements directive

RH-75515 Allow using custom package sources

2 Likes