Error loading matplotlib python module in Spotfire Analyst

I am trying to deploy python modules as an .spk file to Spotfire sever and then import those modules in Spotfire analyst (10.8) in Data Function Properties. Everyhting works fine when I create a .spk file without the matplotlib module (or any module that depends on matplotlib). When I add matplotlib to my requirements.txt file, the .spk creation works, and the server deployment works, but then when I try to load any module in Spotfire analyst (not just the matplotlib module specifically), I get the following error:

Could not execute function call 'Untitled'

Traceback (most recent call last):

  File "(init script)", line 4, in <module>

    import spotfire.data_function as dfn

  File "<frozen importlib._bootstrap>", line 983, in _find_and_load

  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked

  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Core_44.0.14430.3578\python\spotfire.zip\spotfire\data_function.py", line 11, in <module>

  File "<frozen importlib._bootstrap>", line 983, in _find_and_load

  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked

  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Core_44.0.14430.3578\python\spotfire.zip\spotfire\sbdf.py", line 29, in <module>

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Python Packages_1.0.0.0\site-packages\matplotlib\__init__.py", line 1015, in <module>

    rcParams = rc_params()

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Python Packages_1.0.0.0\site-packages\matplotlib\__init__.py", line 878, in rc_params

    return rc_params_from_file(matplotlib_fname(), fail_on_error)

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Python Packages_1.0.0.0\site-packages\matplotlib\__init__.py", line 731, in matplotlib_fname

    for fname in gen_candidates():

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Python Packages_1.0.0.0\site-packages\matplotlib\__init__.py", line 728, in gen_candidates

    yield os.path.join(get_configdir(), 'matplotlibrc')

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Python Packages_1.0.0.0\site-packages\matplotlib\__init__.py", line 276, in wrapper

    ret = func(**kwargs)

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Python Packages_1.0.0.0\site-packages\matplotlib\__init__.py", line 609, in get_configdir

    return _get_config_or_cache_dir(_get_xdg_config_dir())

  File "C:\Users\luke.george\AppData\Local\TIBCO\Spotfire\10.8.0\Modules\Python Packages_1.0.0.0\site-packages\matplotlib\__init__.py", line 562, in _get_xdg_config_dir

    return os.environ.get('XDG_CONFIG_HOME') or str(Path.home() / ".config")

AttributeError: type object 'Path' has no attribute 'home'



   at Spotfire.Dxp.Data.DataFunctions.Executors.LocalPythonFunctionClient.<RunFunction>d__8.MoveNext()

   at Spotfire.Dxp.Data.DataFunctions.Executors.PythonScriptExecutor.<ExecuteFunction>d__11.MoveNext()

   at Spotfire.Dxp.Data.DataFunctions.DataFunctionExecutorService.<ExecuteFunction>d__8.MoveNext()

 

Any idea why this is? 

1 Comment

I had matplotlib != 3.2.1 because you asked me to try a different version of matplotlib. When I did that, it installed the previous version 3.2.0. Previously I have also installed 3.2.1 with the same problem. 

luke.george-0 - Mar 23, 2020 - 2:24pm
+ Add a Comment

(1) Answer

Login