0
votes

I'm new in the field, so sorry for possible silly mistakes. I'm working with snakemake, so I created a conda environment following their directions:

conda install -c conda-forge mamba
mamba create -c conda-forge -c bioconda -n snakemake snakemake

However, while I was running the basic tutorial (enter link description here) a ModuleNotFoundError occurred:

snakemake --cores 1

ModuleNotFoundError: No module named 'matplotlib'

For this reason, I've installed matplotlib with conda-forge:

conda install -c conda-forge matplotlib 

However, when I re-runned the tutorial, I got an ImportError:

ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/init.py) So I decided to install in the same conda environment also pillow:

conda install -c conda-forge pillow 

But I obtain the same error running the tutorial.

All of the imported packages are coming from my conda environment:

anaconda3/envs/snakemake/lib/python3.9/site-packages

Besides the path of PIL/pillow which is imported from:

usr/lib/python3/dist-packages

I also update conda, anaconda and all of the packages present in my snakemake environment. Moreover, I checked the presence of PIL with conda list and it is actualy present in my snakemake environment with the same path of other packages (anaconda3/envs/snakemake/lib/python3.9/site-packages).

I've noticed that in other issues it is suggested to uninstall and re install Pillow. Howeever, when I try to uninstall:

pip uninstall Pillow

and

pip3 uninstall Pillow

I obtain:

PermissionError: [Errno 13] Permesso negato: 'BlpImagePlugin.cpython-38.pyc'

Therefore I've tried to force the upgrade:

pip install -U Pillow --user

and

pip3 install -U Pillow --user

And the terminal states that I have succesfully installed Pillow 8.0.1. However, when I import matplotlib the same error occurs:

ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/init.py)

I'm grateful for any hints Thank you

2

2 Answers

0
votes

I guess you missed a part in the setup for the tutorial (https://snakemake.readthedocs.io/en/stable/tutorial/setup.html). In step 2, you download an environment.yaml and use it to install all needed packages. Or you could try and install all packages yourself, look at the list under "Requirements".

0
votes

Solved uninstalling from the system PIL package:

sudo apt-get remove python-pil

I still do not know why it works, but at least now I can use properly matplotlib