I'm running python 2.7 on Windows 7, setup via Anaconda. I wanted to update my matplotlib by running pip install matplotlib --upgrade and received the following error message:
C:\Windows\system32>pip install matplotlib Downloading/unpacking
matplotlib Requirement already satisfied (use --upgrade to upgrade):
numpy>=1.6 in c:\anaco nda\lib\site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade):
pyparsing>=1.5.6 in c: \anaconda\lib\site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade):
python-dateutil in c:\ anaconda\lib\site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): pytz in
c:\anaconda\li b\site-packages (from matplotlib) Requirement already
satisfied (use --upgrade to upgrade): six>=1.4 in c:\anacond
a\lib\site-packages (from matplotlib) Installing collected packages:
matplotlib Cleaning up... Exception: Traceback (most recent call
last): File "C:\Anaconda\lib\site-packages\pip\basecommand.py", line
122, in main
status = self.run(options, args) File "C:\Anaconda\lib\site-packages\pip\commands\install.py", line 283, in
run
requirement_set.install(install_options, global_options, root=options.root_p ath) File
"C:\Anaconda\lib\site-packages\pip\req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs) File "C:\Anaconda\lib\site-packages\pip\req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root) File "C:\Anaconda\lib\site-packages\pip\req.py", line 901, in
move_wheel_files
pycompile=self.pycompile, File "C:\Anaconda\lib\site-packages\pip\wheel.py", line 215, in
move_wheel_fil es
clobber(source, lib_dir, True) File "C:\Anaconda\lib\site-packages\pip\wheel.py", line 209, in clobber
shutil.copy2(srcfile, destfile) File "C:\Anaconda\lib\shutil.py", line 130, in copy2
copyfile(src, dst) File "C:\Anaconda\lib\shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst: IOError: [Errno 13] Permission denied: 'C:\Anaconda\Lib\site-packages\matplo tlib\ft2font.pyd'
I gave myself 'full control' by right clicking on the Anaconda folder, going to the security tab and changing the permissions. I also restarted my command window as an administrator. (The account I use is an administrator, but in light of: What precisely does 'Run as administrator' do? I thought it couldn't hurt)
Despite these two steps I'm still getting an IOError: [Errno13] on the cleaning up step. I can no longer import matplotlib. I have also tried uninstalling and reinstalling matplotlib. I hope to avoid doing that for Anaconda.
Related
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
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.
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
Trying to run ipython after installing via pip causes:
$ ipython
-bash: ipython: command not found
Do I need to add a directory to my path? The python installation guide doesn't mention it:
http://ipython.org/install.html
Everything seems to be installed as expected:
$ pip show ipython
---
Metadata-Version: 2.0
Name: ipython
Version: 4.0.0
Summary: IPython: Productive Interactive Computing
Home-page: http://ipython.org
Author: The IPython Development Team
Author-email: ipython-dev#scipy.org
License: BSD
Location: /Library/Python/2.7/site-packages
Requires: traitlets, pickleshare, simplegeneric, decorator, gnureadline, appnope, pexpect
I'm currently using python version 2.7.10 on Mac OS X 10.11
EDIT:
I've tried uninstalling and re-installing and now I'm getting this error:
sudo -H pip install ipython
Collecting ipython
Downloading ipython-4.0.0-py2-none-any.whl (730kB)
100% |████████████████████████████████| 733kB 459kB/s
Requirement already satisfied (use --upgrade to upgrade): traitlets in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): pickleshare in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): simplegeneric>0.8 in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): decorator in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): gnureadline in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): appnope in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): pexpect in /Library/Python/2.7/site-packages (from ipython)
Requirement already satisfied (use --upgrade to upgrade): ipython-genutils in /Library/Python/2.7/site-packages (from traitlets->ipython)
Requirement already satisfied (use --upgrade to upgrade): path.py in /Library/Python/2.7/site-packages (from pickleshare->ipython)
Requirement already satisfied (use --upgrade to upgrade): ptyprocess>=0.5 in /Library/Python/2.7/site-packages (from pexpect->ipython)
Installing collected packages: ipython
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_set.py", line 646, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/req/req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 371, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/wheel.py", line 310, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-7.1.2-py2.7.egg/pip/utils/__init__.py", line 71, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/share'
I guess this error may have happened the first time around, as it still thinks it has been installed properly!
I got same problem. When you uninstall and reinstall ipython, the error happens because of permission. You can delete the directory and reinstall by "sudo pip install ipython".
I don't know why but it installs in 'usr/local/bin' instead of 'usr/bin'. I have to use "sudo ipython" to run it.
On trying to install ipython for Python3.4 I get a message that it is already installed.
pip3 install ipython
Requirement already satisfied (use --upgrade to upgrade): ipython in /usr/local/lib/python3.4/site-packages
But when I try to run it with ipython3 notebook I get all this:
Traceback (most recent call last):
File "/usr/local/bin/ipython3", line 11, in <module>
sys.exit(start_ipython())
File "/usr/local/lib/python3.4/site-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 573, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/terminal/ipapp.py", line 321, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/core/application.py", line 369, in initialize
self.parse_command_line(argv)
File "/usr/local/lib/python3.4/site-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 471, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.4/site-packages/IPython/config/application.py", line 402, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python3.4/site-packages/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/usr/local/lib/python3.4/site-packages/IPython/html/notebookapp.py", line 67, in <module>
from .services.sessions.sessionmanager import SessionManager
File "/usr/local/lib/python3.4/site-packages/IPython/html/services/sessions/sessionmanager.py", line 7, in <module>
import sqlite3
File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'
Assuming that the last line is the most important
ImportError: No module named '_sqlite3'
I tried to install all sorts of dependencies for it:
apt-get install sqlite3 libsqlite3-dev
When I tried installing Pysqlite via pip3 install pysqlite :
Collecting pysqlite
Using cached pysqlite-2.6.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-ggtq7_wu/pysqlite/setup.py", line 85
print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ggtq7_wu/pysqlite
However Sphinx is already installed. I even reinstalled it.
pip3 install sphinx
Requirement already satisfied (use --upgrade to upgrade): sphinx in /usr/local/lib/python3.4/site-packages
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.3 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): snowballstemmer>=1.1 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): docutils>=0.11 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): babel>=1.3 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): sphinx-rtd-theme<0.2,>=0.1 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): alabaster<0.8,>=0.7 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): Pygments>=2.0 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4 in /usr/local/lib/python3.4/site-packages (from sphinx)
Requirement already satisfied (use --upgrade to upgrade): markupsafe in /usr/local/lib/python3.4/site-packages (from Jinja2>=2.3->sphinx)
Requirement already satisfied (use --upgrade to upgrade): pytz>=0a in /usr/local/lib/python3.4/site-packages (from babel>=1.3->sphinx)
Hence I have not been able to resolve it because evidently that file _sqlite3.so which should be in /usr/local/lib/python3.4/lib-dynload does not exist and I cannot find a way to install it.
I managed to resolve it thanks to the help I got in the comments.
Just putting it here to make it easy for anyone else who may have the same issue to figure out whats going on.
The issue is in using a self compiled version of Python, before the sql dev files were installed. Hence the bindings did not take.
First I had to use sudo apt-get install sqlite3 libsqlite3-dev to get the relevant sqlite files.
Then I had to recompile the Python by using a Source Tarball and executing the following commands to recompile it.
make clean
./configure
make
make install
I got the same issue on CentOS 6.8 and I installed sqlite-devel and then I re-compiled the python and got the issue fixed:
yum install sqlite-devel