Issue: Rhino8 freezes when I try install pip library in the ScriptEditor

When I try to install a python3 pip package in the ScriptEditor, the application freezes when I run the script.

This also happens for other libaries (e.g. “numpy”), when I include a version number (e.g. “firebase-admin==6.4.0”) and when I start rhino8 in safe mode.

About 4 months ago I was able to install and use this library with. Can anyone please help me solve this?

Thanks, Tim

#! python3

"""Requirements"""
# r: firebase-admin

import rhinoscriptsyntax as rs
import scriptcontext as sc
import math

import System
import System.Collections.Generic
import Rhino

"""Import packages"""
import firebase_admin
from firebase_admin import credentials
from firebase_admin import firestore

@timcastelijn

Found a pretty serious bug and fixing it right now for next 8.4RC

RH-80090 PIP sometimes gets stuck when installing package

Thanks for reporting this!

1 Like

RH-80090 is fixed in Rhino 8 Service Release 4

1 Like

Hi @eirannejad @brian,

in 8.4 release candidate, this mechanism works as expected again.

Thanks for the quick solution!

1 Like

Hi @eirannejad
Can you add progress bar or anything to show the installation process of pip library?

@anon39580149 Yes. I have it on the list

RH-79324 Script Editor to notify when installing packages but make it block the UI

1 Like

Hi @eirannejad ,

update March 2 2024:

solution by @eirannejad is still valid. The Issue below was casued by typo

the isolated test worked for me, but when implemented in my scripts, the -scriptEditor run "path/to/my_file.py" command seems to exit or crash without warning.

I see this information in the logger, and to me it seems that there’s an issue with installing the package.

possible it is related to using multiple files where requirements are defined (please see this post Packages are not installed when requirements defined inside modules)

I hope you can help me out.
Thanks,
Tim

Info 2/19/2024 1:47:18 PM [RhinoCode] Installing: firebase_admin
Info 2/19/2024 1:47:18 PM [RhinoCode] Running process: C:\Users\info\.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target "C:\Users\info\.rhinocode\py39-rh8\site-envs\default-nh_u8QdC" --upgrade --no-warn-script-location --retries 0 --timeout 1 "firebase_admin"
Info 2/19/2024 1:47:31 PM [RhinoCode] Running process: C:\Users\info\.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check list --path "C:\Users\info\.rhinocode\py39-rh8\site-envs\default-nh_u8QdC" --format freeze
Info 2/19/2024 1:48:21 PM [RhinoCode] Installing: firebase_admin
Info 2/19/2024 1:48:21 PM [RhinoCode] Running process: C:\Users\info\.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target "C:\Users\info\.rhinocode\py39-rh8\site-envs\default-nh_u8QdC" --upgrade --no-warn-script-location --retries 0 --timeout 1 "firebase_admin"
Error 2/19/2024 1:48:35 PM [RhinoCode] Process exited with code 2
Info 2/19/2024 1:51:11 PM [RhinoCode] Installing: firebase_admin
Info 2/19/2024 1:51:11 PM [RhinoCode] Running process: C:\Users\info\.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target "C:\Users\info\.rhinocode\py39-rh8\site-envs\default-nh_u8QdC" --upgrade --no-warn-script-location --retries 0 --timeout 1 "firebase_admin"
Error 2/19/2024 1:51:25 PM [RhinoCode] Process exited with code 2
Info 2/19/2024 1:51:32 PM [RhinoCode] Parsing configs schema "https://files.mcneel.com/schemas/rhinocode/editor.schema.v1.json" in C:\Users\info\.rhinocode\editor.json
Info 2/19/2024 1:51:32 PM [RhinoCode] File watcher start: C:\Users\info\.rhinocode\editor.json
Info 2/19/2024 1:51:32 PM [RhinoCode] File watcher start: D:\testProject.rhproj

update

when I try to run my script from the scripteditor itself I see the following logger information:

Info 2/19/2024 2:05:36 PM [RhinoCode] Installing: firebase_admin
Info 2/19/2024 2:05:36 PM [RhinoCode] Running process: C:\Users\info\.rhinocode\py39-rh8\python.exe -m pip --disable-pip-version-check install --target "C:\Users\info\.rhinocode\py39-rh8\site-envs\default-nh_u8QdC" --upgrade --no-warn-script-location --retries 0 --timeout 1 "firebase_admin"
Error 2/19/2024 2:05:50 PM [RhinoCode] Process exited with code 2
Error 2/19/2024 2:05:50 PM [RhinoCode] Error restoring packages | System.Exception: Error installing: firebase_admin | 
   at Rhino.Runtime.Code.Languages.PythonNet.CPythonEnviron.AddPackages(IEnumerable`1 pkgSpecs)
   at Rhino.Runtime.Code.Environments.Environ`1.Rhino.Runtime.Code.Environments.IEnviron.AddPackages(IEnumerable`1 pkgSpecs)
   at Rhino.Runtime.Code.Code.RestorePackages()
   at RhinoCodeEditor.Editor.Commands.WithCodeExecutableCommand.ExecuteCodeContext.RestoreCode()

@timcastelijn Are you on 8.4? I’ll test the pip install more and make sure scripteditor prints out errors

Hi @eirannejad,

no I’m on rhino 8.5

image

1 Like

I tried this many times on different Rhino versions and could not replicate this. The package is large and has many dependencies so it takes a bit to install.

Would you mind trying to install using python and pip in the rhino python 3 runtime directory?

  • Open powershell
  • Run C:\Users\info\.rhinocode\py39-rh8\python.exe -m pip install --target "C:\Users\info\.rhinocode\py39-rh8\site-envs\default-nh_u8QdC" "firebase_admin"

I’m trying to see if pip errors on this install at all

Hi @eirannejad,

my apologies; I’ve found a typo in my code. The package name in firebase-admin and not firebase_admin. This issue can be considered closed afterall

thanks for having a look anyway!

1 Like

We have improved the package install experience a lot in 8.6RC so hopefully errors like this would be more clear :smiley: