Python : Correct way of installing custom packages?

For example I need natsort for one of my Python scripts in Rhino: natsort · PyPI

Do I have to first install Python on my system then use pip?

Or is there any other way to do it using Rhino?

Does this guide help?

If it does not, we can try to determine how to get it to work.

nope, does not work.
I simply get:

Read the instructions you were given a little further down. Pay attention to the part where it says:

# r: numpy
1 Like

yes,
you are right

1 Like

It cannot find it in the path. Where is Numpy installed on the computer?

What search paths are set in the editor?

There is a box icon in the editor toolbar that will allow the pre-heating loading if the packages. See if that works?

As @James_Parrott was mentioning I didn’t Copy-Paste # r: numpy

Works like a charm.
Better would be to have a Package Manager for the Script Editor, to add and remove packages.

There is this Packages tool to reach into packages and set them up in the script with the requirements:

Packages Guide GHPython
image

Also, there are ways to add Libraries to a local folder: Local Python folders search

1 Like

Ok, I see, another way to install packages is by clicking the box and specifying the source.

Package Manager should also have a list of already installed packages though…
With uninstall option.

Just type in natsort. No need to specify the pypi.org path

1 Like

@eirannejad , I installed the latest Rhino update and afterwards the natsort library cannot be found. I had to install it again. This looks like a bug, no?

@Bogdan_Chipara

Sometimes a new Rhino re-initializes the Python 3 environment to apply updates. Make sure to include the script requirements at the top e.g. # r: natsort so it can be installed automatically if missing.

1 Like

ok, If this is good for Rhino I will comply :smiley:

1 Like