Pip install for IronPython

Hi I have been reading these three threads from three years ago, trying to figure out if there is easier way to pip install python modules through cmd

I am wondering have there been any update since?
Is there a easier way now install packages in IronPython 2.7.8?
If I pip install compatable 2.7 IronPython package through command line, will it just work in Rhino and gh, or do I still need to set something up somewhere else?

I tried many things today. Including trying to replace the original IronPython directory in Rhino with a full install. However it doesn’t work and I still have to go back to the old method.
Here is my whole solution, just in case if anyone is having trouble understanding other posts:

  1. Find IronPython version in either rhino or gh python editor
import sys
print sys.version_info

    mine returns 2 7 8
    (source: https://www.w3resource.com/python-exercises/python-basic-exercise-2.php)

  1. So I downloaded version 2.7.8 and did a new install (wont affect my installed Rhino IronPython)
    (Source: https://github.com/IronLanguages/ironpython2/releases/tag/ipy-2.7.8)

  2. Add newly installed IronPython to Environment Variable Path
    windows search -> edit the system environment variables -> environment variables -> user variables for xxx -> double click on “Path” -> New -> type “C:\Program Files\IronPython 2.7” or whatever path you installed

  3. Install PIP and your package
    windows search “cmd” -> right click run as admin
    to install pip or make sure pip is installed

ipy -X:Frames -m ensurepip

    to install package (use package “xlrd” as an example here)

ipy -X:Frames -m pip install xlrd

    (source: https://ironpython.net/blog/2014/12/07/pip-in-ironpython-275.html)

  1. Add the module directory to Rhino search scope
    I did a search in “C:\Program Files\IronPython 2.7”
    and seems that pip put the installed “xlrd” package in the directory “C:\Program Files\IronPython 2.7\Lib\site-packages”

    In Rhino type in the command “EditPythonScript”.
    In this Python editor go Tools -> Options -> Files.
    Add directory “C:\Program Files\IronPython 2.7\Lib\site-packages”
    and “C:\Program Files\IronPython 2.7\Lib”

    (source: https://www.grasshopper3d.com/forum/topics/excel-gh-python)

Should have no error now when running

import xlrd

in either rhino or gh python editor, should work now

**will take no responsibility if you break anything

1 Like