AnandInguva commented on code in PR #27436:
URL: https://github.com/apache/beam/pull/27436#discussion_r1273745486


##########
sdks/python/container/piputil.go:
##########
@@ -52,6 +53,26 @@ func pipInstallRequirements(files []string, dir, name 
string) error {
        return nil
 }
 
+
+func isPackageInstalled(pkgName string) (bool, error) {
+       // run pip list and capture the output

Review Comment:
   ```suggestion
   ```



##########
sdks/python/container/piputil.go:
##########
@@ -52,6 +53,26 @@ func pipInstallRequirements(files []string, dir, name 
string) error {
        return nil
 }
 
+
+func isPackageInstalled(pkgName string) (bool, error) {
+       // run pip list and capture the output
+       out, err := exec.Command("python", "-m", "pip", "list").Output()
+       if err != nil {
+               return false, fmt.Errorf("failed to fetch pip list: %v", err)
+       }
+
+       // Convert byte array to string

Review Comment:
   ```suggestion
   ```



##########
sdks/python/container/piputil.go:
##########
@@ -52,6 +53,26 @@ func pipInstallRequirements(files []string, dir, name 
string) error {
        return nil
 }
 
+
+func isPackageInstalled(pkgName string) (bool, error) {
+       // run pip list and capture the output
+       out, err := exec.Command("python", "-m", "pip", "list").Output()
+       if err != nil {
+               return false, fmt.Errorf("failed to fetch pip list: %v", err)
+       }
+
+       // Convert byte array to string
+       output := string(out[:])
+
+       // Check if package name is in the output

Review Comment:
   ```suggestion
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to