I installed python3 using homebrew but it didn't install pip3 or should I say it installed but it doesn't recognize the command ?
Here is what I did:
brew install python3
This installed python3 but threw an error at the end saying it couldn't link python3 and prompted me to run
brew link python3
to link the installation but this throws another error:
Linking /usr/local/Cellar/python3/3.6.3... Error: Permission denied # dir_s_mkdir - /usr/local/lib
Does anyone know how solve this ?
When I run:
brew info python3
It says:
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
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.html
Which makes me think pip3 is installed but not recognized. Any help is appreciated.
INFO:
OS => MacOS High Sierra 10.13.1
pip3 install twilio
-bash: pip3: command not found
Ok it took me a lot of googling but the problem is that in high sierra all permissions inside usr/local changed and homebrew has to create some folder inside usr/local. Here is how I solved everything:
I tried using sudo brew install python3 but that also threw an error
directly from Homebrew telling me that it doesn't allow the use of
sudo brew.
Create the folders I needed using sudo mkdir inside /usr/local:
sudo mkdir lib
sudo mkdir Frameworks
Change the permissions inside /usr/local so that homebrew can access them:
sudo chown -R $(whoami) $(brew --prefix)/*
Now install python3
brew install python3
This will give you a successful installation:
==> Pouring python3-3.6.3.high_sierra.bottle.tar.gz
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> /usr/local/Cellar/python3/3.6.3/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.3/bin --in
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
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.html
==> Summary
🍺 /usr/local/Cellar/python3/3.6.3: 3,588 files, 56.1MB
After resolving the linking issue (e.g. https://github.com/Homebrew/homebrew-core/issues/19286 ), python3 is installed but not pip3. Reinstalling python (e.g. brew reinstall python) eventually installs pip3 as well. These steps works well for me.
GitHub user #aether2501, commenting on a sudo chown solution for a "Homebrew Permission Denied" problem, suggests instead that Homebrew be uninstalled/reinstalled after the upgrade to High Sierra.
I successfully used #aether2501's reinstall command, /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)", on High Sierra (10.13.2) without uninstalling brew first.
In addition to creating the /usr/local/Frameworks directory and setting the necessary ownership and permissions I needed to link python3, it also appears to have fixed other directory issues.
I had the same issue and used:
sudo -H pip3 install virtualenv
sudo -H pip3 install virtualenvwrapper --ignore-installed six
In my case, this fixed the issue:
brew unlink python#3.9; brew link python#3.9
(You might have to replace the version number with the version you have installed)
Related
I'm trying to install modules such as gitpython into my Python3 directory however when I run:
Pip install gitpython it automatically downloads it into python2.7
I've tried specify the Python3 directory but it says the the library has already been installed.
Requirement already satisfied: gitpython in /usr/local/lib/python2.7/dist-packages (2.1.11)
Problem is when I try to call from git import repo my Python3 can't find the module.
Is there anyway to get pip to install my libraries to Python3 as a default, can I just uninstall Python 2.7 to save problems?
I run
sudo apt install python3-pip
and it states it is already installed, so I run sudo pip3 install gitpython and it says Command 'pip3' not found, but can be installed with:
sudo apt install python3-pip
SOLUTION
sudo apt-get remove python3-pip; sudo apt-get install python3-pip
It depends of your version of pip. But I think that python3-pip may do the trick.
sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME
You should use pip3 to install your packages in your python3 environment. thus instead of installing with pip use pip3 install gitpython
You can try to see the version of python with:
python --version
if the result is python 2.7, that means that your environment variable for python3 needs to be set.
After that you can try:
python -m pip install package_name
I hope it will help you =)
Adrien
You should use python3 venv Python 3 venv
python3 -m venv /path/virtual/environment
source /path/virtual/environment/bin/activate
or use pip3 to installing any libraries for python 3
$ pip3 install 'some library'
You should create virtual environment for python3. using:
virtualenv -p /usr/bin/python3 <VIRTUAL_ENV NAME>
Then activate it using:
source <VIRTUAL_ENV NAME>/bin/activate
Then install your dependency(gitpython in your case) into that.
I installed pip through brew, and I can't get it to use python 3 instead of 2.7. Here's the information I think might be relevant to demonstrate what's happening.
$ pip -V
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
$ pip2 -V
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
$ pip3 -V
-bash: pip3: command not found
$ which pip
/usr/local/bin/pip
$ sudo python3 get-pip.py
The directory '/Users/tj/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/tj/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.
Requirement already up-to-date: pip in /usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
$ sudo easy_install3 pip
sudo: easy_install3: command not found
$ sudo easy_install-3.6 pip
sudo: easy_install-3.6: command not found
$ sudo easy_install pip
Searching for pip
Best match: pip 9.0.1
Processing pip-9.0.1-py2.7.egg
pip 9.0.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin
Using /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip
I tried everything I could find online with no luck. The main symptom of this problem is when I use pip to install a package, it always goes into 2.7 (or fails to install because numpy is deprecated or something like that).
On OSX, brew (or other) python 2.7/3 is installed separately to the older version of 2.7 that comes with OSX. Trust me when I say you DO NOT WANT TO MESS WITH IT.
Try typing pip3
$ pip3 --version
$ pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
Whereas pip (for 2.7) is not even installed.,
$ pip --version
$ zsh: command not found: pip
Even if you try:
$ brew install pip
Leads to
If you meant "pip" specifically:
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/
AS A LAST RESORT:
python3 -m ensurepip
will ensure/fix a system has it.
pip3 should be located at /usr/local/bin/pip3
Contents are:
#!/usr/local/opt/python3/bin/python3.6
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==9.0.1','console_scripts','pip3'
__requires__ = 'pip==9.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('pip==9.0.1', 'console_scripts', 'pip3')()
)
I upgraded to the new version of Pycharm. In the terminal, it says bash-3.2$ instead of my username. When I tried to install a library, it said that pip command is not found:
bash: pip: command not found
So I installed pip:
bash-3.2$ sudo easy_install pip
Searching for pip
Best match: pip 8.1.2
pip 8.1.2 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip3.5 script to /usr/local/bin
Installing pip3 script to /usr/local/bin
Using /Library/Python/2.7/site-packages
Processing dependencies for pip
Finished processing dependencies for pip</i>
Okay, now all I have to do is use pip to install a library, right?
But then, this happens:
bash-3.2$ pip install pandas
bash: pip: command not found
I don't understand what I have to do to actually install pip. Or should I use sudo easy_install [library]?
I know that this is not precisely what you're asking, but PyCharm has its own built-in package manager. You should not have to use pip manually.
File->Settings->Project Interpreter
https://www.jetbrains.com/help/pycharm/2016.3/installing-uninstalling-and-upgrading-packages.html
there you can manage the installed packages for the selected Python interpreter or virtualenv.
Run this command on your terminal. pip will be installed without any issue.
sudo [your package manager] install python-pip python-dev build-essential
If it is not solved. The problem might be PATH problem.
Type echo $PATH on terminal. There should be /usr/local/bin in the output. If it is not type PATH=$PATH:/usr/local/bin to add /usr/local/bin to PATH
I am trying to install scrapy-deltafetch on ubuntu 14 using pip (v8.1.2 on python 2.7). When I run (sudo) pip install scrapy-deltafetch, I get the following error:
Update:
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-TVr3UZ/bsddb3/
Any thoughts on how to resolve this?
I have already ran the following:
sudo python ez_setup.py
pip install --upgrade setuptools
as well as
sudo apt-get install python-setuptools
I do have both python3 and python 2.7 on the computer.
I have tried installing bsdb3 but that does not work either. I will look into setting up berkeley db correctly and update here accordingly
Update:
Installing berkeley DB did not solve the issue.
scrapy-deltafetch requires bsddb3.
bsddb3 itself, on Ubuntu Trusty, depends on libdb5.3.
You can either install python-bsddb3 with apt-get, or only apt-get install libdb5.3. pip install scrapy-deltafetch should work after that.
Install libbd-dev first,
sudo apt-get install libdb-dev
then install deltafetch,
# for python2
sudo -H pip install scrapy-deltafetch
# for python3
sudo -H pip3 install scrapy-deltafetch
I know the newer versions of python come with pip installed. So 'sudo apt-get install python3-pip' gives me that it is installed saying that it is the latest version, then why does 'pip install django' gives an error saying pip is not insatlled? Namely this:
The program 'pip' is currently not installed. You can install it by typing:
sudo apt-get install python-pip
I again run 'sudo apt-get install python-pip' (for python 2.7) which installs version 1.5. So i try pip install -U pip and it downloads the package marked 7.1 and succesfully installs. However on checking the version again it is still 1.5
You can install pip with the help of get-pip.py script.
you can download this script and execute on your terminal "python get-pip.py".
it will install pip on your system.
you can also use curl to download get-pip.py script-
curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py".
To verify the installation you can use-
pip --help
pip -V