Typeerror: Use() Got an Unexpected Keyword Argument 'Warn' When Importing Matplotlib

TypeError: use() got an unexpected keyword argument 'warn'

Never worked with this library before, but I did look at the documentation (https://matplotlib.org/3.2.1/api/matplotlib_configuration_api.html#matplotlib.use)

It seems to me that you are passing a parameter (warn) that has been deprecated

Try this:

matplotlib.use(backend, force=True)

Edited:
The above mentioned solution didn't work for me.
As mentioned by @JustCarlos, I solved this issue by deleting the warn argument from line matplotlib.use() in two files tables.py and util.py. But I'm not sure if this deletion affects the other use of this library.

TypeError: import_optional_dependency() got an unexpected keyword argument 'errors'

Try to upgrade pandas:

pip install pandas --upgrade

Python from RMarkdown - Matplotlib problems

In my original question, I referred to this question in which there was a suggestion to downgrade matplotlib to version 3.2.0 because reticulate was not up to date with changes in matplotlib. I followed up further on that suggestion and have found a resolution (for now).

TL;DR

Removing pip and conda installed versions of matplotlib, and then installation of matplotlib version 3.2.2 with conda (NOT pip) resolves the problem. Installing matplotlib with pip leads to other errors.

Details

In the response to the other question, the suggestion was to do:

pip install matplotlib==3.2  

I tried this and ended up with other errors that I also could not track down. So, I uninstalled matplotlib and then reinstalled it with

pip install matplotlib==3.3.1

in hopes of getting back to where I was. This also did not work and the new errors persisted. I then removed matplotlib completely and with pip and reinstalled version 3.3.1 with conda:

pip uninstall matplolib
conda install matplotlib

This got me back to matplotlib version 3.3.1 and the original error I mention in my question. I then tried installing matplotlib version 3.2 with conda:

conda install matplotplib==3.2

The installed version is 3.2.2 and not 3.2.0, as suggested in the response, but when I did this, the original problem seems to be resolved.

There is clearly a difference in dependency resolution between pip and conda in this case, and conda provides a version of matplotlib that plays nicely with reticulate. I do not at this point know what the difference is, however.

Matplotlib: remove warning about matplotlib.use()

While I can't test this Ipython tells me that "one can set warn=False to supporess the warnings."

Source:

matplotlib.use?

Type: function
String Form:<function use at 0x98da02c>
File: /usr/lib/pymodules/python2.7/matplotlib/__init__.py
Definition: matplotlib.use(arg, warn=True)
Docstring:
Set the matplotlib backend to one of the known backends.

The argument is case-insensitive. For the Cairo backend,
the argument can have an extension to indicate the type of
output. Example:

use('cairo.pdf')

will specify a default of pdf output generated by Cairo.

.. note::

This function must be called *before* importing pyplot for
the first time; or, if you are not using pyplot, it must be called
before importing matplotlib.backends. If warn is True, a warning
is issued if you try and call this after pylab or pyplot have been
loaded. In certain black magic use cases, e.g.
:func:`pyplot.switch_backends`, we are doing the reloading necessary to
make the backend switch work (in some cases, e.g. pure image
backends) so one can set warn=False to supporess the warnings.

To find out which backend is currently set, see
:func:`matplotlib.get_backend`.

Always fun to find a typo in the docs.

When I run the code it says TypeError: unlink() got an unexpected keyword argument 'missing_ok'

The missing_ok parameter was added to Path.unlink only on python 3.8. You should upgrade python to newer version if you want to use this parameter.

You can check your python version with the command python -V

Got an unexpected keyword argument 'label' while drawing box and whisker plot in Python Matplotlib

Check the docstring again. The argument is labels.



Related Topics



Leave a reply



Submit