Skip to content

bivariate_normal function has been removed from matplotlib #48

@DaisyLyu522

Description

@DaisyLyu522

Hello,
I am trying to run swifr_train and it gives me the error:
Traceback (most recent call last): File "/home/anaconda3/bin/swifr_train", line 5, in <module> from swifr_pkg.SWIFr_train import main File "/home/anaconda3/lib/python3.11/site-packages/swifr_pkg/SWIFr_train.py", line 13, in <module> from matplotlib.mlab import bivariate_normal ImportError: cannot import name 'bivariate_normal' from 'matplotlib.mlab' (/home/anaconda3/lib/python3.11/site-packages/matplotlib/mlab.py)

I noticed that bivariate_normal function has been removed from matplotlib, so I modify the from matplotlib.mlab import bivariate_normal to be from scipy.stats import multivariate_normal.

After this modification, I ran swifr_train again and receive another error:
Traceback (most recent call last): File "/home/anaconda3/bin/swifr_train", line 5, in <module> from swifr_pkg.SWIFr_train import main File "/home/anaconda3/lib/python3.11/site-packages/swifr_pkg/SWIFr_train.py", line 14, in <module> from matplotlib.mlab import normpdf ImportError: cannot import name 'normpdf' from 'matplotlib.mlab' (/home/anaconda3/lib/python3.11/site-packages/matplotlib/mlab.py)

It seems that some packages have been removed from the matplotlib. I can search for alternative and modify the code but I'm worrying that it cause some issues. Do you have any suggestions?

As for reference, when installing swifr, I received the error:
`[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for scipy
Running setup.py clean for scipy
error: subprocess-exited-with-error

× python setup.py clean did not run successfully.
│ exit code: 1
╰─> [9 lines of output]

  setup.py clean is not supported, use one of the following instead:
  
    - git clean -xdf (cleans all files)
    - git clean -Xdf (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)
  
  Add --force to your command to use it anyway if you must (unsupported).
  
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed cleaning build dir for scipy
Failed to build numpy scikit-learn scipy
ERROR: Could not build wheels for numpy, scikit-learn, scipy, which is required to install pyproject.toml-based projects`

So I uninstalled numpy and installed swifr with code below:
pip install -U numpy
pip install --no-deps swifr

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions