You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "0x1un (via GitHub)" <gi...@apache.org> on 2025/02/11 10:09:29 UTC

[I] superset:latest image "No module named 'psycopg2'" [superset]

0x1un opened a new issue, #32217:
URL: https://github.com/apache/superset/issues/32217

   ### Bug description
   
   image id: 60e7a563bf20
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.9
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [ ] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [ ] 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] superset:latest image "No module named 'psycopg2'" [superset]

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

   The issue has been resolved by installing this module on top of the original image and committing the changes. Thanks to everyone for your replies.


-- 
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] superset:latest image "No module named 'psycopg2'" [superset]

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

   `
   Loaded your LOCAL configuration at [/app/pythonpath/superset_config.py]
   2025-02-11 10:04:08,612:ERROR:superset.app:Failed to create app
   Traceback (most recent call last):
     File "/app/superset/app.py", line 40, in create_app
       app_initializer.init_app()
     File "/app/superset/initialization/__init__.py", line 476, in init_app
       self.setup_db()
     File "/app/superset/initialization/__init__.py", line 667, in setup_db
       pessimistic_connection_handling(db.engine)
     File "/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/__init__.py", line 998, in engine
       return self.get_engine()
     File "/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/__init__.py", line 1017, in get_engine
       return connector.get_engine()
     File "/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/__init__.py", line 594, in get_engine
       self._engine = rv = self._sa.create_engine(sa_url, options)
     File "/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/__init__.py", line 1027, in create_engine
       return sqlalchemy.create_engine(sa_url, **engine_opts)
     File "<string>", line 2, in create_engine
     File "/usr/local/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 375, in warned
       return fn(*args, **kwargs)
     File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 544, in create_engine
       dbapi = dialect_cls.dbapi(**dbapi_args)
     File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 811, in dbapi
       import psycopg2
   ModuleNotFoundError: No module named 'psycopg2'
   Usage: celery [OPTIONS] COMMAND [ARGS]...
   Try 'celery --help' for help.
   Error: Invalid value for '-A' / '--app': 
   Unable to load celery application.
   While trying to load the module superset.tasks.celery_app:app the following error occurred:
   Traceback (most recent call last):
     File "/usr/local/lib/python3.10/site-packages/celery/bin/celery.py", line 58, in convert
       return find_app(value)
     File "/usr/local/lib/python3.10/site-packages/celery/app/utils.py", line 383, in find_app
       sym = symbol_by_name(app, imp=imp)
     File "/usr/local/lib/python3.10/site-packages/kombu/utils/imports.py", line 59, in symbol_by_name
       module = imp(module_name, package=package, **kwargs)
     File "/usr/local/lib/python3.10/site-packages/celery/utils/imports.py", line 109, in import_from_cwd
       return imp(module, package=package)
     File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
     File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
     File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 883, in exec_module
     File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
     File "/app/superset/tasks/celery_app.py", line 32, in <module>
       flask_app = create_app()
     File "/app/superset/app.py", line 40, in create_app
       app_initializer.init_app()
     File "/app/superset/initialization/__init__.py", line 476, in init_app
       self.setup_db()
     File "/app/superset/initialization/__init__.py", line 667, in setup_db
       pessimistic_connection_handling(db.engine)
     File "/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/__init__.py", line 998, in engine
       return self.get_engine()
     File "/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/__init__.py", line 1017, in get_engine
       return connector.get_engine()
     File "/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/__init__.py", line 594, in get_engine
       self._engine = rv = self._sa.create_engine(sa_url, options)
     File "/usr/local/lib/python3.10/site-packages/flask_sqlalchemy/__init__.py", line 1027, in create_engine
       return sqlalchemy.create_engine(sa_url, **engine_opts)
     File "<string>", line 2, in create_engine
     File "/usr/local/lib/python3.10/site-packages/sqlalchemy/util/deprecations.py", line 375, in warned
       return fn(*args, **kwargs)
     File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/create.py", line 544, in create_engine
       dbapi = dialect_cls.dbapi(**dbapi_args)
     File "/usr/local/lib/python3.10/site-packages/sqlalchemy/dialects/postgresql/psycopg2.py", line 811, in dbapi
       import psycopg2
   ModuleNotFoundError: No module named 'psycopg2'
   `


-- 
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] superset:latest image "No module named 'psycopg2'" [superset]

Posted by "0x1un (via GitHub)" <gi...@apache.org>.
0x1un closed issue #32217: superset:latest image "No module named 'psycopg2'"
URL: https://github.com/apache/superset/issues/32217


-- 
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] superset:latest image "No module named 'psycopg2'" [superset]

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

   I am using the apachesuperset.docker.scarf.sh/apache/superset:latest image, and it seems there might be an issue with how you packaged the 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] superset:latest image "No module named 'psycopg2'" [superset]

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

   I have utilized the Helm chart that you provided.
   
   


-- 
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] superset:latest image "No module named 'psycopg2'" [superset]

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

   I'm seeing three bugs here:
   
   1. The user is expected to provide basic requirements to the app to even run? I'd understand if this were about plugins, but as it is this seems broken to me.
   2. Also https://superset.apache.org/docs/installation/kubernetes/#dependencies currently says to use `uv` to install dependencies but the current release (4.1.2) doesn't seem to have `uv`:
   ```
   superset /bin/sh: 3: /app/pythonpath/superset_bootstrap.sh: uv: not found
   ```
   
   3. Lastly, even though the bootstrap script crashed superset somehow continued to start up.


-- 
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] superset:latest image "No module named 'psycopg2'" [superset]

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

   @mausch re: your first point, I think that's reasonable and we should put psycopg2 back into the lean image since we are spinning up a Postgres DB as part of the docker compose file.


-- 
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] superset:latest image "No module named 'psycopg2'" [superset]

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

   Here's how you can install the driver on docker bootstrap -> https://superset.apache.org/docs/installation/kubernetes/#dependencies . Thing is every installation needs different drivers and we want to keep the main image lean. 
   
   It's also possible to create your own Dockerfile that points to one of our lean image and a layer to add the specific python dependencies you need. 
   
   The dev image is intended for development/CI workloads, is more bloater, and may use the `root` user now or in the future as it's convenient for development.


-- 
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] superset:latest image "No module named 'psycopg2'" [superset]

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

   Try `apache/superset:latest-dev`? The base image recently does not include even  the Postgres or MySQL drivers.


-- 
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] superset:latest image "No module named 'psycopg2'" [superset]

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

   <!-- Greeting -->
   Hey there, @0x1un! I'm here to help you out with any bugs or questions you have. Let's get to the bottom of this together!
   
   <!-- Answer -->
   To resolve the "No module named 'psycopg2'" error when using the `superset:latest` image, you can add `psycopg2-binary` to a `requirements-local.txt` file in your Docker setup. Here are the steps:
   
   1. Create a file named `./docker/requirements-local.txt`.
   2. Add `psycopg2-binary` to this file.
   3. If you're using a stock Superset image, start Superset with `docker compose -f docker-compose-image-tag.yml up`.
   4. If you're using a customized image, rebuild your local image with `docker compose build --force-rm` and then relaunch Superset with `docker compose up`.
   
   This should ensure that `psycopg2` is installed in your Docker environment <sup>[[1]](https://github.com/apache/superset/discussions/30898)</sup>.
   
   
   <!-- 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/44d73a62-780d-497f-a253-848dedf6db73?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/44d73a62-780d-497f-a253-848dedf6db73?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/44d73a62-780d-497f-a253-848dedf6db73?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/44d73a62-780d-497f-a253-848dedf6db73?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/44d73a62-780d-497f-a253-848dedf6db73?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/44d73a62-780d-497f-a253-848dedf6db73?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] superset:latest image "No module named 'psycopg2'" [superset]

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

   > I'm seeing three bugs here:
   > 
   >     1. The user is expected to provide basic requirements to the app to even run? I'd understand if this were about plugins, but as it is this seems broken to me.
   > 
   >     2. Also https://superset.apache.org/docs/installation/kubernetes/#dependencies currently says to use `uv` to install dependencies but the current release (4.1.2) doesn't seem to have `uv`:
   > 
   > 
   > ```
   > superset /bin/sh: 3: /app/pythonpath/superset_bootstrap.sh: uv: not found
   > ```
   > 
   >     3. Lastly, even though the bootstrap script crashed superset somehow continued to start up.
   
   Agreed. Seems like a strange workflow to require fairly basic and app critical imports on account of image size. 


-- 
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