pythonanacondamatplotlib-venn

Anaconda can't import installed package matplotlib-venn


I'm about to give up on Anaconda. I never had trouble managing my packages with pip and I just thought I'd try it since now there's one package I can't get with pip and I'd heard so many good things about it.

I can't import a package I just installed with Anaconda, similar to this but on MacOS instead of Windows.

I really don't want multiple environments unless I have to have them. I want to be able to run most/all of my packages from the same scripts. I have a virtual environment named py37 where I've been putting most things. Among other packages:

(py37) jennifers-mbp:~ jenniferlongdiaz$ conda list
#packages in environment at /anaconda3/envs/py37:
#
# Name                    Version                   Build  Channel    
matplotlib-venn           0.11.5                     py_1    conda-forge
numpy                     1.15.3           py37h6a91979_0  
python                    3.7.1                haf84260_3  

Python goes to the right installation:

(py37) jennifers-mbp:~ jenniferlongdiaz$ which python
/anaconda3/envs/py37/bin/python
(py37) jennifers-mbp:~ jenniferlongdiaz$ python
Python 3.7.1 (default, Oct 23 2018, 14:07:42) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.

I can import numpy but not matplotlib-venn:

>>> import numpy as np
>>> import matplotlib_venn as venn

...bunch of stuff and then:

ImportError: cannot import name 'get_backend' from 'matplotlib' (/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/__init__.py)

Similiarly:

>>> from matplotlib import get_backend

...bunch of stuff and then:

ImportError: cannot import name 'get_backend' from 'matplotlib' (/anaconda3/envs/py37/lib/python3.7/site-packages/matplotlib/__init__.py)

From within the IDE spyder ((py37) jennifers-mbp:~ jenniferlongdiaz$ spyder), I get:

In [1]: import matplotlib_venn as venn
Traceback (most recent call last):

  File "<ipython-input-9-aafbc15b97e7>", line 1, in <module>
    import matplotlib_venn as venn

ModuleNotFoundError: No module named 'matplotlib_venn'

Please help!


Solution

  • According to matplotlib-venn's PyPi page (https://pypi.org/project/matplotlib-venn/), the import should look like this:

    import matplotlib_venn as venn
    

    Note that the module is named with an underscore whereas the package is named with a dash; this is a tricky inconsistency


    Update for updated question: the issues with spyder were due to spyder not being installed as part of anaconda, resulting in the system's spyder not being aware of the anaconda environment's packages. Being unable to import get_backend from matplotlib would suggest either a missing or borked matplotlib installation. Both just require installing (or reinstalling) the packages using conda