superset icon indicating copy to clipboard operation
superset copied to clipboard

new commit on superset_config.py trys to import superset.typing but module not found

Open Mabloq opened this issue 6 years ago • 8 comments

Environment

OS: Fedora 31 superset: Superset 0.35.2 node: v12.14.1 npm: 6.13.4 python: Python 3.7.6

Reproduce

  • conda create env
  • conda activate env
  • pip install --upgrade setuptools pip
  • pip install apache-superset
  • I delete ~/.superset/superset.db
  • add superset_config.py file to ~/.superset/
  • edit SQLALCHEMY connection string to connect to mysql db
  • superset db upgrade
  • flask fab create-admin
  • fill out info

Expected results

  • Admin user successfully created

Actual results

ERROR:root:Found but failed to import local superset_config Traceback (most recent call last): File "/home/###/.conda/envs/superset/lib/python3.7/site-packages/superset/config.py", line 701, in from superset_config import * # pylint: disable=import-error File "/home/###/.superset/superset_config.py", line 37, in from superset.typing import CacheConfig ModuleNotFoundError: No module named 'superset.typing' Usage: flask fab create-admin [OPTIONS]

Error: While importing "superset", an ImportError was raised:

Traceback (most recent call last): File "/home/###/.conda/envs/superset/lib/python3.7/site-packages/flask/cli.py", line 240, in locate_app import(module_name) File "/home/###/.conda/envs/superset/lib/python3.7/site-packages/superset/init.py", line 34, in from superset import config File "/home/###/.conda/envs/superset/lib/python3.7/site-packages/superset/config.py", line 701, in from superset_config import * # pylint: disable=import-error File "/home/###/.superset/superset_config.py", line 37, in from superset.typing import CacheConfig ModuleNotFoundError: No module named 'superset.typing'

Additional Comments

I am putting superset_config.py in ~/.superset. Is that wrong? Its seems to be reading config file from conda sitepackages instead. In the docs you say to make sure this config file is in your Python Path. What does that mean?

Mabloq avatar Jan 27 '20 05:01 Mabloq

OK I worked things out but I think the Documentation for Installation should be update I will submit pull request soon.

  • Basically I want to show the user how to add path/to/virtual-env/lib/python3.7/site-packages/superset/ to their PYTHON Path
  • This will be helpful because that's where the actual config.py that is used by "superset db upgrade" lives. And that just isnt clear right now by the documentation

Mabloq avatar Jan 29 '20 23:01 Mabloq

I did docker-compose -f docker-compose-non-dev.yml pull docker-compose -f docker-compose-non-dev.yml up

now I have started seeing error : superset_init | ModuleNotFoundError: No module named 'superset.typing'

SiddharthRajJain avatar Apr 13 '22 11:04 SiddharthRajJain

One possible solution. You can copy the file superset/superset_typing.py to superset/typing.py. The last version(1.5.0) needs this fix. One or more files needs import the typing.py but the real name is superset_typing.py

amarolx avatar Apr 28 '22 23:04 amarolx

@villebro This is an issue in the upgrade from 1.4.0 to 1.5.0 also. As suggested bt @amarolx I did copy the file superset_typing.py to typing.py and it went through

srinisubramanian avatar May 01 '22 05:05 srinisubramanian

@Mabloq @amarolx @srinisubramanian did you try running with TAG as instructed in the docs? https://superset.apache.org/docs/installation/installing-superset-using-docker-compose#3-launch-superset-through-docker-compose

Specifically this part:

image

villebro avatar May 03 '22 07:05 villebro

I am not using docker but a native pip install. I upgraded from 1.4.0 to 1.5.0 and had the issue. For another instance I use docker and did not have this issue there when I upgraded.

srinisubramanian avatar May 03 '22 07:05 srinisubramanian

I had this also on upgrading to 1.5.0. I had some customisation in config.py (or values.yaml): from superset.typing needed to be changed to: from superset.superset_typing This is because the file has been renamed.

padbk avatar May 06 '22 12:05 padbk

@phildum Thanks for pointing it out .. I also had some customization that was importing it. Not a superset issue but more the customization at my end.

srinisubramanian avatar May 06 '22 12:05 srinisubramanian