superset: ModuleNotFoundError installing Superset 2.0.1 in a fresh virtual environment
Trying to install Superset 2.0.1 in a fresh Python 3.8.10 virtual environment fails with ModuleNotFoundError.
How to reproduce the bug
# su - superset
$ python3.8 -m venv venv
$ source ./venv/bin/activate
$ pip install --upgrade setuptools pip wheel
$ pip install apache-superset==2.0.1
$ export PYTHONPATH=/home/superset
$ export FLASK_APP=superset
$ superset
Traceback (most recent call last):
File "/home/superset/venv/bin/superset", line 5, in <module>
from superset.cli.main import superset
File "/home/superset/venv/lib/python3.8/site-packages/superset/__init__.py", line 21, in <module>
from superset.app import create_app
File "/home/superset/venv/lib/python3.8/site-packages/superset/app.py", line 23, in <module>
from superset.initialization import SupersetAppInitializer
File "/home/superset/venv/lib/python3.8/site-packages/superset/initialization/__init__.py", line 33, in <module>
from superset.extensions import (
File "/home/superset/venv/lib/python3.8/site-packages/superset/extensions/__init__.py", line 32, in <module>
from superset.utils.cache_manager import CacheManager
File "/home/superset/venv/lib/python3.8/site-packages/superset/utils/cache_manager.py", line 24, in <module>
from superset.utils.core import DatasourceType
File "/home/superset/venv/lib/python3.8/site-packages/superset/utils/core.py", line 76, in <module>
from cryptography.hazmat.backends.openssl.x509 import _Certificate
ModuleNotFoundError: No module named 'cryptography.hazmat.backends.openssl.x509'
But clearly cryptography is installed:
$ pip install cryptography
Requirement already satisfied: cryptography in ./venv/lib/python3.8/site-packages (39.0.0)
Requirement already satisfied: cffi>=1.12 in ./venv/lib/python3.8/site-packages (from cryptography) (1.15.1)
Requirement already satisfied: pycparser in ./venv/lib/python3.8/site-packages (from cffi>=1.12->cryptography) (2.21)
Expected results
Superset runs.
Actual results
ModuleNotFoundError from Python.
Environment
System is Ubuntu 20.04 “focal” with Python 3.8.10.
Checklist
- I have checked the superset logs for python stacktraces and included it here as text if there are any.
- I have reproduced the issue with at least the latest released version of superset.
- I have checked the issue tracker for the same issue and I haven’t found one similar.
Additional context
The system is currently running Superset 2.0.0 fine in another virtualenv.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 6
- Comments: 22 (5 by maintainers)
@zhaoyongjie I ended up using this one liner shared in another issue. It installs the exact dependencies for Apache Superset 2.0.1, from its
requirements/base.txt:I still don’t understand why pip installing
apache-superset==2.0.1doesn’t work. This is a recurring issue with Superset for me.@alanorth try this snippet
Thanks @XinbeiGong, it’s worked !
I think it would be necessary to update the installation documentation, because it is a bit tedious to search all over the internet to install and operate this magnificent tool.
Indirectly this repels a lot of potential users.
Closing because we realized that
pip install apache-supersetis apparently not meant to work. In other threads the maintainers have commented that we’re supposed to be using the requirements file with pip. 🤷For better or worse, now I always install Superset using a one liner based on the example given earlier in this issue:
FWIW, there is a merged PR that removes the use of the private cryptography API
_Certificateclass by replacing it with the public version (Certificate) and at the same time pins the cryptography version.https://github.com/apache/superset/pull/22744
I got the same error on Fedora 37.
Just so you know I couldn’t get it to work with Python default version on Fedora (3.11) since it’s not compatible with lots of libraries and dependencies in Superset.
In case anyone is interested I first had to build Python 3.8 from source:
This last line helps you leave your system-wide Python 3.11 intact. You can run python3.8 after that and create a superset virtual enrivonment using
python3.8 -m venv supersetAfter activating the new virtual environment and installing apache-superset with pip I got errors when I ran
superset db upgradeas stated in the documentation (https://superset.apache.org/docs/installation/installing-superset-from-scratch/):
In order to fix this I had to run the lines @zhaoyongjie provided, which I reproduce below:
After that I ran
And I got the following errors:
@jsanko9 helped with this, I’m partly quoting the reply:
With that I could successfully run
superset db upgradeThanks for that info @jsanko9. It looks like we can pin WTForms to >=2.3.2 ❤️.0 and that should help with that issue. It looks like there may be a similar issue with the cryptography package. We know that
cryptography==3.4.7works. We currently require"cryptography>=3.3.2". Does anyone know which version is failing? cc @zhaoyongjie?this one liner worked for me too, thank you!