Installing matplotlib using pip gives error - python

I am new to python and is using pip to download and install packages. I ran the following code on my command window and it throws an error
pip install matplotlib
And the process starts as
Collecting matplotlib
Using cached matplotlib-1.5.3-cp27-cp27m-win32.whl
Collecting numpy>=1.6 (from matplotlib)
Using cached numpy-1.11.2-cp27-none-win32.whl
Collecting python-dateutil (from matplotlib)
Using cached python_dateutil-2.5.3-py2.py3-none-any.whl
Collecting cycler (from matplotlib)
Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,>=1.5.6 (from matplotlib)
Using cached pyparsing-2.1.10-py2.py3-none-any.whl
Collecting pytz (from matplotlib)
Using cached pytz-2016.7-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil->matplotlib)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: numpy, six, python-dateutil, cycler, pyparsing, pytz, matplotlib
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "c:\python27\lib\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "c:\python27\lib\site-packages\pip\req\req_set.py", line 742, in install
**kwargs
File "c:\python27\lib\site-packages\pip\req\req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "c:\python27\lib\site-packages\pip\req\req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "c:\python27\lib\site-packages\pip\wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "c:\python27\lib\site-packages\pip\wheel.py", line 324, in clobber
shutil.copyfile(srcfile, destfile)
File "c:\python27\lib\shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: 'c:\\python27\\Lib\\site-packages\\numpy\\core\\multiarray.pyd'
And it gives these traceback errors. I'm unable to figure out what these errors are and how to solve them. Please help. It works perfectly till collecting the packages but at the time of installing it throws errors.

If you're using Windows, the easiest way to install many of the numerically-oriented Python packages is to download one of wheels containing pre-compiled binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/, and install using pip:
pip install SomePackage-1.0-py2.py3-none-any.whl
Make sure to download the right wheel version (Python2 or Python3, 32 bit or 64 bit) for your Python installation.

Try python -m pip install matplotlib.
or
Open the cmd as administrator
then python -m pip install matplotlib

Related

Python: Kivy throws an exception when trying to install it with pip

I am currently trying to install kivy to python 3.6, but when i am trying yo install it it throws the following exception:
C:\Users\magshimim\Desktop\notKivy>python -m pip install kivy
Collecting kivy
Using cached
https://files.pythonhosted.org/packages/29/e6/e07f77a8d85a626bb955fe072d41042c4c
ee6deaca61295f1c08e6407097/Kivy-1.10.0-cp36-cp36m-win32.whl Collecting Kivy-Garden>=0.1.4 (from kivy)
Using cached https://files.pythonhosted.org/packages/7d/68/decaee596ff8168a39432eb3949fc7c0be952ebb9467806823bffc165d48/kivy-garden-0.1.4.tar.gz
Requirement already satisfied: docutils in c:\python36\lib\site-packages (from kivy)
Requirement already satisfied: pygments in c:\python36\lib\site-packages (from kivy)
Requirement already satisfied: requests in c:\python36\lib\site-packages (from Kivy-Garden>=0.1.4->kivy)
Exception:
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Python36\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Python36\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Python36\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Python36\lib\site-packages\pip\req\req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:\Python36\lib\site-packages\pip\utils\packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:\Python36\lib\email\feedparser.py", line 175, in feed
self._input.push(data)
File "C:\Python36\lib\email\feedparser.py", line 103, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
Any help?
Try instead:
pip install kivy
Worked for me on my Windows machine. Make sure pip is in the Path enviornment variable on your machine.

Error while installing core ML tools [duplicate]

This question already has answers here:
Error installing coremltools
(5 answers)
Closed 5 years ago.
I am trying to convert a caffe model to core ML model.
Please find the error while running pip install coremltools
Collecting coremltools
Using cached coremltools-0.4.0-py2.7-none-any.whl
Requirement already satisfied: numpy>=1.6.2 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from coremltools)
Collecting protobuf>=3.1.0 (from coremltools)
Using cached protobuf-3.3.0.tar.gz
Collecting six>=1.9 (from protobuf>=3.1.0->coremltools)
Using cached six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from protobuf>=3.1.0->coremltools)
Installing collected packages: six, protobuf, coremltools
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/var/folders/5z/5hfw98ks677_r5rqm498kq1c0000gn/T/pip-DMhcCb-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
I am new to machine learning. Please suggest a solution
As error said - operation is not permitted. I'm Linux not Mac user - but it's probably because you try to do this without root privilages.
You can try sudo pip install coremltools. But generally speaking installing development libraries system-wide is not best practice.
You should definitely use virtualenv.

pip install census for census.gov API

I am very new to python, and I am trying to speak with the census.gov API to find the population of several zipcodes. I was able to get my API key, and I am using this python wrapper: https://github.com/datamade/census. I was able to install pip using the sudo easy_install pip command. Here's an example of the output when I run it again:
Best match: pip 9.0.1
Processing pip-9.0.1-py2.7.egg
pip 9.0.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin
Using /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
I am trying to use the commands:
pip install census
pip install us
pip install us seems to have worked, but I am getting a Traceback when trying pip install census:
Using cached census-0.8.3-py2.py3-none-any.whl
Collecting requests>=1.1.0 (from census)
Using cached requests-2.18.1-py2.py3-none-any.whl
Collecting urllib3<1.22,>=1.21.1 (from requests>=1.1.0->census)
Using cached urllib3-1.21.1-py2.py3-none-any.whl
Collecting idna<2.6,>=2.5 (from requests>=1.1.0->census)
Using cached idna-2.5-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests>=1.1.0->census)
Using cached certifi-2017.4.17-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests>=1.1.0->census)
Using cached chardet-3.0.4-py2.py3-none-any.whl
Installing collected packages: urllib3, idna, certifi, chardet, requests, census
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_set.py", line 784, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/urllib3'
I am not sure what to do. Can anyone help? I am using python 2.7.10 by the way.
Your user doesn't have write permissions on /System/Library. Either run pip install from the root user or use pip install -u to install the library to your own directory instead of the system one.

Exception when installing Tweepy on OS X Terminal

I've browsed around but couldn't find anyone else getting this error. I'm trying to make a TwitterBot but I am unable to install tweepy with the following command:
pip install tweepy
I've tried using sudo/su and a few other methods but this exception always pops up:
pip install tweepy
Collecting tweepy
Downloading tweepy-3.5.0-py2.py3-none-any.whl
Requirement already satisfied: requests>=2.4.3 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tweepy)
Requirement already satisfied: requests-oauthlib>=0.4.1 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tweepy)
Collecting six>=1.7.3 (from tweepy)
Downloading six-1.10.0-py2.py3-none-any.whl
Requirement already satisfied: oauthlib>=0.6.2 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from requests-oauthlib>=0.4.1->tweepy)
Installing collected packages: six, tweepy
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-ACL5B3-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
I think that your problem is linked to six package.
Try to install tweepy running this command:
sudo pip install tweepy --ignore-installed six
or
pip install --ignore-installed six
You can find the six issue here.
Let me know.
The exception is for non root users.
Try,
sudo pip install tweepy

Python: Error while installing Numpy & Pandas

I am trying to install numpy, scipy and pandas but getting the following error:
Aleeshas-MacBook-Air:~ aleesha$ pip install numpy scipy pandas
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requirement already satisfied (use --upgrade to upgrade): scipy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Collecting pandas
Using cached pandas-0.19.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Requirement already satisfied (use --upgrade to upgrade): pytz>=2011k in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from pandas)
Installing collected packages: pandas
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_set.py", line 742, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 831, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/req/req_install.py", line 1032, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/wheel.py", line 346, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/wheel.py", line 317, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-8.1.2-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pandas'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Aleeshas-MacBook-Air:~ aleesha$
I have Python version - Python 3.5.2. Why in the first place is pip trying to install at 2.7?
I suggest you install Anaconda, with it you will solve a lot of issues. It supports the latest 3.5 version, comes equipped with most of the data analitics libraries and the ones you dont have you can get with pip install, which is guaranteed to work since pip get comes with Anaconda as well.

Categories

Resources