Superset localization under Windows

Posted by judgy on Mon, 14 Feb 2022 10:15:46 +0100

1. Install python environment

Superset is a report system developed based on python. It needs a python environment to run, and anaconda is very convenient to manage the package management of Python. Therefore, anaconda is recommended to help configure the python environment.

1.1 installation of anaconda

Install anaconda using Tsinghua image. Link: anaconda Tsinghua mirror
Select the anaconda version suitable for the computer version for installation.

2. Configure virtual environment

The virtual environment is similar to docker. Configuring the virtual environment can isolate the system environment and ensure that it will not affect other installed packages.

2.1 configuring virtual environment

Start anaconda prompt and run it with the administrator. To create a virtual environment:

conda create --name Environment name python==XXX

3. Install superset

Install Superset in the created virtual environment

3.1 direct installation via pip

First enter the created virtual environment (take the environment name superset as an example):

activate superset

Install Superset after entering:

pip install superset==0.28.1

3.2 install flash appbuilder and requests

The reason for installing these two components is that when creating an administrator account later, if these two components are missing, an error will be reported. Inserting the code piece 'fabmanager' here is not an internal or external command, nor a runnable program or batch file
Direct use:

pip install flask-appbuilder
pip install requests

If the pip is not configured with a domestic image, the download speed will be slow. You can temporarily configure the image by changing the command line to speed up:

pip install parsedatetime -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

4. Configure Superset

After installing Superset, a series of configurations are required. Some components are mainly missing. It should be noted that there will be version requirements between these components, which need to be installed in strict accordance with the version requirements. The version requirements are given below.

4.1 enter Superset installation path

All the following operations can be performed under the installation path of Superset. First enter the installation path of Superset:

C:\Users\lxy\Anaconda3\envs\superset_test\Lib\site-packages\superset\bin

4.2 create administrator account

Create administrator account:

fabmanager create-admin --app superset	

Here you will be asked to enter the account, password and email.
There will be many missing components in the process, which need to be installed one by one. It can be installed directly through pip, mainly including:

pip install werkzeug==0.16.1
pip install flask-jwt-extended==3.18.1
pip install flask==0.12.5
pip install sqlalchemy==1.2.18
pip install superset==0.28.1
pip install wtforms_json
pip install flask_compress
pip install celery
pip install flask_migrate
pip install flask_talisman
pip install flask_caching
pip install sqlparse
pip install bleach
pip install markdown
pip install numpy
pip install pandas

4.3 stepping on pits

AttributeError: 'NoneType' object has no attribute 'auth_type'
Solution:
Try replacement superset Version to 0.28.1,then:
newspaper Could not install packages due to an OSError: [Errno 2] No such file or directory:'C:\\Users\\wyt\\AppData\\Local\\Temp\\pip-install-iykndicc\\superset_e61511c98a1d43ebbe20cb241d2626b5\\superset/static/assets/dist/vendors-EventFlow-big_number-cal_heatmap-chord-country_map-directed_force-filter_box-heatmap-histogr-4abe76ce.fc10d2b92451bc9dbaf0.chunk.js'

Solution:
Reference link: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later
 Modify the following information in the registry and set the value to 1:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem]"LongPathsEnabled"=dword:00000001

To install Visual C + +:

Running setup.py install for python-geohash ... error
 Details:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

Solution:
Installation required Microsoft Visual C++ 14.0 Microsoft Build Tools 2015 Installation link:
https://www.microsoft.com/en-us/download/details.aspx?id=48159
 In addition, it needs to be installed Visual C++Generation tool, for CMake of Visual C++ The tool has two components

The pandas version needs to be replaced:

Was unable to import superset Error: cannot import name '_maybe_box_datetimelike' from 'pandas.core.common' 

Solution:
because pandas The version is too high, resulting in replacement pandas Version to 0.23.4
pip uninstall pandas
 then:
pip install pandas==0.23.4

At this point, the common administrator account can be successfully.

4.4 database initialization

Upgrade and initialization of Superset sample database:
The database can only be initialized after entering the installation path

python superset db upgrade  Upgrade database
python superset init  Initialize database

4.5 start Superset

Start Supeset:

python superset runserver -d  start-up superset

After successful startup, you can access superset through localhost:8088.
After startup, you can view the log of each operation in the command line interface to facilitate troubleshooting.

Topics: Python Windows Flask