Tonight I try to install a package called "requests" and started messing around with the terminal, and I donβt have much intuition when it comes to this kind of thing.
Mac mini OSX Version 10.9.4
In / Library / Python, I have 4 folders: 2.3, 2.5, 2.6, and 2.7.
In / Applications I have "Python 2.7" and "Python 3.4"
I can open IDLE and dial 8 + 8, and I get 16 just fine.
Here is the error I get in the terminal:
host-210-117:~ Mario$ python ImportError: No module named site host-210-117:~ Mario$ pip ImportError: No module named site
My goal is to run this command in the terminal:
pip install requests
I believe the pip is already installed. I run the file "get-pip.py" in IDLE and it says the following:
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg Cleaning up...
Could this be somehow related to the paths? I would appreciate some recommendations / tips / hints, thanks!
Yes, and a little more information that can help resolve this issue. Here are the first few lines of the program I'm running:
import base64 import hmac import json import requests import time import urllib import os
What gives me this error in IDLE (so I think it imports these first few packages without problems?):
>>> Traceback (most recent call last): File "/Users/Mario/Desktop/pyak/pyak.py", line 4, in <module> import requests ImportError: No module named requests >>>
***** List of system paths:
sys.path ['/ Users / Mario / Desktop / pyak', '/ Users / Mario / Documents',' /Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg ',' /Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip ',' /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 ',' /Library/Frameworks/Python.framework /Versions/2.7/lib/python2.7/plat-darwin ',' /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac ',' /Library/Frameworks/Python.framework /Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages ',' /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk ',' / Library / Frameworks /Python.framework/Versions/2.7/lib/python2.7/lib-old ',' /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload ',' / Library / Frameworks /Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
*** one more update:
host-210-117:~ Mario$ which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python
*** a little more information (is this supposed to happen?)
host-210-117:~ Mario$ which pip /usr/local/bin/pip host-210-117:~ Mario$ pip ImportError: No module named site
*** After changing .bashrc
.bashrc: this is what the file
export PATH = "$ PATH: $ HOME / .rvm / bin" # Add RVM to PATH for scripts
alias python = / library / Python / 2.7 / python
Here is the result of the work:
pip install requests
host-210-117: ~ Mario $ pip installation requests
Download / unpack requests
Download requests-2.4.1-py2.py3-none-any.whl (458 KB): 458 KB downloaded
Installing Compiled Packages: Requests
Cleaning ...
An exception:
Traceback (last call was last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, basically status = self.run (parameters, arguments)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in work require_set.install (install_options, global_options, root = options .root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in the installation require.install (install_options, global_options, * args, ** kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in the installation self.move_wheel_files (self.source_dir, root = root) File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files pycompile = self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 215, in move_wheel_files Clobber (source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 205, in os.makedirs clobber (DESTDIR)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs mkdir (name, mode)
OSError: [Errno13] Access denied: '/Library/Python/2.7/site-packages/requests'
Storing debug log for failure in /Users/Mario/Library/Logs/pip.log