You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "LucasRakotomalala (via GitHub)" <gi...@apache.org> on 2024/12/17 12:12:34 UTC

[I] `/app` is missing in `PYTHONPATH` [superset]

LucasRakotomalala opened a new issue, #31497:
URL: https://github.com/apache/superset/issues/31497

   ### Bug description
   
   I am using Superset through the Helmchart from this repository.
   
   When I mount something under `extraConfigMountPath` (with the default value `/app/pythonpath`), Python files cannot be used in `superset_config.py` since `/app` folder is missing from `PYTHONPATH`.
   
   I use it to provide Python files for SSO authentication, to avoid using `Flask-OIDC`.
   
   However, in Superset 4.0.2, `/app` folder was part of `PYTHONPATH`.
   
   ### Screenshots/recordings
   
   Here is the trace i got from Superset Init DB job:
   
   ```text
   ModuleNotFoundError: No module named `authentication`
   ```
   
   ### Superset version
   
   4.1.1
   
   ### Python version
   
   3.10
   
   ### Node version
   
   Not applicable
   
   ### Browser
   
   Not applicable
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [X] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.


-- 
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: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #31497:
URL: https://github.com/apache/superset/issues/31497#issuecomment-3644125012

   Closing this issue as there's a documented workaround and @rusackas indicated this is likely intentional behavior rather than a bug.
   
   **Workaround** (per Dosu): Add `/app` to PYTHONPATH in your Helm values:
   ```yaml
   env:
     - name: PYTHONPATH
       value: /app:${PYTHONPATH}
   ```
   
   If this is still causing issues after PR #32017's changes, please let us know and we can reopen.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "LucasRakotomalala (via GitHub)" <gi...@apache.org>.
LucasRakotomalala commented on issue #31497:
URL: https://github.com/apache/superset/issues/31497#issuecomment-2602924317

   Hello,
   Happy New Year !
   
   Is there any new about this issue?
   
   Kind regards,
   Lucas.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31497:
URL: https://github.com/apache/superset/issues/31497#issuecomment-2548298698

   <!-- Greeting -->
   Hey @LucasRakotomalala! 👋 I'm here to help you with any bugs, questions, or contributions you have for the Superset Helmchart. I'm looking forward to assisting you with this issue.
   
   <!-- Answer -->
   In Superset version 4.1.1, the `PYTHONPATH` environment variable in the Docker image is set to:
   
   ```plaintext
   PYTHONPATH=/app/pythonpath:/app/docker/pythonpath_dev
   ```
   
   This configuration does not include the `/app` directory directly in the `PYTHONPATH`, which might be causing the issue you're experiencing with the `ModuleNotFoundError` for your custom authentication module <sup>[[1]](https://github.com/apache/superset/blob/master/docker/.env)</sup>.
   
   To resolve this, you can modify the `PYTHONPATH` to include `/app` by setting an environment variable in your Helm chart configuration. You can do this by adding an `env` section in your Helm values file or directly in the deployment configuration to append `/app` to the `PYTHONPATH`. Here's an example of how you might adjust the `PYTHONPATH`:
   
   ```yaml
   env:
     - name: PYTHONPATH
       value: /app:/app/pythonpath:/app/docker/pythonpath_dev
   ```
   
   This should allow your custom Python files to be recognized by Superset.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=other)</sup>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31497:
URL: https://github.com/apache/superset/issues/31497#issuecomment-2548311525

   <!-- Answer -->
   The default `PYTHONPATH` configuration in the Dockerfile for Superset version 4.0.2 included `/app` as part of the path, which allowed modules in that directory to be recognized without additional configuration <sup>[[1]](https://github.com/apache/superset/blob/master/Dockerfile)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/docker/.env)</sup>. However, in version 4.1.1, the `PYTHONPATH` was changed to exclude `/app`, which is why you're experiencing the `ModuleNotFoundError` for your custom modules. Unfortunately, I couldn't find specific documentation or changelog entries explaining the rationale behind this change.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/50098d53-b998-4a6c-910b-4f1d58c3fd6c?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/50098d53-b998-4a6c-910b-4f1d58c3fd6c?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/50098d53-b998-4a6c-910b-4f1d58c3fd6c?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/50098d53-b998-4a6c-910b-4f1d58c3fd6c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/50098d53-b998-4a6c-910b-4f1d58c3fd6c?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/50098d53-b998-4a6c-910b-4f1d58c3fd6c?feedback_type=other)</sup>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #31497:
URL: https://github.com/apache/superset/issues/31497#issuecomment-2548323139

   <!-- Answer -->
   To extend the current Docker image and add `/app` to the `PYTHONPATH`, you can modify the Dockerfile or the entrypoint script. Here's an example of how you can do it in the Dockerfile:
   
   ```dockerfile
   FROM apache/superset:4.1.1
   
   # Add /app to PYTHONPATH
   ENV PYTHONPATH="/app:${PYTHONPATH}"
   ```
   
   Alternatively, if you're using a `docker-compose.yml` file, you can add the environment variable directly to the `superset` service:
   
   ```yaml
   services:
     superset:
       image: apache/superset:4.1.1
       environment:
         - PYTHONPATH=/app:${PYTHONPATH}
       # other configurations...
   ```
   
   These changes will ensure that `/app` is included in the `PYTHONPATH`, allowing your custom Python files to be recognized by Superset.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   
   ---
   <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/13986c12-599c-484b-a750-8073759f9c8f?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/13986c12-599c-484b-a750-8073759f9c8f?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/13986c12-599c-484b-a750-8073759f9c8f?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/13986c12-599c-484b-a750-8073759f9c8f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/13986c12-599c-484b-a750-8073759f9c8f?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/13986c12-599c-484b-a750-8073759f9c8f?feedback_type=other)</sup>
   


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "LucasRakotomalala (via GitHub)" <gi...@apache.org>.
LucasRakotomalala commented on issue #31497:
URL: https://github.com/apache/superset/issues/31497#issuecomment-2548303926

   > Hey @LucasRakotomalala! 👋 I'm here to help you with any bugs, questions, or contributions you have for the Superset Helmchart. I'm looking forward to assisting you with this issue.
   > 
   > In Superset version 4.1.1, the `PYTHONPATH` environment variable in the Docker image is set to:
   > 
   > ```
   > PYTHONPATH=/app/pythonpath:/app/docker/pythonpath_dev
   > ```
   > 
   > This configuration does not include the `/app` directory directly in the `PYTHONPATH`, which might be causing the issue you're experiencing with the `ModuleNotFoundError` for your custom authentication module [[1]](https://github.com/apache/superset/blob/master/docker/.env).
   > 
   > To resolve this, you can modify the `PYTHONPATH` to include `/app` by setting an environment variable in your Helm chart configuration. You can do this by adding an `env` section in your Helm values file or directly in the deployment configuration to append `/app` to the `PYTHONPATH`. Here's an example of how you might adjust the `PYTHONPATH`:
   > 
   > ```yaml
   > env:
   >   - name: PYTHONPATH
   >     value: /app:/app/pythonpath:/app/docker/pythonpath_dev
   > ```
   > 
   > This should allow your custom Python files to be recognized by Superset.
   > 
   > _To continue talking to [Dosu](https://dosu.dev), mention @dosu._
   > 
   > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/566710f8-35b0-4d5d-aa73-835d6c20e2e7?feedback_type=other)
   
   Why `/app` was present in `PYTHONPATH` for Superset 4.0.2 without any workaround, and not in Superset 4.1.1?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "LucasRakotomalala (via GitHub)" <gi...@apache.org>.
LucasRakotomalala commented on issue #31497:
URL: https://github.com/apache/superset/issues/31497#issuecomment-2548319662

   @dosu Could you please provide me some code example to add `/app` to `PYTHONPATH` by extending the current Docker image.


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "LucasRakotomalala (via GitHub)" <gi...@apache.org>.
LucasRakotomalala commented on issue #31497:
URL: https://github.com/apache/superset/issues/31497#issuecomment-2548306544

   @dosu Why `/app` was present in `PYTHONPATH` for Superset 4.0.2 without any workaround, and not in Superset 4.1.1?


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] `/app` is missing in `PYTHONPATH` in container image [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #31497: `/app` is missing in `PYTHONPATH` in container image
URL: https://github.com/apache/superset/issues/31497


-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org