Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matplotlib required but not listed as dependency #1493

Closed
1 task done
astrojuanlu opened this issue Aug 17, 2023 · 2 comments
Closed
1 task done

matplotlib required but not listed as dependency #1493

astrojuanlu opened this issue Aug 17, 2023 · 2 comments

Comments

@astrojuanlu
Copy link
Member

astrojuanlu commented Aug 17, 2023

Description

matplotlib seems to be required by Kedro Viz, but is not listed as a dependency.

Context

I created a new environment and spaceflights Kedro project to do a test with Kedro Viz, only to discover that I also needed to install matplotlib. I don't recall this happening before.

Steps to Reproduce

$ micromamba create -n _testkedro310 python=3.10 -c conda-forge -y
$ micromamba activate _testkedro310
(_testkedro310) $ pip install kedro kedro-viz
(_testkedro310) $ kedro new --starter=spaceflights
(_testkedro310) $ cd test-kedro-viz
(_testkedro310) $ pip install -r src/requirements.txt
(_testkedro310) $ kedro viz

Expected Result

Kedro Viz launches normally.

Actual Result

Traceback (most recent call last):
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/bin/kedro", line 8, in <module>
    sys.exit(main())
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/kedro/framework/cli/cli.py", line 211, in main
    cli_collection()
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/kedro/framework/cli/cli.py", line 139, in main
    super().main(
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/kedro_viz/launchers/cli.py", line 86, in viz
    from kedro_viz.server import is_localhost, run_server
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/kedro_viz/server.py", line 18, in <module>
    from kedro_viz.integrations.kedro import data_loader as kedro_data_loader
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/kedro_viz/integrations/kedro/data_loader.py", line 132, in <module>
    if hasattr(matplotlib, "MatplotlibWriter"):
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/lazy_loader/__init__.py", line 77, in __getattr__
    submod = importlib.import_module(submod_path)
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/juan_cano/.micromamba/envs/_testkedro310/lib/python3.10/site-packages/kedro_datasets/matplotlib/matplotlib_writer.py", line 11, in <module>
    import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'

Your Environment

Include as many relevant details as possible about the environment you experienced the bug in:

  • Operating system and version: macOS Ventura
  • Kedro version used (if relevant): 0.18.12
  • Python version used (if relevant): 3.10.12

Checklist

  • Include labels so that we can categorise your issue
@tynandebold
Copy link
Member

I can confirm this. It happened to me too. The steps I ran:

conda create --name kedro-viz-matplotlib python=3.10 -y
conda activate kedro-viz-matplotlib
pip install kedro
pip install kedro-viz
kedro new --starter=spaceflights
cd kedro-viz-matplotlib
pip install -r src/requirements.txt
kedro viz

Is the solve to simply include matplotlib in the requirements file?

I'm confused though I don't remember us needing this in the past. Wondering where it came from.

@rashidakanchwala
Copy link
Contributor

This will be resolved once 6.4.0 releases as Nok solved it in this PR - #1481

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants