Hi @Aakash_Singh_Rawat
I tested a few things just now to see what this could be. For the record - I am using Python 1.8.1 package with Python 3.12 runtime installed in the default location: %localappdata%\Programs\Python\Python312
I first created a very simple script and tested that it works, and it did:
import random
def dummy_func():
greetings = ["hello", "hi", "hey", "greetings", "salutations"]
return random.choice(greetings)
I then added 1 line and it started crashing with a “Pipe is broken” error. Is this the same error that you are getting?
import random
import pandas as pd
def dummy_func():
greetings = ["hello", "hi", "hey", "greetings", "salutations"]
return random.choice(greetings)
24.10.5+Branch.master.Sha.a5ea2e718723dd973312e8e94aec556989027735.a5ea2e718723dd973312e8e94aec556989027735
Source: Invoke Python Method
Message: Pipe is broken.
Exception Type: System.IO.IOException
System.IO.IOException: Pipe is broken. at System.IO.Pipes.PipeStream.CheckWriteOperations()
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at UiPath.Python.Service.PythonProxy.RequestAsync(PythonRequest request, CancellationToken ct)
at UiPath.Python.Service.PythonProxy.Shutdown()
at UiPath.Python.Impl.OutOfProcessEngine.Release()
at UiPath.Python.Activities.PythonScope.Cleanup()
at UiPath.Python.Activities.PythonScope.OnFaulted(NativeActivityFaultContext faultContext, Exception propagatedException, ActivityInstance propagatedFrom)
at System.Activities.Runtime.FaultCallbackWrapper.FaultWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
So I went ahead to my installation location and run a CMD to see if everything is fine there, and it was not:
I went ahead and installed the package:
And verified that it is correctly installed:
And after that, the same slightly modified script from above worked just fine in Studio:
My next step was to slightly modify the script to actually use the imported package:
import random
import pandas as pd
def dummy_func():
greetings = ["hello", "hi", "hey", "greetings", "salutations"]
return random.choice(greetings)
def dummy_func2():
data = {'Name': ['Alice', 'Bob', 'Charlie'], 'Age': [25, 30, 35]}
df = pd.DataFrame(data)
return df.to_string()
And this worked as well in Studio:
I hope this is helpful 