module 'matplotlib' has no attribute '_get_configdir' - python

i am using python 3.7.1 and recently when im trying to run matlplotlib it isnt working. im getting this error:
AttributeError: module 'matplotlib' has no attribute '_get_configdir'
i tried using "matplotlib.use("Agg")" and i still get the same error.
i tried upgrading my matlpotlib version in anacond using this command
pip install --upgrade matplotlib and i get this error.
Collecting matplotlib
Using cached https://files.pythonhosted.org/packages/1a/c0/69e3f695d7384012e90be1e16570c08953baae00fd98094179ef87c7d5a2/matplotlib-3.1.1-cp37-cp37m-win_amd64.whl
Requirement already satisfied, skipping upgrade: numpy>=1.11 in c:\users\josh\conda\lib\site-packages (from matplotlib) (1.16.3)
Requirement already satisfied, skipping upgrade: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\josh\conda\lib\site-packages (from matplotlib) (2.3.0)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.1 in c:\users\josh\conda\lib\site-packages (from matplotlib) (2.7.5)
Requirement already satisfied, skipping upgrade: cycler>=0.10 in c:\users\josh\conda\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied, skipping upgrade: kiwisolver>=1.0.1 in c:\user\josh\conda\lib\site-packages (from matplotlib) (1.0.1)
Requirement already satisfied, skipping upgrade: six>=1.5 in c:\users\josh\conda\lib\site-packages (from python-dateutil>=2.1->matplotlib) (1.12.0)
Requirement already satisfied, skipping upgrade: setuptools in c:\users\josh\conda\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (40.6.3)
chances 0.1.6 has requirement matplotlib==2.2.3, but you'll have matplotlib 3.1.1 which is incompatible.
Installing collected packages: matplotlib
Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\\Users\\josh\\conda\\Lib\\site-packages\\matplotlib\\ft2font.cp37-win_amd64.pyd'
Consider using the `--user` option or check the permissions.
can anyone guide me in this?
i dont know what to do. thank you.

Related

not able to install dask on google colab

I use pip method to install on google lab. But I am not sure why it is not working.
Here is what I got
code
pip install "dask[dataframe]" --upgrade
error
Requirement already up-to-date: dask[dataframe] in /usr/local/lib/python3.7/dist-packages (2021.3.1)
Requirement already satisfied, skipping upgrade: partd>=0.3.10 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.1.0)
Requirement already satisfied, skipping upgrade: cloudpickle>=1.1.1 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.3.0)
Requirement already satisfied, skipping upgrade: toolz>=0.8.2 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (0.11.1)
Requirement already satisfied, skipping upgrade: fsspec>=0.6.0 in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (0.8.7)
Requirement already satisfied, skipping upgrade: pyyaml in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (3.13)
Requirement already satisfied, skipping upgrade: numpy>=1.16; extra == "dataframe" in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.19.5)
Requirement already satisfied, skipping upgrade: pandas>=0.25.0; extra == "dataframe" in /usr/local/lib/python3.7/dist-packages (from dask[dataframe]) (1.1.5)
Requirement already satisfied, skipping upgrade: locket in /usr/local/lib/python3.7/dist-packages (from partd>=0.3.10->dask[dataframe]) (0.2.1)
Requirement already satisfied, skipping upgrade: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from fsspec>=0.6.0->dask[dataframe]) (3.7.2)
Requirement already satisfied, skipping upgrade: python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (2.8.1)
Requirement already satisfied, skipping upgrade: pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (2018.9)
Requirement already satisfied, skipping upgrade: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->fsspec>=0.6.0->dask[dataframe]) (3.4.1)
Requirement already satisfied, skipping upgrade: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->fsspec>=0.6.0->dask[dataframe]) (3.7.4.3)
Requirement already satisfied, skipping upgrade: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas>=0.25.0; extra == "dataframe"->dask[dataframe]) (1.15.0)
If I take the dataframe to use. Notification like this happens
code
import dask.dataframe as dd
error
ImportError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/dask/dataframe/__init__.py in <module>()
34 from .optimize import optimize
---> 35 from .multi import merge, concat, merge_asof
36 from . import rolling, backends
3 frames
ImportError: cannot import name 'keys_in_tasks' from 'dask.core' (/usr/local/lib/python3.7/dist-packages/dask/core.py)
The above exception was the direct cause of the following exception:
ImportError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/dask/dataframe/__init__.py in <module>()
55 ' python -m pip install "dask[dataframe]" --upgrade # or python -m pip install'
56 )
---> 57 raise ImportError(msg) from e
ImportError: Dask dataframe requirements are not installed.
Please either conda or pip install as follows:
conda install dask # either conda install
python -m pip install "dask[dataframe]" --upgrade # or python -m pip install
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
I am using google colab to writing, why it is not available here? how could I fix it?
Try this.
!python -m pip install "dask[complete]"
import dask
import dask.dataframe as dd
Need to restart runtime after installing before importing.

Issues importing pandas and matplotlib in anaconda spyder

I tried installing pandas and matplotlib using the pip-command in Anaconda prompt
pip install matplotlib and it gave me the following:
Requirement already satisfied: matplotlib in c:\programdata\anaconda3\lib\site-p
ackages (3.1.3)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\
lib\site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\pr
ogramdata\anaconda3\lib\site-packages (from matplotlib) (2.4.6)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\programdata\anaconda3\lib
\site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: cycler>=0.10 in c:\programdata\anaconda3\lib\site
-packages (from matplotlib) (0.10.0)
Requirement already satisfied: numpy>=1.11 in c:\programdata\anaconda3\lib\site-
packages (from matplotlib) (1.18.1)
Requirement already satisfied: six>=1.5 in c:\programdata\anaconda3\lib\site-pac
kages (from python-dateutil>=2.1->matplotlib) (1.14.0)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-p
ackages (from kiwisolver>=1.0.1->matplotlib) (45.2.0.post20200210)
And when trying to import in Spyder, it says no module found.
What should I do? Thanks in advance.
Make sure your spyder points to your anaconda environment. Currently it is not pointing to your anaconda env that is the reason you are getting this error.

pip install fail: Terminal lists most recent attempts of package installation, won't install packages

In an attempt to access and run Matlab code via Jupyter notebook and Python, I tried installing 'matlab_kernal' (w/ typo) and 'matlab_kernel' as suggested by a blog, I didn't realize I needed MatLab, not MatLab Compiler Runtime.
I received the error:
"Collecting matlab_kernal
Could not find a version that satisfies the requirement matlab_kernal (from versions: )
No matching distribution found for matlab_kernal"
As a work around, I found python code on GitHub that calculated the metric I wanted, but the author said I'd need to install 'MPI' from 'mpi4py'.
However, it seems my Terminal is now stuck on my previous installation attempts of 'matlab_kernal'. It lists my previous attempts to install these packages (see all white text above red error message in the attached screen capture).
I'm running: pip 18.1 from /anaconda3/lib/python3.7/site-packages/pip (python 3.7)
I've tried:
pip uninstall 'package'
Terminal restart
laptop restart
Screenshot of Terminal error
Please use:
pip install matlab-kernel
Try with conda as well:
conda install -c pchrapka matlab_kernel
I think you're making a typo with kernal.
I am on py3.7 with pip v19.3.
Output:
$ pip install matlab-kernel
Collecting matlab-kernel
Downloading https://files.pythonhosted.org/packages/64/ad/5f471160ec33e2f0f3586d285cd5e3b6dff51027849f28369d43d1d57fd1/matlab_kernel-0.16.7-py3-none-any.whl
Requirement already satisfied: jupyter-client>=4.4.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from matlab-kernel) (5.3.4)
Collecting metakernel>=0.23.0
Downloading https://files.pythonhosted.org/packages/ad/a9/0cd74cfbc9c4aeb117bdb7fd9ff12c3890be34ef5c77932e00ef4afaca98/metakernel-0.24.3-py2.py3-none-any.whl (208kB)
|████████████████████████████████| 215kB 246kB/s
Collecting wurlitzer>=1.0.2; platform_system != "Windows"
Downloading https://files.pythonhosted.org/packages/24/5e/f3bd8443bfdf96d2f5d10097d301076a9eb55637b7864e52d2d1a4d8c72a/wurlitzer-2.0.0-py2.py3-none-any.whl
Requirement already satisfied: ipython>=4.0.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from matlab-kernel) (7.8.0)
Requirement already satisfied: pyzmq>=13 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (18.1.0)
Requirement already satisfied: tornado>=4.1 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (6.0.3)
Requirement already satisfied: traitlets in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (4.3.3)
Requirement already satisfied: python-dateutil>=2.1 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (2.8.0)
Requirement already satisfied: jupyter-core>=4.6.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (4.6.0)
Requirement already satisfied: pexpect>=4.2 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from metakernel>=0.23.0->matlab-kernel) (4.7.0)
Collecting portalocker
Downloading https://files.pythonhosted.org/packages/91/db/7bc703c0760df726839e0699b7f78a4d8217fdc9c7fcb1b51b39c5a22a4e/portalocker-1.5.2-py2.py3-none-any.whl
Requirement already satisfied: ipykernel in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from metakernel>=0.23.0->matlab-kernel) (5.1.2)
Collecting ipyparallel
Downloading https://files.pythonhosted.org/packages/3f/82/aaa7a357845a98d4028f27c799f0d3bb2fe55fc1247c73dc712b4ae2344c/ipyparallel-6.2.4-py2.py3-none-any.whl (198kB)
|████████████████████████████████| 204kB 698kB/s
Requirement already satisfied: decorator in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (4.4.0)
Requirement already satisfied: setuptools>=18.5 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (39.0.1)
Requirement already satisfied: pickleshare in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.7.5)
Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (2.0.10)
Requirement already satisfied: jedi>=0.10 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.15.1)
Requirement already satisfied: pygments in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (2.4.2)
Requirement already satisfied: appnope; sys_platform == "darwin" in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.1.0)
Requirement already satisfied: backcall in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.1.0)
Requirement already satisfied: ipython-genutils in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from traitlets->jupyter-client>=4.4.0->matlab-kernel) (0.2.0)
Requirement already satisfied: six in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from traitlets->jupyter-client>=4.4.0->matlab-kernel) (1.12.0)
Requirement already satisfied: ptyprocess>=0.5 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from pexpect>=4.2->metakernel>=0.23.0->matlab-kernel) (0.6.0)
Requirement already satisfied: wcwidth in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython>=4.0.0->matlab-kernel) (0.1.7)
Requirement already satisfied: parso>=0.5.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jedi>=0.10->ipython>=4.0.0->matlab-kernel) (0.5.1)
Installing collected packages: portalocker, ipyparallel, metakernel, wurlitzer, matlab-kernel
Successfully installed ipyparallel-6.2.4 matlab-kernel-0.16.7 metakernel-0.24.3 portalocker-1.5.2 wurlitzer-2.0.0
WARNING: You are using pip version 19.3; however, version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
It's a version issue for pip and MacOS
See this thread
terminal error in MacOS from command 'pip install 'package-name':
"Collecting 'package-name'
Could not find a version that satisfies the requirement 'package-name' (from versions: )
No matching distribution found for 'package-name'"
Uninstall pip and reinstall pip in terminal

pip skipping upgrade, says requirement already satisfied when it is not satisfied

Here's the output of a pip install --upgrade:
[vagrant#cclab8-ht-esx-11 f5]$ sudo pip install f5-icontrol-rest --upgrade
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: https://pypi.org/simple, https://apds-web1.noc.bluecoatcloud.com/symc_pypi/symc_pypi_server.wsgi
Collecting f5-icontrol-rest
Using cached https://files.pythonhosted.org/packages/e0/44/91979de0a81253d025a0814f16f53df46d3ed3edd5b9fd7181f28a9dd0bb/f5-icontrol-rest-1.3.13.tar.gz
Requirement already satisfied, skipping upgrade: requests<3,>=2.5.0 in /usr/lib/python2.7/site-packages (from f5-icontrol-rest) (2.21.0)
Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in /usr/lib/python2.7/site-packages (from requests<3,>=2.5.0->f5-icontrol-rest) (1.24.1)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /usr/lib/python2.7/site-packages (from requests<3,>=2.5.0->f5-icontrol-rest) (3.0.4)
Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in /usr/lib/python2.7/site-packages (from requests<3,>=2.5.0->f5-icontrol-rest) (2.8)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /usr/lib/python2.7/site-packages (from requests<3,>=2.5.0->f5-icontrol-rest) (2018.11.29)
Building wheels for collected packages: f5-icontrol-rest
Building wheel for f5-icontrol-rest (setup.py) ... done
Stored in directory: /root/.cache/pip/wheels/12/43/4c/9c3051759105429cd633ed53ece367db44b082fce01c28db46
Successfully built f5-icontrol-rest
Installing collected packages: f5-icontrol-rest
Found existing installation: f5-icontrol-rest 1.3.12
Uninstalling f5-icontrol-rest-1.3.12:
Successfully uninstalled f5-icontrol-rest-1.3.12
Successfully installed f5-icontrol-rest-1.3.13
You are using pip version 19.0.2, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The issue is that my system requests package is version 2.21.0, and 2.21.0 is not greater than or equal to 2.5.0, yet pip says that the requirement is satisfied.
I do not understand this line:
Requirement already satisfied, skipping upgrade: requests<3,>=2.5.0 in /usr/lib/python2.7/site-packages (from f5-icontrol-rest) (2.21.0)
Does anyone understand why the requirement is satisfied? Why was requests not upgraded?
So yeah, 2.5.0 isn't the same as 2.50.0.

Mac OS High Sierra: Tensorflow verions returned by `pip3 upgrade ` and `python3 -c 'import tensorflow as tf; print(tf.__version__)'` differ

I am currently getting the error, TypeError: softmax() got an unexpected keyword argument 'axis'.
It seems this error is common if you don't have up-to-date keras/tensorflow.
I checked what version of tensorflow I have with python3 -c 'import tensorflow as tf; print(tf.__version__)' It returned 0.12.0 which indeed looks out of date.
However, when I try to upgrade tensorflow, with pip3 install tensorflow --upgrade I get
Requirement already up-to-date: tensorflow in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(0.12.0) Requirement already satisfied, skipping upgrade:
numpy>=1.11.0 in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages(from
tensorflow) (1.15.3) Requirement already satisfied, skipping upgrade:
protobuf==3.1.0 in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(from tensorflow) (3.1.0) Requirement already satisfied, skipping
upgrade: six>=1.10.0 in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(from tensorflow) (1.11.0) Requirement already satisfied, skipping
upgrade: wheel>=0.26 in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(from tensorflow) (0.32.2) Requirement already satisfied, skipping
upgrade: setuptools in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(from protobuf==3.1.0->tensorflow) (39.0.1)
I tried to force the update with pip3 install --ignore-installed --upgrade tensorflow but got:
Collecting tensorflow Could not find a version that satisfies the
requirement tensorflow (from versions: ) No matching distribution
found for tensorflow
When I tried to upgrade with python3 -m pip install tensorflow --upgrade:
Requirement already up-to-date: tensorflow in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.12.0)
Requirement already satisfied, skipping upgrade: wheel>=0.26 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (0.32.2)
Requirement already satisfied, skipping upgrade: protobuf==3.1.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (3.1.0)
Requirement already satisfied, skipping upgrade: numpy>=1.11.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages(from tensorflow) (1.15.3)
Requirement already satisfied, skipping upgrade: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from tensorflow) (1.11.0)
Requirement already satisfied, skipping upgrade: setuptools in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from protobuf==3.1.0->tensorflow) (39.0.1)
When I print sys.path in my program, I get:
['/Users/myname/topdirect', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload', '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages']
pip3 show tensorflow I get:
Name: tensorflow
Version: 0.12.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource#google.com
License: Apache 2.0
Location: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
Requires: six, protobuf, numpy, wheel
Required-by:
First of all, I would recommend using anaconda environment to manage your tensorflow version. On the other side, you need to add your operating system to make the question more clear.

Categories