question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import "wtforms.ext.sqlalchemy.fields" could not be resolved (requirements/testing.txt does not support Python 3.10)

See original GitHub issue

Summary of the issue in case anyone finds this via Google having the same problem.

The issue was simply that I was running Python version 3.10 on my laptop, but the Google Bigquery python library im the requirements/testing.txt file is restricted to versions less than 3.10, causing, causing pip install -r requirements/testing.txt to fail. To work around it, I used pip install -r requirements/local.txt instead.


When following the instructions for setting up a local development environment: https://github.com/apache/superset/blob/master/CONTRIBUTING.md

The instructions fail at this step:

# Initialize the database
superset db upgrade

with errors such as:

ModuleNotFoundError: No module named 'wtforms.ext'

How to reproduce the bug

  1. Confirm that you have a supported python version
  2. Follow all steps for setting up the OS dependencies.
  3. create and clone a clean fork of superset
  4. Skip to the[ Flask Server instructions ](export LDFLAGS=“-L$(brew --prefix openssl)/lib” export CFLAGS=“-I$(brew --prefix openssl)/include”)
  5. Follow the steps:
python3 -m venv venv # setup a python3 virtualenv
source venv/bin/activate

# Install external dependencies
pip install -r requirements/testing.txt

# Install Superset in editable (development) mode
pip install -e .

# Initialize the database
superset db upgrade

Expected results

what you expected to happen.

Actual results

When installing requirements/testing.txt the following errors are observed:

Collecting google-auth-oauthlib==0.4.6
  Downloading google_auth_oauthlib-0.4.6-py2.py3-none-any.whl (18 kB)
ERROR: Ignored the following versions that require a different python version: 1.3.0 Requires-Python ~=2.7,~=3.5; 2.10.0 Requires-Python >=3.6, <3.10; 2.11.0 Requires-Python >=3.6, <3.10; 2.12.0 Requires-Python >=3.6, <3.10; 2.13.0 Requires-Python >=3.6, <3.10; 2.13.1 Requires-Python >=3.6, <3.10; 2.14.0 Requires-Python >=3.6, <3.10; 2.15.0 Requires-Python >=3.6, <3.10; 2.16.0 Requires-Python >=3.6, <3.10; 2.16.1 Requires-Python >=3.6, <3.10; 2.17.0 Requires-Python >=3.6, <3.10; 2.18.0 Requires-Python >=3.6, <3.10; 2.19.0 Requires-Python >=3.6, <3.10; 2.20.0 Requires-Python >=3.6, <3.10; 2.21.0 Requires-Python >=3.6, <3.10; 2.22.0 Requires-Python >=3.6, <3.10; 2.22.1 Requires-Python >=3.6, <3.10; 2.23.0 Requires-Python >=3.6, <3.10; 2.23.1 Requires-Python >=3.6, <3.10; 2.23.2 Requires-Python >=3.6, <3.10; 2.23.3 Requires-Python >=3.6, <3.10; 2.24.0 Requires-Python >=3.6, <3.10; 2.24.1 Requires-Python >=3.6, <3.10; 2.25.0 Requires-Python >=3.6, <3.10; 2.25.1 Requires-Python >=3.6, <3.10; 2.25.2 Requires-Python >=3.6, <3.10; 2.26.0 Requires-Python >=3.6, <3.10; 2.27.0 Requires-Python >=3.6, <3.10; 2.27.1 Requires-Python >=3.6, <3.10; 2.28.0 Requires-Python >=3.6, <3.10; 2.28.1 Requires-Python >=3.6, <3.10; 2.29.0 Requires-Python >=3.6, <3.10; 2.6.2 Requires-Python >=3.6, <3.9; 2.7.0 Requires-Python >=3.6, <3.10; 2.8.0 Requires-Python >=3.6, <3.10; 2.9.0 Requires-Python >=3.6, <3.10
ERROR: Could not find a version that satisfies the requirement google-cloud-bigquery[bqstorage,pandas]==2.29.0 (from versions: 0.20.0, 0.21.0, 0.22.0, 0.22.1, 0.23.0, 0.24.0, 0.25.0, 0.26.0, 0.27.0, 0.28.0, 0.29.0, 0.30.0, 0.31.0, 0.32.0, 1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.5.1, 1.5.2, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.10.0, 1.10.1, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.12.0, 1.12.1, 1.12.2, 1.13.0, 1.13.1, 1.14.0, 1.14.1, 1.15.0, 1.15.1, 1.16.0, 1.16.1, 1.17.0, 1.17.1, 1.18.0, 1.18.1, 1.19.0, 1.19.1, 1.20.0, 1.21.0, 1.22.0, 1.23.0, 1.23.1, 1.24.0, 1.25.0, 1.26.0, 1.26.1, 1.27.2, 1.28.0, 1.28.1, 1.28.2, 2.0.0, 2.1.0, 2.2.0, 2.3.1, 2.4.0, 2.5.0, 2.6.0, 2.6.1, 2.30.0, 2.30.1, 2.31.0, 2.32.0, 2.33.0, 2.34.0, 2.34.1, 2.34.2, 2.34.3, 2.34.4, 3.0.0b1, 3.0.0, 3.0.1, 3.1.0, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.3.3, 3.3.5)
ERROR: No matching distribution found for google-cloud-bigquery[bqstorage,pandas]==2.29.0

Running superset db upgrade results in the following errors:

 % superset db upgrade
'FLASK_ENV' is deprecated and will not be used in Flask 2.3. Use 'FLASK_DEBUG' instead.
--------------------------------------------------------------------------------
                                    WARNING
--------------------------------------------------------------------------------
A Default SECRET_KEY was detected, please use superset_config.py to override it.
Use a strong complex alphanumeric string and use a tool to help you generate 
a sufficiently random sequence, ex: openssl rand -base64 42
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
logging was configured successfully
2022-11-03 09:45:54,756:INFO:superset.utils.logging_configurator:logging was configured successfully
2022-11-03 09:45:54,770:INFO:root:Configured event logger of type <class 'superset.utils.log.DBEventLogger'>
We haven't found any Content Security Policy (CSP) defined in the configurations. Please make sure to configure CSP using the TALISMAN_CONFIG key or any other external software. Failing to configure CSP have serious security implications. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP for more information. You can disable this warning using the CONTENT_SECURITY_POLICY_WARNING key.
2022-11-03 09:45:54,771:WARNING:superset.initialization:We haven't found any Content Security Policy (CSP) defined in the configurations. Please make sure to configure CSP using the TALISMAN_CONFIG key or any other external software. Failing to configure CSP have serious security implications. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP for more information. You can disable this warning using the CONTENT_SECURITY_POLICY_WARNING key.
Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `FILTER_STATE_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
2022-11-03 09:45:54,773:WARNING:superset.utils.cache_manager:Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `FILTER_STATE_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `EXPLORE_FORM_DATA_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
2022-11-03 09:45:54,781:WARNING:superset.utils.cache_manager:Falling back to the built-in cache, that stores data in the metadata database, for the following cache: `EXPLORE_FORM_DATA_CACHE_CONFIG`. It is recommended to use `RedisCache`, `MemcachedCache` or another dedicated caching backend for production deployments
No PIL installation found
2022-11-03 09:45:55,190:INFO:superset.utils.screenshots:No PIL installation found
Failed to create app
Traceback (most recent call last):
  File "/Users/rickspencer/superset/superset/app.py", line 37, in create_app
    app_initializer.init_app()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 473, in init_app
    self.init_app_in_ctx()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 420, in init_app_in_ctx
    self.configure_data_sources()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 493, in configure_data_sources
    __import__(module_name, fromlist=class_names)
  File "/Users/rickspencer/superset/superset/connectors/sqla/__init__.py", line 17, in <module>
    from . import models, views
  File "/Users/rickspencer/superset/superset/connectors/sqla/views.py", line 28, in <module>
    from wtforms.ext.sqlalchemy.fields import QuerySelectField
ModuleNotFoundError: No module named 'wtforms.ext'
2022-11-03 09:45:55,273:ERROR:superset.app:Failed to create app
Traceback (most recent call last):
  File "/Users/rickspencer/superset/superset/app.py", line 37, in create_app
    app_initializer.init_app()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 473, in init_app
    self.init_app_in_ctx()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 420, in init_app_in_ctx
    self.configure_data_sources()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 493, in configure_data_sources
    __import__(module_name, fromlist=class_names)
  File "/Users/rickspencer/superset/superset/connectors/sqla/__init__.py", line 17, in <module>
    from . import models, views
  File "/Users/rickspencer/superset/superset/connectors/sqla/views.py", line 28, in <module>
    from wtforms.ext.sqlalchemy.fields import QuerySelectField
ModuleNotFoundError: No module named 'wtforms.ext'
Traceback (most recent call last):
  File "/Users/rickspencer/superset/venv/bin/superset", line 33, in <module>
    sys.exit(load_entry_point('apache-superset', 'console_scripts', 'superset')())
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/click/core.py", line 1654, in invoke
    super().invoke(ctx)
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/flask/cli.py", line 354, in decorator
    app = __ctx.ensure_object(ScriptInfo).load_app()
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/flask/cli.py", line 308, in load_app
    app = locate_app(import_name, name)
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/flask/cli.py", line 237, in locate_app
    return find_app_by_string(module, app_name)
  File "/Users/rickspencer/superset/venv/lib/python3.10/site-packages/flask/cli.py", line 165, in find_app_by_string
    app = attr(*args, **kwargs)
  File "/Users/rickspencer/superset/superset/app.py", line 44, in create_app
    raise ex
  File "/Users/rickspencer/superset/superset/app.py", line 37, in create_app
    app_initializer.init_app()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 473, in init_app
    self.init_app_in_ctx()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 420, in init_app_in_ctx
    self.configure_data_sources()
  File "/Users/rickspencer/superset/superset/initialization/__init__.py", line 493, in configure_data_sources
    __import__(module_name, fromlist=class_names)
  File "/Users/rickspencer/superset/superset/connectors/sqla/__init__.py", line 17, in <module>
    from . import models, views
  File "/Users/rickspencer/superset/superset/connectors/sqla/views.py", line 28, in <module>
    from wtforms.ext.sqlalchemy.fields import QuerySelectField
ModuleNotFoundError: No module named 'wtforms.ext'

  • python version: Python 3.10.8
  • node.js version: v16.14.0

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rickspencer3commented, Nov 3, 2022

Ok, so it looks like the problem was that I am running Python 3.10, and bigquery requires ❤️.10. When I used requirments/local.text everything started working

0reactions
eschuthocommented, Dec 6, 2022

@rickspencer3 is there anything else that you need on this issue? It sounds like you got it resolved?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Extensions — WTForms Documentation (2.3.x)
WTForms includes support for AppEngine fields as well as auto-form ... If this is not specified, The query property must be overridden before...
Read more >
wtforms import could not be resolved - Stack Overflow
When I go to env/Lib/site-packages, I have flask_wtf, wtforms, and WTForms-3.0.1dist-info, and Flask_WTf-1.1.0dev0-py3.10egg-info folders, which ...
Read more >
import "pandas" could not be resolved from source - You.com
The error "Import "pandas" could not be resolved from source Pylance" occurs when the pandas module is not installed or you have selected...
Read more >
WTForms-SQLAlchemy - PyPI
ext.sqlalchemy did. to install: pip install WTForms-SQLAlchemy. Python 3.6 to 3.10 are supported. An example using Flask is included ...
Read more >
Extensions - WTForms Documentation
The form class can be used as it is or serve as a base for extended form ... the python-dateutil package, wtforms.ext.dateutil provides...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found