Reputation: 21
I am trying to install matplotlib
pip install matplotlib
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: matplotlib in ./.local/lib/python2.7/site-packages (2.2.5)
Requirement already satisfied: python-dateutil>=2.1 in ./.local/lib/python2.7/site-packages (from matplotlib) (2.8.2)
Requirement already satisfied: kiwisolver>=1.0.1 in ./.local/lib/python2.7/site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: numpy>=1.7.1 in ./.local/lib/python2.7/site-packages (from matplotlib) (1.16.6)
Requirement already satisfied: six>=1.10 in ./.local/lib/python2.7/site-packages (from matplotlib) (1.16.0)
Requirement already satisfied: cycler>=0.10 in ./.local/lib/python2.7/site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in ./.local/lib/python2.7/site-packages (from matplotlib) (2.4.7)
Requirement already satisfied: pytz in ./.local/lib/python2.7/site-packages (from matplotlib) (2021.3)
Requirement already satisfied: backports.functools-lru-cache in ./.local/lib/python2.7/site-packages (from matplotlib) (1.6.4)
Requirement already satisfied: subprocess32 in ./.local/lib/python2.7/site-packages (from matplotlib) (3.5.4)
Requirement already satisfied: setuptools in ./.local/lib/python2.7/site-packages (from kiwisolver>=1.0.1->matplotlib) (44.1.1)
when I try to verify the version installed
import matplotlib
matplotlib.version
I get this:
import-im6.q16: not authorized
matplotlib' @error/constitute.c/WriteImage/1037.`
What is the problem? Thank you
Upvotes: 2
Views: 2626
Reputation: 363
Looking into your error message in more detail, I found this answer.
It seems like your interpreter is not recognizing your script as python and is instead trying to use this tool.
Possibly try adding a shebang to your python file:
#!/usr/bin/env python3
Or run it explicitly with python:
# if /usr/bin/env python is python3
python myscript.py
# if not
python3 myscript.py
It looks like you are trying to install with a Python2.7 pip. Python 2 is no longer really supported by anyone, so I recommend using Python 3 instead.
To install with python3, maybe try:
pip3 install matplotlib
If you want to update your default pip, you might try the following (see this answer):
pip install --upgrade pip
or
python -m pip install --upgrade pip
The comment to instead use conda is a good call also. Then you can simply do something like
conda create -n plots -c conda-forge python=3.9 matplotlib
conda activate plots
And matplotlib will be part of that python3 env.
Upvotes: 2