I want to install TensorFlow following these instructions: https://web.archive.org/web/20170627102751/https://www.tensorflow.org/versions/r0.12/get_started/os_setup#pip_installation
But when I try this code on terminal, it returns an error.
$ sudo pip3 install --upgrade $TF_BINARY_URL
sudo: pip3: command not found
So I installed Homebrew and tried to uninstall and reinstall python3-pip, but didn't work.
MakotonoMacBook-ea:~ makotomiyazaki$ brew uninstall python3-pip
Error: No such keg: /usr/local/Cellar/python3-pip
MakotonoMacBook-ea:~ makotomiyazaki$ brew install python3-pip
Error: No available formula with the name "python3-pip"
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
What should I do for getting pip3?
My OS is macOS High Sierra, and I have Python 3.6.2 already installed.
EDIT: I tried
python3 -m pip
and what's returned was this:
The directory '/Users/makotomiyazaki/Library/Caches/pip/http' or its
parent directory is not owned by the current user and the cache has
been disabled. Please check the permissions and owner of that
directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/makotomiyazaki/Library/Caches/pip' or its parent
directory is not owned by the current user and caching wheels has been
disabled. check the permissions and owner of that directory. If
executing pip with sudo, you may want sudo's -H flag.
You must give at least one requirement to install (see "pip help
install")
I also tried which pip3, but just I don't know if it worked...
MakotonoMacBook-ea:~ makotomiyazaki$ sudo which pip3 install --upgrade $TF_BINARY_URL
/usr/bin/install
You would need to install pip3.
On Linux, run first sudo apt update. Then the command would be: sudo apt install python3-pip
On Mac, using brew, first brew install python3
Then brew postinstall python3
Try calling pip3 -V to see if it worked.
I had this issue and I fixed it using the following steps
You need to completely uninstall python3-pip using:
sudo apt-get --purge autoremove python3-pip
Then resintall the package with:
sudo apt install python3-pip
To confirm that everything works, run:
pip3 -V
After this you can now use pip3 to manage any python package of your interest. Eg
pip3 install NumPy
Writing the whole path/directory eg. (for windows) C:\Programs\Python\Python36-32\Scripts\pip3.exe install mypackage. This worked well for me when I had trouble with pip.
its possible if you already have a python installed (pip) you could do a upgrade on mac by
brew upgrade python
Try this if other methods do not work:
brew install python3
brew link --overwrite python
brew postinstall python3
In my case, although python3-pip was already installed, it didn't recognize pip3. After reinstalling with
sudo yum reinstall python3-pip
it worked fine and recognized pip3 commands.
After yum install python3-pip, check the name of the installed binary. e.g.
ll /usr/bin/pip*
On my CentOS 7, it is named as pip-3 instead of pip3.
I have installed mesa via:
$ pip install mesa
but it is automatically installing it into
/Users/MyName/Documents/User/lib/python2.7/site-packages/mesa/~
which means that when I try to run it with a Python 3 kernel, it can't find the module and I receive the error
ModuleNotFoundError: No module named 'mesa'
Could someone help me out? I'm assuming the problem is that it is automatically installed into the python 2.7 directory - how can i change this?
Thanks
To install packages for Python3 while exists Python2,
try this
python3 -m pip install xxx
or this
sudo apt install pip3
pip3 install xxx
You should use pip3 instead of pip:
pip3 install mesa
If you don't have pip3 install it using:
sudo apt-get update
sudo apt-get -y install python3-pip
If it doesn't work you can do it manually using curl:
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
python get-pip.py
You can also execute it straight from python3:
python3 -m pip install mesa
It is always a good practice to set pip command to be equivalent to your python command. i.e, if python points to python3, you better change pip to point to pip3. Add alias pip='pip3' to your ~/.bash_profile file.
SOLUTION My user did not own permissions to the pip directory, I reinstalled Python 3.5 using the sudo -H flag
I'm trying to install Tensorflow for python 3.5 using pip3 -- for reasons described in this github issue -- but when I install using sudo pip3 install *.whl it installs to python 3.4.
How can I redirect pip3 to install into my python 3.5 directory?
I'm running on Ubuntu 14.04
kendall#kendall-Macmini:~/Downloads$ python3.4 -m pip --version
pip 8.1.2 from /usr/local/lib/python3.4/dist-packages/pip-8.1.2-py3.4.egg (python 3.4)
kendall#kendall-Macmini:~/Downloads$ python3.5 -m pip --version
/usr/local/bin/python3.5: No module named pip
It looks like I don't even have pip installed for python 3.5. How can I do this?
I've tried
kendall#kendall-Macmini:~/Downloads$ pip install -U pip
Requirement already up-to-date: pip in /usr/local/lib/python3.4/dist-packages/pip-8.1.2-py3.4.egg
Also,
kendall#kendall-Macmini:~/Downloads$ whereis pip
pip: /usr/bin/pip /usr/bin/X11/pip /usr/local/bin/pip3.4 /usr/local/bin/pip /usr/local/bin/pip2.7 /usr/share/man/man1/pip.1.gz
I can't find any support for upgrading to pip3.5
UPDATE
kendall#kendall-Macmini:~/Downloads$ sudo apt-get install python3-setuptools
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-setuptools is already the newest version.
The following packages were automatically installed and are no longer required:
libntdb1 linux-headers-4.2.0-27 linux-headers-4.2.0-27-generic
linux-image-4.2.0-27-generic linux-image-extra-4.2.0-27-generic
linux-signed-image-4.2.0-27-generic python-ntdb
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
kendall#kendall-Macmini:~/Downloads$ sudo python3.5 easy_install.py pip
python3.5: can't open file 'easy_install.py': [Errno 2] No such file or directory
kendall#kendall-Macmini:~/Downloads$ python3.5 -m ensurepip
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS
kendall#kendall-Macmini:~/Downloads$ sudo apt-get install pip3
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package pip3
kendall#kendall-Macmini:~/Downloads$ sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version.
The following packages were automatically installed and are no longer required:
libntdb1 linux-headers-4.2.0-27 linux-headers-4.2.0-27-generic
linux-image-4.2.0-27-generic linux-image-extra-4.2.0-27-generic
linux-signed-image-4.2.0-27-generic python-ntdb
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
kendall#kendall-Macmini:~/Downloads$ python3.5 -m ensurepip
Ignoring ensurepip failure: pip 8.1.1 requires SSL/TLS
As recommended by #fwalsh
kendall#kendall-Macmini:~/Downloads$ python3.5 get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 19177, in <module>
main()
File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip
zipimport.ZipImportError: can't decompress data; zlib not available
It seems like I'm missing all sorts of dependencies -- I'm going to try reinstalling
Check: /usr/local/lib/python3.5/dist-packages
You'll either have Pip there or easy_install(part of Pythons setup tools), which can be used to install Pip:
sudo apt-get install python3-setuptools
sudo python3.5 easy_install.py pip
Or you can try:
python3.5 -m ensurepip
Another option is attempting to install from a repository, the package name depends on your distribution:
sudo apt-get install python3-pip pip3
Edit: Try this correction for easy install:
sudo apt-get install python3-setuptools
sudo python3.5 /usr/local/lib/python3.5/dist-packages/easy_install.py pip
I'm assuming that's the directory it's installed to.
Also, you're missing this library for the python3.5 -m ensurepip command:
sudo apt-get install libssl-dev
All the various Python 3.* versions seem to re-use the same pip location, which makes it difficult to call for a specific Python version.
However, you can call pip for a specific version by specifying it as a module. So instead of doing:
pip3.5 install <blah>
which doesn't exist on most distros, do:
python3.5 -m pip install <blah>
Try
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.8 python3.8-dev python3.8-venv
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
python3 -V
I have installed python 2.7 and python 3.3 on server and now my need is to install pip for python 3.
Here what I have tried so far.
sudo apt-get install python3-setuptools
sudo easy_install3 pip
This will install pip for python 3.2 ( I don't have installed python 3.2),
sudo apt-get install python3-pip
This will install pip for python 3.2
My need is to install few packages with python3.3 (lxml, ftplib, etc...) for
that I need pip but unfortunately I was unable to do this.
I can not setup only python 3.3 because basic need is python 2.7 (for odoo).
Can anyone guide me in proper direction.
After:
sudo apt install python3-pip
you should be able to install packages with pip3 command.
Try:
pip --version
pip3 --version
I have both python2.7 and python3.2 installed in Ubuntu 12.04.
The symbolic link python links to python2.7.
When I type:
sudo pip install package-name
It will default install python2 version of package-name.
Some package supports both python2 and python3.
How to install python3 version of package-name via pip?
Ubuntu 12.10+ and Fedora 13+ have a package called python3-pip which will install pip-3.2 (or pip-3.3, pip-3.4 or pip3 for newer versions) without needing this jumping through hoops.
I came across this and fixed this without needing the likes of wget or virtualenvs (assuming Ubuntu 12.04):
Install package python3-setuptools: run sudo aptitude install python3-setuptools, this will give you the command easy_install3.
Install pip using Python 3's setuptools: run sudo easy_install3 pip, this will give you the command pip-3.2 like kev's solution.
Install your PyPI packages: run sudo pip-3.2 install <package> (installing python packages into your base system requires root, of course).
…
Profit!
You may want to build a virtualenv of python3, then install packages of python3 after activating the virtualenv. So your system won't be messed up :)
This could be something like:
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
pip install package-name
Short Answer
sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME
Source: Shashank Bharadwaj's comment
Long Answer
The short answer applies only on newer systems. On some versions of Ubuntu the command is pip-3.2:
sudo pip-3.2 install MODULE_NAME
If it doesn't work, this method should work for any Linux distro and supported version:
sudo apt-get install curl
curl https://bootstrap.pypa.io/get-pip.py | sudo python3
sudo pip3 install MODULE_NAME
If you don't have curl, use wget. If you don't have sudo, switch to root. If pip3 symlink does not exists, check for something like pip-3.X
Much python packages require also the dev package, so install it too:
sudo apt-get install python3-dev
Sources:
python installing packages with pip
Pip latest install
Check also Tobu's answer if you want an even more upgraded version of Python.
I want to add that using a virtual environment is usually the preferred way to develop a python application, so #felixyan answer is probably the best in an ideal world. But if you really want to install that package globally, or if need to test / use it frequently without activating a virtual environment, I suppose installing it as a global package is the way to go.
Well, on ubuntu 13.10/14.04, things are a little different.
Install
$ sudo apt-get install python3-pip
Install packages
$ sudo pip3 install packagename
NOT pip-3.3 install
The easiest way to install latest pip2/pip3 and corresponding packages:
curl https://bootstrap.pypa.io/get-pip.py | python2
pip2 install package-name
curl https://bootstrap.pypa.io/get-pip.py | python3
pip3 install package-name
Note: please run these commands as root
I had the same problem while trying to install pylab, and I have found this link
So what I have done to install pylab within Python 3 is:
python3 -m pip install SomePackage
It has worked properly, and as you can see in the link you can do this for every Python version you have, so I guess this solves your problem.
Old question, but none of the answers satisfies me. One of my systems is running Ubuntu 12.04 LTS and for some reason there's no package python3-pip or python-pip for Python 3. So here is what I've done (all commands were executed as root):
Install setuptools for Python3 in case you haven't.
apt-get install python3-setuptools
or
aptitude install python3-setuptools
With Python 2.4+ you can invoke easy_install with specific Python version by using python -m easy_install. So pip for Python 3 could be installed by:
python3 -m easy_install pip
That's it, you got pip for Python 3. Now just invoke pip with the specific version of Python to install package for Python 3. For example, with Python 3.2 installed on my system, I used:
pip-3.2 install [package]
If you have pip installed in both pythons, and both are in your path, just use:
$ pip-2.7 install PACKAGENAME
$ pip-3.2 install PACKAGENAME
References:
http://www.pip-installer.org/docs/pip/en/0.8.3/news.html#id4
https://github.com/pypa/pip/issues/200
This is a duplicate of question #2812520
If your system has python2 as default, use below command to install packages to python3
$ python3 -m pip install <package-name>
Easy enough:
sudo aptitude install python3-pip
pip-3.2 install --user pkg
If you want Python 3.3, which isn't the default as of Ubuntu 12.10:
sudo aptitude install python3-pip python3.3
python3.3 -m pip.runner install --user pkg
You can alternatively just run pip3 install packagename instead of pip,
Firstly, you need to install pip for the Python 3 installation that you want. Then you run that pip to install packages for that Python version.
Since you have both pip and python 3 in /usr/bin, I assume they are both installed with a package manager of some sort. That package manager should also have a Python 3 pip. That's the one you should install.
Felix' recommendation of virtualenv is a good one. If you are only testing, or you are doing development, then you shouldn't install the package in the system python. Using virtualenv, or even building your own Pythons for development, is better in those cases.
But if you actually do want to install this package in the system python, installing pip for Python 3 is the way to go.
Although the question relates to Ubuntu, let me contribute by saying that I'm on Mac and my python command defaults to Python 2.7.5. I have Python 3 as well, accessible via python3, so knowing the pip package origin, I just downloaded it and issued sudo python3 setup.py install against it and, surely enough, only Python 3 has now this module inside its site packages. Hope this helps a wandering Mac-stranger.
Execute the pip binary directly.
First locate the version of PIP you want.
jon-mint python3.3 # whereis ip
ip: /bin/ip /sbin/ip /usr/share/man/man8/ip.8.gz /usr/share/man/man7/ip.7.gz
Then execute.
jon-mint python3.3 # pip3.3 install pexpect
Downloading/unpacking pexpect
Downloading pexpect-3.2.tar.gz (131kB): 131kB downloaded
Running setup.py (path:/tmp/pip_build_root/pexpect/setup.py) egg_info for package pexpect
Installing collected packages: pexpect
Running setup.py install for pexpect
Successfully installed pexpect
Cleaning up...
You should install ALL dependencies:
sudo apt-get install build-essential python3-dev python3-setuptools python3-numpy python3-scipy libatlas-dev libatlas3gf-base
Install pip3(if you have installed, please look step 3):
sudo apt-get install python3-pip
Iinstall scikit-learn by pip3
pip3 install -U scikit-learn
Open your terminal and entry python3 environment, type import sklearn to check it.
To install pip for python3 use should use pip3 instead of pip.
To install python in ubuntu 18.08 bionic
before installing a version of python, activate virtual environment so that it won't have any problem in a future versions of python.
virtualenv -p /usr/bin/python3 py3env
source py3env/bin/activate
then install the actual python version you want.
>> sudo apt-get install python3.7
To install the required pip package in ubuntu
>> sudo apt-get install python3-pip
You Can Simply type in terminal/console .
Commands
sudo apt update
sudo apt upgrade
sudo apt install python3-pip3
pip3 install package-name
Another way to install python3 is using wget. Below are the steps for installation.
wget http://www.python.org/ftp/python/3.3.5/Python-3.3.5.tar.xz
tar xJf ./Python-3.3.5.tar.xz
cd ./Python-3.3.5
./configure --prefix=/opt/python3.3
make && sudo make install
Also,one can create an alias for the same using
echo 'alias py="/opt/python3.3/bin/python3.3"' >> ~/.bashrc
Now open a new terminal and type py and press Enter.