I would like to get matplotlib master and run the tests. Despite all the information found online, e.g., https://matplotlib.org/devel/index.html, I was not able to do so.
What I’ve tried:
git clone git@github.com:matplotlib/matplotlib.git
cd matplotlib
pip3 install . --user
pytest
This fails with
E ImportError: cannot import name 'ft2font' from 'matplotlib' (/home/nschloe/software/matplotlib/source-nschloe/lib/matplotlib/__init__.py)
If instead of pytest I run
python3 -c "import matplotlib; matplotlib.test()"
I’m getting
E OSError: The baseline image directory does not exist. This is most likely because the test data is not installed. You may need to install matplotlib from source to get the test data.
--user is pip installings things “globally” which can cause havoc when working with virtual enviroments and multiple versions of Python.
The source of both of those issues is that by not passing -e you have fully installed Matplotlib. In the first case pytest is finding the source files, trying to import them and failing because the built modules are not in the right place for pytest to find them (they are in the right place if you were to just import matplotlib). This is a consequence of pytests extensive test discovery code. The second issue is because by default we do not install the baseline images (which save a lot of bits for the wheels and conda packages). In that case you can import Matplotlib, but then it can’t find the baseline images.
Where should we have put that information to make it more findable?
running develop
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/test-easy-install-22315.write-test'
I have to add --user. It does work then though, and also running pytest in the source directory works. I suppose it picks up matplotlib from ~/.local/ then.
Where should we have put that information to make it more findable?
The first place I was looking at testing was the main readme under Test. It would have helped me if the line of code
FileNotFoundError: [Errno 2] No such file or directory: '/home/nschloe/software/matplotlib/source-nschloe/result_images/test_arrow_patches/fancyarrow_test_image-expected_svg.png'
In the directory, I see a bunch of files, but not the right one:
I strongly suggest making use of a virtual enviroment for development (of whatever flavor you prefer) and am on suggesting the use of --user in the documentation.
That suggests you have overlapping installs of Matplotlib and are running the tests from one of them against the baseline images from the other.
I’ve got all mpl dependencies installed, so I suppose I don’t have to resort to conda right now.
I’m not too familiar with virtualenvs, so I’ll have to make myself familiar with it first. One problem that I can foresee is the fact that I’d like to build matplotlib against a local (modified) copy of numpy.
Thanks @anntzer.lee for your comment. I think being more opinionated about the build environment is a good thing. I’ll wait for this to get merged and then try again.
@nico.schloemer It would be very helpful for us if you could “test drive” those instructions. The core-devs already have our (sometimes idiosyncratic) development workflows set up so are not in a good position to evaluate how useful those directions are to a new contributor!