Trusted-host for python initialization

Hello,

I am using grasshopper on my compagny environment which has some restrictions and only allow installation with some trusted-host option in python commands.
So far I cannot use python script editor in Rhino/Grasshopper because I cannot find the way to add this trusted-host to automatic installation by Rhino.
Do you have any tip on what should I do ?

Thanks a lot

##########Error message###########
Info 1/29/2025 12:40:11 PM [RhinoCode] Storage Site Registered: Local Drive (mcneel.eto.file)
Info 1/29/2025 12:40:11 PM [RhinoCode] Storage Site Registered: Rhino Files (mcneel.rhinoFiles.file)
Info 1/29/2025 12:40:11 PM [RhinoCode] Storage Site Registered: Web (mcneel.console.http)
Info 1/29/2025 12:40:11 PM [RhinoCode] Rhino3D Initialized on Windows - NETCoreApp
Info 1/29/2025 12:40:11 PM [RhinoCode] Platform Registered: Rhinoceros 3D @ 8.15.25019.13001 (mcneel.rhino3d.rhino)
Info 1/29/2025 12:40:11 PM [RhinoCode] Storage Site Registered: Rhino3D Project (mcneel.rhino3d.project)
Info 1/29/2025 12:40:11 PM [RhinoCode] Operating System: Microsoft Windows NT 10.0.26100.0
Info 1/29/2025 12:40:11 PM [RhinoCode] RhinoCode server starting on \\.\pipe\rhinocode_remotepipe_500
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Registered: Plain Text 1.0 (rhinocode.builtin.text)
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Registered: JSON 1.0 (rhinocode.builtin.json)
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Registered: Yaml 1.0 (rhinocode.builtin.yaml)
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Registered: Git DotFile 1.0 (rhinocode.builtin.gitDotFile)
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Loader Registered: mcneel.pythonnet.python@3.*
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Loader Registered: mcneel.ironpython.python@2.*
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Loader Registered: mcneel.roslyn.csharp@9.*
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Loader Registered: mcneel.gh1.grasshopper@1.*
Info 1/29/2025 12:40:11 PM [RhinoCode] Language Loader Registered: mcneel.markdig.markdown@0.*
Info 1/29/2025 12:40:41 PM [RhinoCode] Language Registered: Python 3.9.10 (mcneel.pythonnet.python)
Info 1/29/2025 12:40:41 PM [RhinoCode] Initializing CPython 3.9.10/43 runtime
Info 1/29/2025 12:40:43 PM [RhinoCode] Configuring runtime@py39-rh8 for the first time on X64
Info 1/29/2025 12:40:43 PM [RhinoCode] Deploying CPython 3.9.10/43 runtime
Info 1/29/2025 12:40:43 PM [RhinoCode] Clearing exiting runtime
Info 1/29/2025 12:40:43 PM [RhinoCode] Successfully uninstalled existing runtime at C:\Users\RhinoComputeUser\.rhinocode\py39-rh8
Info 1/29/2025 12:41:20 PM [RhinoCode] Installing pip (get-pip)
Info 1/29/2025 12:41:20 PM [RhinoCode] Running process: C:\Users\RhinoComputeUser\.rhinocode\py39-rh8\python.exe -I get-pip.py --no-warn-script-location pip setuptools wheel
Error 1/29/2025 12:47:36 PM [RhinoCode] Process exited with code 1
Error 1/29/2025 12:47:36 PM [RhinoCode] Failed to install latest pip | 
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnec

What information do you need to mark python as trusted? The binary is located at %APPDATA%\.rhinocode\py39-rh8\python.exe (Windows). The .rhinocode folder location can also be customized

Hi @Romain_Battini
To fix the trusted-host for Python you can also do it manually.
Find the pip.ini and update it as following :

[global]
trusted-host = pypi.org
               pypi.python.org
               files.pythonhosted.org

Even though I believe It would make more sense to make an exception for pip, maybe your network administrator should take on this.

If I were your network administrator, I would consider making a mirror, that is on a trusted host, which can access Pip packages indexes
Hope this sparks some ideas,
Farouk

1 Like

We deploy a pip.ini file under the python3 folder (%APPDATA%\.rhinocode\py39-rh8) as well. Try adding these configs there and let me know if it works

I need to trust pypi.org / pypi.python.org / files.pythonhosted.org. Without it, I cannot install any python 3 module on normal computer Rhino installation. Regarding my rhino.compute instal, it is need to install pip (python get-pip.py trsuted-host …).

I tried customizing the .rhinocode folder but it is not working for rhino.compute as the installation starts from 0 each time since pip could not be installed

As I explained on my answer above, the rhino.compute installation fails because pip cannot be installed. Therefore the ini.pip is always overwritten each time I try to setup the python environment.
By setting up python, I simply go to GH and double click on the python3 component. When doing this the setup takes place but the ini.pip is always overwritten

Thank you for your proposal. As soon as I will be able to install pip I will modify the ini file.

Unfortunately there will never be any exception for pip and python by my network team… large compagnies often block it