brew install python - fails OSX - python

Im trying to install python through brew with:
brew install python
But get the following error:
Stevens-MacBook-Pro :: ~ ‹master*› » brew install python
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/python-2.7.
Already downloaded: /Library/Caches/Homebrew/python-2.7.8_2.mountain_lion.bottle.tar.gz
==> Pouring python-2.7.8_2.mountain_lion.bottle.tar.gz
==> Caveats
Setuptools and Pip have been installed. To update them
pip install --upgrade setuptools
pip install --upgrade pip
You can install Python packages with
pip install <package>
They will install into the site-package directory
/usr/local/lib/python2.7/site-packages
See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python
.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
/usr/bin/install_name_tool: object: /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python malformed object (unknown load command 10)
Error: Failed to fix install names
The formula built, but you may encounter issues using it or linking other
formula against it.
==> /usr/local/Cellar/python/2.7.8_2/bin/python -ssetup.py --no-user-cfg instal
using one of the approaches described here:
Please make the appropriate changes for your system and try again.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python`
==> Summary
🍺 /usr/local/Cellar/python/2.7.8_2: 4626 files, 73M
The error messages says the post install fails, and to try installing it again with:
brew postinstall python
but the error still persists. I also tried brew linkapps and it success fully links python but when I run pip from the console I get this error:
Stevens-MacBook-Pro :: ~ ‹master*› » pip
zsh: /usr/local/bin/pip: bad interpreter: ##HOMEBREW_PREFIX##/opt/python/bin/python2.7: no such file or directory
Any idea what might be going wrong?

Pyenv is a python version management tool, something like rbenv but for python.
You could easily install and change python version via pyenv easily.
The following shows how to install python with version 2.7.8 through pyenv:
ubuntu#ubuntu:~$ pyenv install 2.7.8
Downloading Python-2.7.8.tgz...
-> http://yyuu.github.io/pythons/74d70b914da4487aa1d97222b29e9554d042f825f26cb2b93abd20fdda56b557
Installing Python-2.7.8...
Installing setuptools from https://bootstrap.pypa.io/ez_setup.py...
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Installed Python-2.7.8 to /home/ubuntu/.pyenv/versions/2.7.8
as you can see, its very simple.
The command pyenv install "version" help you to install a specific versions of python easily and even pip, setuptools are also automatically installed.
I suggest giving pyenv a try!!

Related

Unable to install sftp package in python on my virtual machine

I need to use sftp services through python on my virtual machine.
To note that I am unable to do commands like
pip install packagename
I have limitations on the controlled VM. So I have to download packages and point to local disk locations (pip install C:/Folder/packacgename.whl) to install them so please give me suggestions keeping this in mind.
Trying to install
pip install C:\Windows\pysftp-0.2.9.tar.gz
I needed bycrypt. And trying to install that it said No matching distribution found for setuptools>=40.8.0
I downloaded setuptools and did
pip install C:\Windows\setuptools-59.2.0.tar.gz
I get message
Missing build time requirements in pyproject.toml for file:///C:/Windows/setuptools-59.2.0.tar.gz: 'setuptools' and 'wheel'.
This version of pip does not implement PEP 517 so it cannot build a wheel without 'setuptools' and 'wheel'.
Installing build dependencies ... error
Complete output from command z:\scripts\python.exe -m pip install --ignore-installed --no-user --prefix C:\Users\AppData\Local\Temp\pip-build-env-jmi2p:
ERROR: You must give at least one requirement to install (see "pip help install")
I tried doing
C:\scripts\python.exe -m pip install --upgrade pip
This failed with message pip already up to date
I checked pip version
pip --version
pip 10.0.1 from z:\lib\site-packages\pip (python 3.7)
Manually trying to upgrade pip with tar file I get message setup tools need upgrade
pip install --upgrade C:\Windows\pip-21.3.1.tar.gz
I used --no-binary :all: , this didn’t work.
I have downloaded Microsoft 2015 build tools and installed them as advised by some forum. It didn’t work. I don't really know how to fix this issue. Trying to download PEP517 tar file and installing that does not work as it wants pip to be upgraded. It's like I am going in circles.
You can also use paramiko package for connecting your sftp via Python.
You just have to do
pip install paramiko
Hopefully it works for you.

Not able to install "pip"

So I am trying to download pip for gRPC as given on grpc.io website. And I read many questions related to that but I am still not able to download pip. I am using mac with python (version 2.7.10).
when I write pip on console. It gives below error :-
bash: pip: command not found
I checked few questions and they were recommending easy_install pip but didn't work either.
One of my colleague recommended to use brew install pip as we have installed almost everything using brew.Got below error when I did that.
Error: No available formula with the name "pip"
Homebrew provides pip via:brew install python. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:
https://pip.readthedocs.io/en/stable/installing/
I went on this link and it says to run curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py and after that, run this python get-pip.py.
I did this but it gives below thing :
Collecting pip
Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 18.1
Uninstalling pip-18.1:
Successfully uninstalled pip-18.1
Rolling back uninstall of pip
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
Consider using the `--user` option or check the permissions.
Could you all suggest a way to download and use pip?
UPDATE
Earlier I was trying to install using sudo easy_install pip, it was giving an error. Now I tried doing it, it got installed. Thanks all for the help.
follow the following steps:
go to pypi website pip offcial account .
Download the source file. pip-18.1.tar.gz
Extract the file.
in command prompt run command :
python setup.py install
pip is installed now.

Archlinux pip and setuptools not upgraded

Terminal command :
python -V output: Python 3.5.2
I'm trying pip and setuptools update on pycharm but this error occurred :
Error :python packaging tool 'pip' not found.
Proposed solution:
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/usr/bin/python3.5'.
Terminal command :
which pip output: usr/bin/pip
And I'm trying on terminal command :
pacman -S(or -Syu,-Syy) python-pip or pacman -S(-Syu,-Syy) python-setuptools
resolving dependencies...
looking for conflicting packages...
Packages (5) python-packaging-16.7-1 python-pyparsing-2.1.5-1
python-setuptools-1:24.0.2-1 python-six-1.10.0-2
python-pip-8.1.2-1
Total Installed Size: 8.03 MiB
:: Proceed with installation? [Y/n] y
(5/5) checking keys in keyring [######################] 100%
(5/5) checking package integrity [######################] 100%
(5/5) loading package files [######################] 100%
(5/5) checking for file conflicts [######################] 100%
error:failed to commit transaction (conflicting files)
python-setuptools: /usr/bin/easy_install exists in filesystem
python-setuptools: /usr/bin/easy_install-3.5 exists in filesystem
python-pip: /usr/bin/pip exists in filesystem
python-pip: /usr/bin/pip3 exists in filesystem
python-pip: /usr/bin/pip3.5 exists in filesystem
Errors occured, no packages were upgraded.
So I'm trying :
python -m pip install -U pip
Output :
/usr/bin/python: No module named pip
How to update pip ?
This should work:
pacman -S --force python-pip and pacman -S --force python-setuptools
It's not recommended to install python packages along with pacman. because pacman doesn't recognize any package installed by pip. I think you should remove all pip packages instelled using pip and reinstall all python packages using pacman or virtualenv. if you need python packages for arch you can search through AUR or you can install any python packages in a virtual environment.
If you want the most up-to-date version from pypi and not from repository, then do something like
pip install -U pip

No module named google.protobuf

I am trying to run Google's deep dream. For some odd reason I keep getting
ImportError: No module named google.protobuf
after trying to import protobuf. I have installed protobuf using sudo install protobuf. I am running python 2.7 OSX Yosemite 10.10.3.
I think it may be a deployment location issue but i cant find anything on the web about it. Currently deploying to /usr/local/lib/python2.7/site-packages.
There is another possibility, if you are running a python 2.7.11 or other similar versions,
sudo pip install protobuf
is ok.
But if you are in a anaconda environment, you should use
conda install protobuf
Locating the google directory in the site-packages directory (for the proper latter directory, of course) and manually creating an (empty) __init__.py resolved this issue for me.
(Note that within this directory is the protobuf directory but my installation of Python 2.7 did not accept the new-style packages so the __init__.py was required, even if empty, to identify the folder as a package folder.)
...In case this helps anyone in the future.
In my case I
downloaded the source code, compiled and installed:
$ ./configure
$ make
$ make check
$ sudo make install`
for python I located its folder(python) under source code, and ran commands:
$ python setup.py build
$ python setup.py install'
Not sure if this could help you..
I got the same error message when I tried to use Tensor Flow. The solution was simply to uninstall Tensor Flow and protobuf:
$ sudo pip uninstall protobuf
$ sudo pip uninstall tensorflow
And reinstall it again: pip installation of Tensorflow. Currently, this is:
# Ubuntu/Linux 64-bit, CPU only:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl
# Ubuntu/Linux 64-bit, GPU enabled:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl
# Mac OS X, CPU only:
$ sudo easy_install --upgrade six
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0rc0-py2-none-any.whl
when I command pip install protobuf, I get the error:
Cannot uninstall 'six'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
If you have the same problem as me, you should do the following commands.
pip install --ignore-installed six
sudo pip install protobuf
According to your comments, you have multiply versions of python
what could happend is that you install the package with pip of anthor python
pip is actually link to script that donwload and install your package.
two possible solutions:
go to $(PYTHONPATH)/Scripts and run pip from that folder that way you insure
you use the correct pip
create alias to pip which points to $(PYTHONPATH)/Scripts/pip and then run pip install
how will you know it worked?
Simple if the new pip is used the package will be install successfully, otherwise the package is already installed
I installed the protobuf with this command:
conda install -c anaconda protobuf=2.6.1
(you should check the version of protobuf)
In my case, MacOS has the permission control.
sudo -H pip3 install protobuf
I had this problem to when I had a google.py file in my project files.
It is quite easy to reproduce.
main.py: import tensorflow as tf
google.py: print("Protobuf error due to google.py")
Not sure if this is a bug and where to report it.

Installing pip for an offline machine on Python 2.7, CentOS 6.3

I'm trying to install lxml for Centos6.3, due to this issue. It looks like I've got a conflicting version of pip. The standing solution seems to re-install pip for the correct version of python.
My main issue is that all the methods I've found for installing pip require an internet connection. Is it possible to download pip install files, and then run pip install -U pip and point it at the right files?
The PyPI page for pip only has pip6.11 as a .whl. I've tried running pip install -U pip-6.1.1-py2.py3-none-any.whl and it's not worked.
I'm stumped. How do I install it?
You could try to download pip and setuptools manually from: https://pypi.org/project/pip/#files and https://pypi.org/project/setuptools/#files
get the python pip script from: https://bootstrap.pypa.io/get-pip.py
after that unzip/untar packages and run:
python get-pip.py --no-index --find-links=/path/to/pip-and-setuptools
or alternatively trying:
python setup.py install when running in unpacked folders
More here: https://github.com/pypa/pip/issues/2351

Categories