YunoHost-Apps / superset_ynh

Data Visualization and Data Exploration Platform, packaged for YunoHost
https://superset.apache.org/
MIT License
2 stars 1 forks source link

Seeking help adding mysql as a dataset #14

Open rieneverts opened 4 months ago

rieneverts commented 4 months ago

Hiya, is it possible for me to add a mysql datset? I want to connect my nextcloud database to apache superset.

If i try to enter te shell and manually install mysqlclient through pip i get the following error:

root@educationwarehouse:~# yunohost app shell superset
+ echo '! Helper used in legacy mode !'
+ set +x
+ [[ ! /bin/bash =~ /?bash$ ]]
++ jq -r '.apps[].id'
++ yunohost app list --output-as json --quiet
+ installed_apps_list=('collabora' 'httpsh' 'nextcloud' 'redirect' 'redirect__2' 'redirect__3' 'redirect__4' 'redirect__5' 'restic' 'signaturepdf' 'superset' 'wordpress')
+ local installed_apps_list
+ [[  collabora httpsh nextcloud redirect redirect__2 redirect__3 redirect__4 redirect__5 restic signaturepdf superset wordpress  != *\ \s\u\p\e\r\s\e\t\ * ]]
+ id -u superset
++ ynh_app_setting_get --app=superset --key=install_dir
++ local _globalapp=superset
++ local legacy_args=ak
++ args_array=(['a']='app=' ['k']='key=')
++ local -A args_array
++ local app
++ local key
++ ynh_handle_getopts_args --app=superset --key=install_dir
++ set +o xtrace
++ app=superset
++ [[ install_dir =~ (unprotected|protected|skipped)_ ]]
++ ynh_app_setting get superset install_dir
++ set +o xtrace
+ local install_dir=/var/www/superset
+ '[' -z /var/www/superset ']'
++ ynh_app_setting_get --app=superset --key=service
++ local _globalapp=superset
++ local legacy_args=ak
++ args_array=(['a']='app=' ['k']='key=')
++ local -A args_array
++ local app
++ local key
++ ynh_handle_getopts_args --app=superset --key=service
++ set +o xtrace
++ app=superset
++ [[ service =~ (unprotected|protected|skipped)_ ]]
++ ynh_app_setting get superset service
++ set +o xtrace
+ local service=
+ '[' -z '' ']'
+ service=superset
+ export HOME=/var/www/superset
+ HOME=/var/www/superset
++ systemctl show superset.service -p Environment --value
+ local 'env_var=PATH=/var/www/superset/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin FLASK_APP=superset SUPERSET_CONFIG_PATH=/var/www/superset/superset_config.py'
+ '[' -n 'PATH=/var/www/superset/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin FLASK_APP=superset SUPERSET_CONFIG_PATH=/var/www/superset/superset_config.py' ']'
+ export PATH=/var/www/superset/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin FLASK_APP=superset SUPERSET_CONFIG_PATH=/var/www/superset/superset_config.py
+ PATH=/var/www/superset/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ FLASK_APP=superset
+ SUPERSET_CONFIG_PATH=/var/www/superset/superset_config.py
++ ynh_app_setting_get --app=superset --key=phpversion
++ local _globalapp=superset
++ local legacy_args=ak
++ args_array=(['a']='app=' ['k']='key=')
++ local -A args_array
++ local app
++ local key
++ ynh_handle_getopts_args --app=superset --key=phpversion
++ set +o xtrace
++ app=superset
++ [[ phpversion =~ (unprotected|protected|skipped)_ ]]
++ ynh_app_setting get superset phpversion
++ set +o xtrace
+ local phpversion=
++ ynh_app_setting_get --app=superset --key=phpflags
++ local _globalapp=superset
++ local legacy_args=ak
++ args_array=(['a']='app=' ['k']='key=')
++ local -A args_array
++ local app
++ local key
++ ynh_handle_getopts_args --app=superset --key=phpflags
++ set +o xtrace
++ app=superset
++ [[ phpflags =~ (unprotected|protected|skipped)_ ]]
++ ynh_app_setting get superset phpflags
++ set +o xtrace
+ local phpflags=
+ '[' -n '' ']'
++ systemctl show superset.service -p EnvironmentFiles --value
+ env_files=()
+ local env_files
+ '[' 0 -gt 0 ']'
+ '[' -f /var/www/superset/venv/bin/activate ']'
+ set -a
+ source /var/www/superset/venv/bin/activate
++ deactivate nondestructive
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n /bin/bash -o -n '' ']'
++ hash -r
++ '[' -n '' ']'
++ unset VIRTUAL_ENV
++ '[' '!' nondestructive = nondestructive ']'
++ VIRTUAL_ENV=/var/www/superset/venv
++ export VIRTUAL_ENV
++ _OLD_VIRTUAL_PATH=/var/www/superset/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ PATH=/var/www/superset/venv/bin:/var/www/superset/venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ export PATH
++ '[' -n '' ']'
++ '[' -z '' ']'
++ _OLD_VIRTUAL_PS1=
++ PS1='(venv) '
++ export PS1
++ '[' -n /bin/bash -o -n '' ']'
++ hash -r
+ set +a
++ systemctl show superset.service -p WorkingDirectory --value
+ local env_dir=/var/www/superset
+ '[' -z /var/www/superset ']'
+ cd /var/www/superset
+ su -s /bin/bash superset
superset@educationwarehouse:~$ pip install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.2.4.tar.gz (90 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /var/www/superset/venv/bin/python3 /tmp/tmpl__74md7_in_process.py get_requires_for_build_wheel /tmp/tmpyukaii4v
       cwd: /tmp/pip-install-qochhupr/mysqlclient_29bf5f992e9b4c479f594be7a0fd35c5
  Complete output (27 lines):
  /bin/sh: 1: pkg-config: not found
  /bin/sh: 1: pkg-config: not found
  /bin/sh: 1: pkg-config: not found
  Trying pkg-config --exists mysqlclient
  Command 'pkg-config --exists mysqlclient' returned non-zero exit status 127.
  Trying pkg-config --exists mariadb
  Command 'pkg-config --exists mariadb' returned non-zero exit status 127.
  Trying pkg-config --exists libmariadb
  Command 'pkg-config --exists libmariadb' returned non-zero exit status 127.
  Traceback (most recent call last):
    File "/tmp/tmpl__74md7_in_process.py", line 280, in <module>
      main()
    File "/tmp/tmpl__74md7_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tmpl__74md7_in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-u_7pujtb/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "/tmp/pip-build-env-u_7pujtb/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-u_7pujtb/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
      exec(code, locals())
    File "<string>", line 155, in <module>
    File "<string>", line 49, in get_config_posix
    File "<string>", line 28, in find_package_name
  Exception: Can not find valid pkg-config name.
  Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/79/33/996dc0ba3f03e2399adc91a7de1f61cb14b57ebdb4cc6eca8a78723043cb/mysqlclient-2.2.4.tar.gz#sha256=33bc9fb3464e7d7c10b1eaf7336c5ff8f2a3d3b88bab432116ad2490beb3bf41 (from https://pypi.org/simple/mysqlclient/) (requires-python:>=3.8). Command errored out with exit status 1: /var/www/superset/venv/bin/python3 /tmp/tmpl__74md7_in_process.py get_requires_for_build_wheel /tmp/tmpyukaii4v Check the logs for full command output.
ballinger commented 4 months ago

That's what I did to add the extension which u can then configure in the UI

cd /var/www/superset
. venv/bin/activate
pip3 install pymysql mysql-connector-python mysqlclient
deactivate
rieneverts commented 4 months ago

I still seem to get the error

(venv) root@educationwarehouse:/var/www/superset# pip3 install pymysql mysql-connector-python mysqlclient
Collecting pymysql
  Downloading PyMySQL-1.1.1-py3-none-any.whl (44 kB)
     |████████████████████████████████| 44 kB 1.2 MB/s 
dCollecting mysql-connector-python
  Downloading mysql_connector_python-8.4.0-cp39-cp39-manylinux_2_17_x86_64.whl (19.4 MB)
     |████████████████████████████████| 19.4 MB 13.4 MB/s 
Collecting mysqlclient
  Using cached mysqlclient-2.2.4.tar.gz (90 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /var/www/superset/venv/bin/python3 /tmp/tmpbxitpo2__in_process.py get_requires_for_build_wheel /tmp/tmp6n_qqy4b
       cwd: /tmp/pip-install-vy6jghet/mysqlclient_ef2fd23b21b543dcb464f3f29705ad1f
  Complete output (27 lines):
  /bin/sh: 1: pkg-config: not found
  /bin/sh: 1: pkg-config: not found
  /bin/sh: 1: pkg-config: not found
  Trying pkg-config --exists mysqlclient
  Command 'pkg-config --exists mysqlclient' returned non-zero exit status 127.
  Trying pkg-config --exists mariadb
  Command 'pkg-config --exists mariadb' returned non-zero exit status 127.
  Trying pkg-config --exists libmariadb
  Command 'pkg-config --exists libmariadb' returned non-zero exit status 127.
  Traceback (most recent call last):
    File "/tmp/tmpbxitpo2__in_process.py", line 280, in <module>
      main()
    File "/tmp/tmpbxitpo2__in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tmpbxitpo2__in_process.py", line 114, in get_requires_for_build_wheel
      return hook(config_settings)
    File "/tmp/pip-build-env-wxij91p_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 327, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=[])
    File "/tmp/pip-build-env-wxij91p_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 297, in _get_build_requires
      self.run_setup()
    File "/tmp/pip-build-env-wxij91p_/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 313, in run_setup
      exec(code, locals())
    File "<string>", line 155, in <module>
    File "<string>", line 49, in get_config_posix
    File "<string>", line 28, in find_package_name
  Exception: Can not find valid pkg-config name.
  Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
rieneverts commented 4 months ago

Managed to fix it by adding this step:

(venv) root@educationwarehouse:/var/www/superset# sudo apt-get install python3-dev default-libmysqlclient-dev build-essential pkg-config 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
build-essential is already the newest version (12.9).
build-essential set to manually installed.
pkg-config is already the newest version (0.29.2-1).
python3-dev is already the newest version (3.9.2-3).
python3-dev set to manually installed.
The following additional packages will be installed:
  libmariadb-dev libmariadb-dev-compat
The following NEW packages will be installed:
  default-libmysqlclient-dev libmariadb-dev libmariadb-dev-compat
0 upgraded, 3 newly installed, 0 to remove and 1 not upgraded.
Need to get 225 kB of archives.
After this operation, 894 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.nl.debian.org/debian bullseye/main amd64 libmariadb-dev amd64 1:10.5.23-0+deb11u1 [185 kB]
Get:2 http://ftp.nl.debian.org/debian bullseye/main amd64 libmariadb-dev-compat amd64 1:10.5.23-0+deb11u1 [36.0 kB]
Get:3 http://ftp.nl.debian.org/debian bullseye/main amd64 default-libmysqlclient-dev amd64 1.0.7 [3,936 B]
Fetched 225 kB in 0s (1,777 kB/s)                      
Selecting previously unselected package libmariadb-dev.
(Reading database ... 74113 files and directories currently installed.)
Preparing to unpack .../libmariadb-dev_1%3a10.5.23-0+deb11u1_amd64.deb ...
Unpacking libmariadb-dev (1:10.5.23-0+deb11u1) ...
Selecting previously unselected package libmariadb-dev-compat:amd64.
Preparing to unpack .../libmariadb-dev-compat_1%3a10.5.23-0+deb11u1_amd64.deb ...
Unpacking libmariadb-dev-compat:amd64 (1:10.5.23-0+deb11u1) ...
Selecting previously unselected package default-libmysqlclient-dev:amd64.
Preparing to unpack .../default-libmysqlclient-dev_1.0.7_amd64.deb ...
Unpacking default-libmysqlclient-dev:amd64 (1.0.7) ...
Setting up libmariadb-dev (1:10.5.23-0+deb11u1) ...
Setting up libmariadb-dev-compat:amd64 (1:10.5.23-0+deb11u1) ...
Setting up default-libmysqlclient-dev:amd64 (1.0.7) ...
Processing triggers for man-db (2.9.4-2) ...
Updating coolwsd systemplate
(venv) root@educationwarehouse:/var/www/superset# pip3 install pymysql mysql-connector-python mysqlclient
Collecting pymysql
  Using cached PyMySQL-1.1.1-py3-none-any.whl (44 kB)
Collecting mysql-connector-python
  Downloading mysql_connector_python-9.0.0-cp39-cp39-manylinux_2_17_x86_64.whl (19.3 MB)
     |████████████████████████████████| 19.3 MB 6.8 MB/s 
Collecting mysqlclient
  Using cached mysqlclient-2.2.4.tar.gz (90 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (PEP 517) ... done
  Created wheel for mysqlclient: filename=mysqlclient-2.2.4-cp39-cp39-linux_x86_64.whl size=130376 sha256=186dbc6d08f2673ffbf71696b6a65d55d730463385aa1c975e3a77be9f8675dc
  Stored in directory: /root/.cache/pip/wheels/df/23/68/faa07b93488a130b3295ca4e91574e85a9dc4764cd463bc152
Successfully built mysqlclient
Installing collected packages: pymysql, mysqlclient, mysql-connector-python
Successfully installed mysql-connector-python-9.0.0 mysqlclient-2.2.4 pymysql-1.1.1
(venv) root@educationwarehouse:/var/www/superset# deactivate