I installed anaconda for the first time and have had to uninstall and reinstall many times due to different issues I've faced. This is my first time working with the program so I don't know much about it.
On a clean install I entered the following into the anaconda prompt:
conda update --all
conda install pyreadstat --channel conda-forge --yes
conda install geopandas --channel conda-forge
Then, when launching Jupyter and running the following:
import pandas as pd
import seaborn as sns
I receive the following error:
if __version__ != getattr(core, "PILLOW_VERSION", None):
msg = (
"The _imaging extension was built for another version of Pillow or PIL:\n"
f"Core version: {getattr(core, 'PILLOW_VERSION', None)}\n"
f"Pillow version: {__version__}"
ImportError: DLL load failed while importing _imaging: The specified module could not be found.
When running this code:
import pandas as pd
poll_url = 'http://projects.fivethirtyeight.com/general-model/president_general_polls_2016.csv'
polls = pd.read_csv(poll_url)
polls
polls.sort_values('startdate', ascending=False, inplace=True)
polls.head()
polls.drop(columns=['cycle','branch','matchup','forecastdate'], inplace=True)
polls.head(2)
polls.plot.line(xlim=('2016-06','2016-11'))
I receive the error:
ImportError: matplotlib is required for plotting when the default backend "matplotlib" is selected.
I had trouble installing geopandas for several days and would get stuck in solving environment for hours at a time and a few times my navigator wouldn't open after.
Installation instructions are from the Murach book Data Analysis for Python, and the code shown above is as well. I'm assuming there's some kind of compatibility error somewhere? Solutions I've seen are to use pip, which can corrupt your environment when mixed with conda commands, or creating a separate environment, but the book requires you to work in the base. Some of the packages and versions I have are:
conda 23.7.3
geopandas 0.13.2
ipython 8.12.2
matplotlib 3.7.1
pandas 2.0.3
pillow 9.4.0
python 3.11.4
Thanks!
I faced this same error somedays ago after installing
geopandassome day ago. My python version is3.10.12. I solved this by doing the following steps:Downgraded my
pillowpackage to version-9.0.0. It is working fine since then. Just do this:then install
pillow-9.0.0with pip:I don't know the exact reason for the conflict between
matplotlibandpillowbut downgrading it worked for me. Also I found the solutio from here: https://github.com/msys2/MINGW-packages/issues/11103Edit: How to create a new conda environment with specific python version
Choose the python version you want. Then activate the environment.