I'm fairly new to python so please bear with me. I installed the virtual env created a new environment and everything very smooth(great). so when I try to pip freeze it gives me all the global packages that are installed and not only the environment im in. Then I try to install django and it does not let me. This is the error that gives me...
→ pip install django
Collecting django
Downloading Django-1.9.5-py2.py3-none-any.whl (6.6MB)
100% |████████████████████████████████| 6.6MB 187kB/s
Installing collected packages: django
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.1.1-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.1-py2.7.egg/pip/req/req_set.py", line 732, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 835, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 1030, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/wheel.py", line 344, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/wheel.py", line 315, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-8.1.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/django'
OK. I got it working. The problem was something with a cache directory. When I reinstalled virtualenv I used a flag plus sudo.
sudo pip install --no-cache-dir virtualenv
but new questions comes up.
How important is a cache directory for the environments?
Do I need one yes o no?
Thanks all for your awesome help.
Related
I currently configure Jenkins for my python/django application (i'm using python 3.5)
During the setup I open a Virtualenv and I activate it.
virtualenv -q wecover_platform .
./wecover_platform/bin/activate
Then i install all my requirements from my file requirement.txt
pip install -r $WORKSPACE/requirements.txt
I can't pass this step i always have a permission denied issue.
Installing collected packages: asn1crypto, pycparser, cffi, idna, cryptography, pyOpenSSL, olefile, pillow, reportlab, selenium, django-jenkins
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/dist-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python3.5/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python3.5/dist-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/usr/local/lib/python3.5/dist-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/asn1crypto'
Build step 'Execute shell' marked build as failure
Finished: FAILURE
If somebody could help me I would really appreciate it!
I got this when using pip install.
> pip install cognitive_face
Collecting cognitive_face
Using cached cognitive_face-1.2.5.tar.gz
Collecting requests (from cognitive_face)
Using cached requests-2.13.0-py2.py3-none-any.whl
Installing collected packages: requests, cognitive-face
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/requests'
I can find file "python3" and "python3.6" in my /usr/local/bin and folder "python3" in/usr/local/Cellar.
Also my emacs25 can't do run-python and showing:
Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native’ was t and "python3.6" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list. Native completions have been disabled locally.
OS Version: 10.12.3
It's a permission issue. Use sudo
sudo pip install cognitive_face
You need admin rights. Use sudo pip ….
I am trying to pip install pandas on a mac. I have python 3.6 installed.
When I pip install in the terminal I get the following error:
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/pandas'
Could you possibly edit the error into a formatted code block by highlighting it and pushing ctrl+k so it is easier to read? Thanks.
Edit: Also, I just looked through and at the bottom it says permission denied. Try rerunning the command as an admin. I.E try this command:
sudo pip install pandas
You might have already noticed, Mac come with a built in Python, python 2.7. If you read your traceback: /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py it's pointing to the 2.7 dir. this dir is in the Library folder so you don't have permission to install to it.
But you state that you have Python 3.6 installed as well, so if you wanted to install to that indtead. Do pip3 install pandas or python3 -m pip install pandas this help specify the python version. And if you want to run python 3.6 in terminal, type python3 instead of just python
I am trying to pip install virtualenv (and anything else) on OS X El Capitan and got the following error:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 646, in install
**kwargs
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 282, in clobber
ensure_dir(dest) # common for the 'include' path
File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 71, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 1] Operation not permitted: '/usr/lib/python2.7/site-packages'
Looks pip is trying to write in '/usr/lib/python2.7/site-packages' and due to SIP in El Capitan it got denied.
But I was wondering why does pip needs to write there? How can I fix this?
I ran brew doctor
which gives
Your system is ready to brew.
So I think it is OK.
I tried brew reinstall python and it gives an odd error:
==> Reinstalling python
Error: /usr/local/opt/python is not a valid keg
which python gives
/usr/local/bin/python
So where in system has this weird thing that let pip fail
Update:
It looks my pip is pointing to system python rather than brewed python.
I changed the first line of pip to
#!/usr/local/bin/python
and problem is solved
You may need to brew link python, or unlink then link to get things pointing to the correct places.
On my OSX 10.10.2, in a virtualenv, I tried to install Django via pip using the command:
pip install django
And this the responds I got:
Collecting django
Downloading Django-1.7.7-py2.py3-none-any.whl (7.4MB)
100% |################################| 7.4MB 58kB/s
Installing collected packages: django
Exception:
Traceback (most recent call last):
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/commands/install.py", line 347, in run
root=options.root_path,
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/req/req_set.py", line 549, in install
**kwargs
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/req/req_install.py", line 754, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/req/req_install.py", line 963, in move_wheel_files
isolated=self.isolated,
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/wheel.py", line 266, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/site-packages/pip/wheel.py", line 212, in clobber
shutil.copyfile(srcfile, destfile)
File "/Users/qmbp/.virtualenvs/demo/lib/python3.4/shutil.py", line 109, in copyfile
with open(dst, 'wb') as fdst:
PermissionError: [Errno 13] Permission denied: '/Users/qmbp/.virtualenvs/demo/bin/django-admin.py'
I guess the issue is caused as I did not prefix sudo to the command. But I read that it was a good idea to use sudo in OSX. And that is why virtualenv is encouraged as sudo is not needed inside it.Here is a screenshot of my files as I could not find the "env" in the bin folder.
Looks like you forgot to activate your venv.
Try:
source path_to_your_venv/bin/activate
pip install django