apache / apache/openwhisk

Python:3 virtualenv load failing probably

Open
#5,480 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
6.8k
Forks
1.2k
Avg merge
2d 14h
Merged PRs (30d)
2

Description

I am trying to deploy a basic python action with an included virtualenv. I followed [this](https://github.com/apache/openwhisk/blob/master/docs/actions-python.md#packaging-python-actions-with-a-virtual-environment-in-zip-files) official tutorial of using `openwhisk/python3action` container to create a `virtualenv` and zipping it with __ main __.py file. But i still get an `module not found` error while actually running that action.

## Environment details:

* Deployed on MacOS using the [openwhisk-deploy-kube](https://github.com/apache/openwhisk-deploy-kube) repo
* Docker version 24.0.2, build cb74dfc
* K8s version v1.27.2

## Steps to reproduce the issue:

1. Follow the `Packaging Python actions with a virtual environment in zip files` step from this official tutorial https://github.com/apache/openwhisk/blob/master/docs/actions-python.md#packaging-python-actions-with-a-virtual-environment-in-zip-files
2. Add `networkx` or any other non standard module.
3. Create an action and try invoking it

## Provide the expected results and outputs:

## Provide the actual results and outputs:

```
"logs": [
"2024-05-01T17:42:09.338809562Z stdout: Traceback (most recent call last):",
"2024-05-01T17:42:09.338871934Z stdout: File \"exec__.py\", line 44, in ",
"2024-05-01T17:42:09.33888039Z stdout: from main__ import main as main",
"2024-05-01T17:42:09.338884751Z stdout: File \"/action/1/bin/main__.py\", line 1, in ",
"2024-05-01T17:42:09.338889153Z stdout: import networkx as nx",
"2024-05-01T17:42:09.338892881Z stdout: ModuleNotFoundError: No module named 'networkx'",
"2024-05-01T17:42:09.355858711Z stdout: Command exited abruptly during initialization.",
"2024-05-01T17:42:09.430444173Z stderr: The action did not initialize or run as expected. Log data might be missing."
],

```

## Additional information you deem important:
* My guess is that there might be some issue while loading the virtualenv. Not sure where to debug it in [openwhisk-runtime-python](https://github.com/apache/openwhisk-runtime-python)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.