brew or pip - install credstash - errors - No named formulae found in taps / OSErr six-1.4.1-py2.7.egg-info operation not permitted - macos

Getting the following error on my Mac Terminal window.
$ pip --version
pip 6.1.1 from /Library/Python/2.7/site-packages (python 2.7)
Python version is 2.7.10
While trying to install credstash using brew, I'm getting the following error.
$ `which python` --version && brew update && brew install credstash
Python 2.7.10
Already up-to-date.
Error: No available formula with the name "credstash"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
Error: No formulae found in taps.
Got the similar error, when I tried to install pip3 using brew.
Tried installing credstash from pip but that errored out as well.
[arun#MacBook-Pro-2 ~/aks/wspace] $ pip install credstash
You are using pip version 6.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting credstash
Using cached credstash-1.12.0.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.6.1 in /Library/Python/2.7/site-packages (from credstash)
Collecting boto3>=1.1.1 (from credstash)
Using cached boto3-1.4.2-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): jmespath<1.0.0,>=0.7.1 in /Library/Python/2.7/site-packages (from boto3>=1.1.1->credstash)
Collecting botocore<1.5.0,>=1.4.1 (from boto3>=1.1.1->credstash)
Using cached botocore-1.4.87-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.0 (from boto3>=1.1.1->credstash)
Using cached s3transfer-0.1.10-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached docutils-0.13.1-py2-none-any.whl
Collecting futures<4.0.0,>=2.2.0 (from s3transfer<0.2.0,>=0.1.0->boto3>=1.1.1->credstash)
Using cached futures-3.0.5-py2-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: six, python-dateutil, docutils, botocore, futures, s3transfer, boto3, credstash
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/basecommand.py", line 246, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 352, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 687, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 730, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 126, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 292, 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/z5/37m4q63j3bn48y3dxgf40tdm0000gn/T/pip-LMRqSS-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
IF I don't use sudo in the above command, then I get the following exception error:
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/concurrent'
To get latest pip, as pip is provided via python on macOS, if I try to install python using brew, I'm getting the following, poking into it how I can remove Xcode first:
$ brew install python
Error: Your Xcode (5.0.2) is too outdated.
Please update to Xcode 8.2 (or delete it).
Xcode can be updated from the App Store.
$ pip --version
pip 6.1.1 from /Library/Python/2.7/site-packages (python 2.7)
As I thought I have an older pip version, I download this file:
$ wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py
Which successfully installed a newer version of pip. Now showing:
$ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
Retried doing pip install credstash but still getting the same error (with or without sudo).

I tried the following to get credstash installed.
Downloaded Python3 Mac binary from here.
https://www.python.org/ftp/python/3.5.2/python-3.5.2-macosx10.6.pkg
Installed the .pkg file GUI way.
Opened a Terminal window in Mac.
[arun#MacBook-Pro-2 /tmp] $ which pip
/usr/local/bin/pip
[arun#MacBook-Pro-2 /tmp] $ pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
[arun#MacBook-Pro-2 /tmp] $ which python
/usr/bin/python
[arun#MacBook-Pro-2 /tmp] $ python --version
Python 2.7.10
[arun#MacBook-Pro-2 /tmp] $ which python3
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
[arun#MacBook-Pro-2 /tmp] $ python3 --version
Python 3.5.2
[arun#MacBook-Pro-2 /tmp] $ which pip3
/Library/Frameworks/Python.framework/Versions/3.5/bin/pip3
[arun#MacBook-Pro-2 /tmp] $ pip3 --version
pip 8.1.1 from /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages (python 3.5)
[arun#MacBook-Pro-2 /tmp] $
[arun#MacBook-Pro-2 /tmp] $ pip3 install credstash
Collecting credstash
Using cached credstash-1.12.0.tar.gz
Collecting pycrypto>=2.6.1 (from credstash)
Using cached pycrypto-2.6.1.tar.gz
Collecting boto3>=1.1.1 (from credstash)
Using cached boto3-1.4.2-py2.py3-none-any.whl
Collecting s3transfer<0.2.0,>=0.1.0 (from boto3>=1.1.1->credstash)
Using cached s3transfer-0.1.10-py2.py3-none-any.whl
Collecting botocore<1.5.0,>=1.4.1 (from boto3>=1.1.1->credstash)
Using cached botocore-1.4.87-py2.py3-none-any.whl
Collecting jmespath<1.0.0,>=0.7.1 (from boto3>=1.1.1->credstash)
Using cached jmespath-0.9.0-py2.py3-none-any.whl
Collecting docutils>=0.10 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Downloading docutils-0.13.1-py3-none-any.whl (536kB)
100% |████████████████████████████████| 542kB 1.3MB/s
Collecting python-dateutil<3.0.0,>=2.1 (from botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached python_dateutil-2.6.0-py2.py3-none-any.whl
Collecting six>=1.5 (from python-dateutil<3.0.0,>=2.1->botocore<1.5.0,>=1.4.1->boto3>=1.1.1->credstash)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: pycrypto, docutils, six, python-dateutil, jmespath, botocore, s3transfer, boto3, credstash
Running setup.py install for pycrypto ... done
Running setup.py install for credstash ... done
Successfully installed boto3-1.4.2 botocore-1.4.87 credstash-1.12.0 docutils-0.13.1 jmespath-0.9.0 pycrypto-2.6.1 python-dateutil-2.6.0 s3transfer-0.1.10 six-1.10.0
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[arun#MacBook-Pro-2 /tmp] $
[arun#MacBook-Pro-2 /tmp] $ which credstash
/Library/Frameworks/Python.framework/Versions/3.5/bin/credstash
[arun#MacBook-Pro-2 /tmp] $

If you're trying to install to system Python then you need sudo. If you want to just play around, look into creating a virtualenv and install there. http://docs.python-guide.org/en/latest/dev/virtualenvs/

Related

SyntaxError when pip install pip ( def read(rel_path: str))

when using pip I get the following warning:
$ pip install pip
Requirement already satisfied (use --upgrade to upgrade): pip in /usr/lib/python2.7/site-packages
You are using pip version 8.1.2, however version 22.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
So I follow the suggestion, but I get a SyntaxError:
$ pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/99/bb/696e256f4f445809f25efd4e4ce42ff99664dc089cafa1e097d5fec7fc33/pip-22.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-k03IN1/pip/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-k03IN1/pip/
You are using pip version 8.1.2, however version 22.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
My default pip is not the one I want to be:
$ ~/anaconda3/bin/pip --version
pip 22.1 from /home/mdi0316/.local/lib/python3.8/site-packages/pip (python 3.8)
$ ~/anaconda3/bin/pip3 --version
pip 22.1 from /home/mdi0316/.local/lib/python3.8/site-packages/pip (python 3.8)
$ which pip
/usr/bin/pip
$ pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
$ echo $PATH
/home/mdi0316/bin:/home/mdi0316/anaconda3/envs/nagare_env/bin:/home/mdi0316/anaconda3/condabin:/home/mdi0316/anaconda3/envs/nagare_env/bin:/cm/shared/apps/TURBOMOLE/bin/em64t-unknown-linux-gnu_smp:/cm/shared/apps/TURBOMOLE/scripts:/cm/local/apps/cuda/libs/current/bin:/cm/shared/apps/cuda11.1/sdk/11.1.1/bin/x86_64/linux/release:/cm/shared/apps/cuda11.1/toolkit/11.1.1/bin:/cm/shared/apps/python3.8.7/bin:/cm/shared/apps/openmpi/gcc/64/4.0.5/bin:/cm/local/apps/gcc/8.2.0/bin:/cm/shared/apps/slurm/18.08.9/sbin:/cm/shared/apps/slurm/18.08.9/bin:/cm/local/apps/environment-modules/4.2.1/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin:/sbin:/usr/sbin:/cm/local/apps/environment-modules/4.2.1/bin
I am within a personally created anaconda environment (nagare_env).
Yet, the default pip in in ~/usr
I also tried to install pip through pip3, but I could solve this neither way.
$ pip3 install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.8/site-packages (22.1)
$ pip3 install --upgrade --trusted-host pypi.org --trusted-host files.pythonhosted.org pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.8/site-packages (22.1)
any hint?
Thanks
Marco
I faced the same issue on my centos. Guess my pip file was corrupted. I installed it again and was working fine.
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
pip install --upgrade setuptools
"pip 21.0, in January 2021, removed Python 2 support, per pip’s Python 2 support policy.
you should change your pip version
from: https://pypi.org/project/pip/

Pytorch installation issue under Anaconda

I followed the link here to install fastai library using pip install git+https://github.com/fastai/fastai.git
It gave me the following error message. These messages keep the same even I installed Pytorch successfully using conda install pytorch-cpu -c pytorch
and pip3 install torchvision. What can be the reason?
Collecting torch<0.4 (from fastai==0.7.0)
Using cached https://files.pythonhosted.org/packages/5f/e9/bac4204fe9cb1a002ec6140b47f51affda1655379fe302a1caef421f9846/torch-0.1.2.post1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\shuxi\AppData\Local\Temp\pip-install-7sjptuad\torch\setup.py", line 11, in <module>
raise RuntimeError(README)
RuntimeError: PyTorch does not currently provide packages for PyPI (see status at https://github.com/pytorch/pytorch/issues/566).
Please follow the instructions at http://pytorch.org/ to install with miniconda instead.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\shuxi\AppData\Local\Temp\pip-install-7sjptuad\torch\
To fix this, do:
$ pip install --upgrade git+https://github.com/fastai/fastai.git
OR
$ pip install --no-cache-dir git+https://github.com/fastai/fastai.git
Your command probably failed because you have installed a old version of torch (0.1.2) some time ago. pip was not supported for torch install for that version and pip instead redirected the user to open pytorch.org in the browser. In your case, pip is reusing this cached package. --upgrade forces pip to choose latest version of all depending packages.

How to install Ansible 2.4.x with Brew on MacOS Sierra

brew install ansible installs the current version of Ansible (2.5.x as of this writing). I have an application that requires version 2.4, and does not work with earlier or later versions. brew search ansible results in the following:
==> Searching local taps...
ansible ✔ ansible-lint ansible#2.0
ansible-cmdb ansible#1.9 terraform-provisioner-ansible
==> Searching taps on GitHub...
homebrew/cask/ansible-dk
==> Searching blacklisted, migrated and deleted formulae...
Installing ansible#2.0 gives me version 2.3.
How do you install version 2.4?
Attempting to install with easy_install + pip results in this which is reportedly caused by a TLS bug with MacOS Sierra 10.12.
➜ ~ sudo easy_install pip
Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')
This is the way I have in my Mac:
First install python with brew: brew install python. This will install python 3.6.5:
==> Downloading https://homebrew.bintray.com/bottles/python-3.6.5.high_sierra.bottle.1.tar.gz
Already downloaded: /Users/imjoseangel/Library/Caches/Homebrew/python-3.6.5.high_sierra.bottle.1.tar.gz
==> Pouring python-3.6.5.high_sierra.bottle.1.tar.gz
==> /usr/local/Cellar/python/3.6.5/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/
==> /usr/local/Cellar/python/3.6.5/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/
==> /usr/local/Cellar/python/3.6.5/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/
==> Caveats
Python has been installed as
/usr/local/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin
If you need Homebrew's Python 2.7 run
brew install python#2
Pip, setuptools, and wheel have been installed. To update them run
pip3 install --upgrade pip setuptools wheel
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.6/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺 /usr/local/Cellar/python/3.6.5: 4,736 files, 99.2MB
From there, install virtualenv with pip3 install virtualenv:
Collecting virtualenv
Using cached https://files.pythonhosted.org/packages/b6/30/96a02b2287098b23b875bc8c2f58071c35d2efe84f747b64d523721dc2b5/virtualenv-16.0.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
Found existing installation: virtualenv 16.0.0
Uninstalling virtualenv-16.0.0:
Successfully uninstalled virtualenv-16.0.0
Successfully installed virtualenv-16.0.0
Create your environment with virtualenv ansible24
Using base prefix '/usr/local/Cellar/python/3.6.5/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/imjoseangel/Source/ansible24/bin/python3.6
Also creating executable in /Users/imjoseangel/Source/ansible24/bin/python
Installing setuptools, pip, wheel...done.
Activate your environment - source ansible24/bin/activate
And Install Ansible 2.4 - pip install ansible==2.4.0
Collecting ansible==2.4.0
Downloading https://files.pythonhosted.org/packages/1e/7c/385ccbeb0fbefc13eaef53df76e42ef778170bdfe5fd425879735b43106e/ansible-2.4.0.0.tar.gz (6.6MB)
100% |████████████████████████████████| 6.6MB 4.3MB/s
Collecting jinja2 (from ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/7f/ff/ae64bacdfc95f27a016a7bed8e8686763ba4d277a78ca76f32659220a731/Jinja2-2.10-py2.py3-none-any.whl
Collecting PyYAML (from ansible==2.4.0)
Collecting paramiko (from ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/3e/db/cb7b6656e0e7387637ce850689084dc0b94b44df31cc52e5fc5c2c4fd2c1/paramiko-2.4.1-py2.py3-none-any.whl
Collecting cryptography (from ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/40/87/acdcf84ce6d25a7db1c113f4b9b614fd8d707b7ab56fbf17cf18cd26a627/cryptography-2.2.2-cp34-abi3-macosx_10_6_intel.whl
Requirement already satisfied: setuptools in ./ansible24/lib/python3.6/site-packages (from ansible==2.4.0) (39.2.0)
Collecting MarkupSafe>=0.23 (from jinja2->ansible==2.4.0)
Collecting pyasn1>=0.1.7 (from paramiko->ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/a0/70/2c27740f08e477499ce19eefe05dbcae6f19fdc49e9e82ce4768be0643b9/pyasn1-0.4.3-py2.py3-none-any.whl
Collecting bcrypt>=3.1.3 (from paramiko->ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/7e/59/d48fd712941da1a5d6490964a37bb3de2e526965b6766273f6a7049ee590/bcrypt-3.1.4-cp36-cp36m-macosx_10_6_intel.whl
Collecting pynacl>=1.0.1 (from paramiko->ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/74/8e/a6c0d340972d9e2f1a405aaa3f2460950b4c0337f92db0291a4355974529/PyNaCl-1.2.1-cp36-cp36m-macosx_10_6_intel.whl
Collecting cffi>=1.7; platform_python_implementation != "PyPy" (from cryptography->ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/8e/be/40b1bc2c3221acdefeb9dab6773d43cda7543ed0d8c8df8768f05af2d01e/cffi-1.11.5-cp36-cp36m-macosx_10_6_intel.whl
Collecting asn1crypto>=0.21.0 (from cryptography->ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/ea/cd/35485615f45f30a510576f1a56d1e0a7ad7bd8ab5ed7cdc600ef7cd06222/asn1crypto-0.24.0-py2.py3-none-any.whl
Collecting idna>=2.1 (from cryptography->ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl
Collecting six>=1.4.1 (from cryptography->ansible==2.4.0)
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography->ansible==2.4.0)
Building wheels for collected packages: ansible
Running setup.py bdist_wheel for ansible ... done
Stored in directory: /Users/imjoseangel/Library/Caches/pip/wheels/ea/e1/f4/f5654529457978b69c0369212794664b88b51c95fa267346ea
Successfully built ansible
Installing collected packages: MarkupSafe, jinja2, PyYAML, pyasn1, pycparser, cffi, asn1crypto, idna, six, cryptography, bcrypt, pynacl, paramiko, ansible
Successfully installed MarkupSafe-1.0 PyYAML-3.12 ansible-2.4.0.0 asn1crypto-0.24.0 bcrypt-3.1.4 cffi-1.11.5 cryptography-2.2.2 idna-2.6 jinja2-2.10 paramiko-2.4.1 pyasn1-0.4.3 pycparser-2.18 pynacl-1.2.1 six-1.11.0

How can I install Ansible on Raspbian?

I would like to install Ansible on my Raspberry Pi (raspbian/jessie) so that I can maintain it. Unfortunately, I don't seem to be able to install it. I've tried APT and PIP so far but each has a hurdle.
APT
pi#retropie:~ $ sudo apt-add-repository ppa:ansible/ansible
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 167, in <module>
sp = SoftwareProperties(options=options)
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 105, in __init__
self.reload_sourceslist()
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 595, in reload_sourceslist
self.distro.get_sources(self.sourceslist)
File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 89, in get_sources
(self.id, self.codename))
aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/jessie
PIP (Python 2.7.9, pip 1.5.6)
pi#retropie:~ $ sudo pip install ansible
Downloading/unpacking ansible
Downloading ansible-2.4.1.0.tar.gz (6.7MB): 6.7MB downloaded
no previously-included directories found matching 'ticket_stubs'
no previously-included directories found matching 'hacking'
Downloading/unpacking jinja2 (from ansible)
Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB): 340kB downloaded
Downloading/unpacking PyYAML (from ansible)
Downloading PyYAML-3.12.tar.gz (253kB): 253kB downloaded
Running setup.py (path:/tmp/pip-build-bsUTB2/PyYAML/setup.py) egg_info for package PyYAML
Downloading/unpacking paramiko (from ansible)
Downloading paramiko-2.3.1-py2.py3-none-any.whl (182kB): 182kB downloaded
Downloading/unpacking cryptography (from ansible)
Downloading cryptography-2.1.2.tar.gz (441kB): 441kB downloaded
Running setup.py (path:/tmp/pip-build-bsUTB2/cryptography/setup.py) egg_info for package cryptography
error in cryptography setup command: Invalid environment marker: python_version < '3'
Complete output from command python setup.py egg_info:
error in cryptography setup command: Invalid environment marker: python_version < '3'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build-bsUTB2/cryptography
Storing debug log for failure in /root/.pip/pip.log
Python 3
As you can see from the above error, "cryptography" indicates it needs > python3
I looked at the installation requirements and found that you need python 3.5+ if you use 3. Rasbian comes with 3.4...
I then tried to get python 3.6 installed using a couple of ppa's (ppa:jonathonf/python-3.6 and ppa:deadsnakes/ppa) but there aren't distros available for raspbian/jessie either.
After that I started looking at pulling down and compiling python from source but I'm expecting I'll hit another hurdle.
Ugh...
In summary, does anyone have any ideas how I can get Ansible installed on a Raspberry Pi?
Slightly old question but its the first result that comes up when googling for how to install Ansible on Raspbian so thought I'd update it. If you're running stretch (or stretch-lite)
You can just do
sudo apt-get install ansible
However currently the version of Ansbile in the Raspbian repositories is 2.2 which is a little old
Following instructions (with a little modification to overcome some errors) from the Ansible installation page you can do the following:
First run
sudo apt-get install dirmngr
Edit your /etc/apt/sources.list and append
deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main
then run
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
sudo apt-get update
sudo apt-get install ansible
This will give you version 2.7.8 as of today.
Edited to include missing command (thanks SpacePope) and correct formatting.
Jessie was released in 2015 and is officially obsolete. Stretch is the current Raspbian repo, and it has python3.5 without adding PPAs.
You can then simply install Ansible with pip3.

OSX El Capitan: sudo pip install OSError: [Errno: 1] Operation not permitted

When I run:
sudo pip install ipython
I get the following error
OSError: [Errno: 1] Operation not permitted: '/System/Library/Frameworks/Python.framework/Versions/2.7/share'
The last command executed tries to create the directory given above.
Also, the following command fails to install iPython without providing any errors.
sudo pip install --user python
(I am on Mac OS X El Capitan in case other folks on this OS see the same issue.)
Instructions telling people to use sudo pip install are inherently wrong.
If there is any tutorial out there which says you should use sudo pip then please file a bug against this package. The author is dis-educating the Python community, as time has proven sudo pip to be a broken practice.
OSX El Capitan introduced mechanisms to prevent damaging the operating system files. /System/Library/Frameworks/Python.framework/Versions/2.7/share is one of the protected locations. A normal user has no reason to put or write any files there. This is because the operating system itself relies on these files and sudo pip, with all force given from the above, would unconditionally overwrite them. Usually bad things would not happen, but the chances are there. Apple wants to protect their OS users from accidentally bricking their installation.
Instead, you need to install a Python package, like IPython, locally to the home folder of your user. The easiest way is to create a virtual environment, activate it, and then run pip in the virtual environment.
Example:
cd ~ # Go to home directory
virtualenv my-venv
source my-venv/bin/activate
pip install IPython
More info
Official Python package installation tutorial.
How to create virtual environments.
Alternatively, one should be able to use pip install --user. But again, sudo is not needed and you need to manually set up PATH environment variable.
I had the same problems, but using the easy_install "module" solved the problem for me.
I am not sure why, but pip and easy_install use different install locations, and easy_install chose the right ones.
Edit: without re-checking but because of the comments; it seems that different (OSX and brew-installed) installations interfere with each other which is why the tools mentioned point to different locations (since they belong to different installations). I understand that usually those tools from one install point to the same folder.
You should reinstall Python:
brew reinstall python
To get brew see the brew homepage.
pip install --ignore-installed six
This will do the job, then you can try your first command.
Via http://github.com/pypa/pip/issues/3165
Used pip3 install <package> instead and solved the permission problem with pip.
TL;DR $PATH fix
Use pip install --user package_name to install a package that should include CLI executables.
Launch a python shell and import package_name
Find where lib/python/... occurs in the output and replace it all with bin
It's likely to be $HOME/Library/Python/2.7/bin
Details
Because of the new System Integrity Protection in macOS 10.11 El Capitan, you can no longer sudo pip install. We won't debate the merits of that here.
Another answer explains that you should pip install --user which is correct. But they sent you to the back alleys to figure out what to do about your $PATH so that you could get access to installed executables. Luckily, I've already solved a similar need for an unrelated question.
Here is a transcript of how I solved the problem on one of my systems. I'm including it all rather just than the $PATH that worked for me, because your system may be different from mine. This process should work for everybody.
$ pip install --user jp
Collecting jp
Downloading jp-0.2.4.tar.gz
Installing collected packages: jp
Running setup.py install for jp ... done
Successfully installed jp-0.2.4
$ python -c 'import jp; print jp'
<module 'jp' from '/Users/bbronosky/Library/Python/2.7/lib/python/site-packages/jp/__init__.pyc'>
$ find /Users/bbronosky/Library/Python -type f -perm -100
/Users/bbronosky/Library/Python/2.7/bin/jp
$ which jp
$ echo -e '\n''export PATH=$HOME/Library/Python/2.7/bin:$PATH' >> ~/.bashrc
$ bash # starting a new bash process for demo, but you should open a new terminal
$ which jp
/Users/bbronosky/Library/Python/2.7/bin/jp
$ jp
usage: jp <expression> <filepath>
Same error
Installing collected packages: six, pyparsing, packaging, appdirs, setuptools
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 323, in clobber
shutil.copyfile(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/six.py'
and here I use --user without sudo to solve this issue
$ pip install --user scikit-image h5py keras pygame
Collecting scikit-image
Downloading http://mirrors.aliyun.com/pypi/packages/65/69/27a1d55ce8f77c8ac757938707105b1070ff4f2ae47d2dc99461bfae4491/scikit_image-0.13.0-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 (28.1MB)
100% |████████████████████████████████| 28.1MB 380kB/s
Collecting h5py
Downloading http://mirrors.aliyun.com/pypi/packages/b7/cc/1c29b0815b12de2c92b5323cad60f724ac8f0e39d0166d0b9dfacbcb70dd/h5py-2.7.0-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 (4.5MB)
100% |████████████████████████████████| 4.5MB 503kB/s
Requirement already satisfied: keras in /Library/Python/2.7/site-packages
Requirement already satisfied: pygame in /Library/Python/2.7/site-packages
Requirement already satisfied: matplotlib>=1.3.1 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from scikit-image)
Requirement already satisfied: six>=1.7.3 in /Library/Python/2.7/site-packages (from scikit-image)
Requirement already satisfied: pillow>=2.1.0 in /Library/Python/2.7/site-packages (from scikit-image)
Requirement already satisfied: networkx>=1.8 in /Library/Python/2.7/site-packages (from scikit-image)
Requirement already satisfied: PyWavelets>=0.4.0 in /Library/Python/2.7/site-packages (from scikit-image)
Collecting scipy>=0.17.0 (from scikit-image)
Downloading http://mirrors.aliyun.com/pypi/packages/72/eb/d398b9f63ee936575edc62520477d6c2353ed013bacd656bd0c8bc1d0fa7/scipy-0.19.0-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 (16.2MB)
100% |████████████████████████████████| 16.2MB 990kB/s
Requirement already satisfied: numpy>=1.7 in /Library/Python/2.7/site-packages (from h5py)
Requirement already satisfied: theano in /Library/Python/2.7/site-packages (from keras)
Requirement already satisfied: pyyaml in /Library/Python/2.7/site-packages (from keras)
Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: tornado in /Library/Python/2.7/site-packages (from matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: pyparsing>=1.5.6 in /Users/qiuwei/Library/Python/2.7/lib/python/site-packages (from matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: nose in /Library/Python/2.7/site-packages (from matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: olefile in /Library/Python/2.7/site-packages (from pillow>=2.1.0->scikit-image)
Requirement already satisfied: decorator>=3.4.0 in /Library/Python/2.7/site-packages (from networkx>=1.8->scikit-image)
Requirement already satisfied: singledispatch in /Library/Python/2.7/site-packages (from tornado->matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: certifi in /Library/Python/2.7/site-packages (from tornado->matplotlib>=1.3.1->scikit-image)
Requirement already satisfied: backports_abc>=0.4 in /Library/Python/2.7/site-packages (from tornado->matplotlib>=1.3.1->scikit-image)
Installing collected packages: scipy, scikit-image, h5py
Successfully installed h5py-2.7.0 scikit-image-0.13.0 scipy-0.19.0
Hope it will help someone who encounter similar issue!
I had the same issues.
As others have mentioned, don't run pip install with sudo.
Run
brew doctor
and fix the warnings and you should be able to proceed with your pip install.
It is hard to get pip working on El Capitan for several reasons:
OS X doesn't set some distutils variables correctly, so pip tries to install ancillary files in locations under /System/Library/. El Capitan blocks this, which is the error you are running into.
OS X includes a number of outdated packages under /System/Library/. pip often wants to upgrade these but cannot on El Capitan.
OS X places /System/Library/ higher in the python search order than /Library/Python/2.7/site-packages (the system-wide python package location), so even if you manage to install newer versions of some packages, the old ones still get loaded, breaking some dependencies.
There are workarounds for all of these at https://apple.stackexchange.com/a/223163/143849 . But you may be best off installing your own version of Python via the standard Python installer, Homebrew or Anaconda.
I guess you have some conflict with other package. For me it was six. So you need to use a command like this:
pip install google-api-python-client --upgrade --ignore-installed six
or
pip install --ignore-installed six
I fully agree with Mikko, but if you still want to do it, here is the way:
Restart in recovery mode (Hold cmd + R)
Open terminal from utilities
Use the command csrutil disable
I have python2.7 installed via brew and the following solved my problem
brew install numpy
It installs python3, but it still works and sets it up for 2.7 as well.

Resources