How to uninstall all versions of pip on Mac Catalina OS - linux

I got a new MacBook and transferred some apps over from my old MacBook with the Migration Assistant. I had pip installed on my old Mac. I didn't think it would be installed on the new Mac so I attempted to install in using the following command:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
followed by:
python3 get-pip.py
When I tried to check if it was installed with pip3 --version I received the following warning:
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
I've tried uninstalling pip with python3 -m pip uninstall pip setuptools, but this only produces [Errno 13] Permission denied errors. I've tried using chmod 755 to change the permissions of the python files that show up when I run ls -la but it doesn't seem to change anything and I still get the [Errno 13] errors.
Is there a way to change all permission on my Mac? Or else is there a way to uninstall all versions of pip?
I also have Conda installed, but I dont think that is an issue here.
Thanks.

Related

Error when trying to install oct2py package

I am trying to install to oct2py package to import in my python script. However whenever I run the command pip install oct2py I get the following error:
Fatal error in launcher: Unable to create process using '"c:\python37\python.exe" "C:\Program Files\Python37\Scripts\pip.exe" ': file cannot be found.
How can I install oct2py?
Found the answer
Deinstalled python and reinstalled it. I checked the environment variable and changed it from this one : 'C:\Program Files\Python39' to this one 'C:\Users\lsee\AppData\Local\Programs\Python\Python39'.
Is unable to locate your pip installer, easy fix is unusually to either upgrade or test pip :
# to upgrade your pip
python -m pip install --upgrade pip
pip --version
# test you have pip in your machine
If your pip version is showing that means you have it installed, it could be a problem activating your virtual environnement, or your path.
It says the file cannot be locate, are you sure your path for Python and pip is correct ?
Try:
python -m pip install oct2py
This should work (as python -m pip install gave not errors)

Pip Not recognized as an external command in cmd in windows

When I am trying to install the Python 3.7.1 It installed the Python 3.7.1. I can also check the pip install checkbox. Later I am trying to install pip in cmd. The below error occurs. When I try to see the pip.exe file in Python37/Scripts it shows an empty folder. I don't know what to do and what is the issue. Please help me because it was my study project to do.
Your pip is not setup during installation, you can re-run the python installer and make sure to check the option to install pip or simply access pip using:
python3 -m pip
All commands are the same,so you can install packages like:
python3 -m pip install cython
Hope this works for you!

Problems with pip3 and pipenv with Mac OS Catalina fresh install

I installed xcode dev tools first using
%xcode-select --install
then I installed Homebrew using
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
then I did
%brew install python3
%pip3 install pipenv
but when I call
%pip3
I get
% pip3
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/usr/bin/pip3", line 10, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
This is where it says my pip3 and python3 are located
% which pip3
/usr/bin/pip3
% which python3
/usr/bin/python3
Can someone please help me solve this problem. I am trying to learn to program but I can't continue without fixing this
MacOS Catalina ships with it's own versions of python3 and pip3, so this is probably conflicts between macOS and Brew-installed Python libraries. I solved similar issues by no longer using Brew for anything related to Python.
My recommendation: From a fresh install of Catalina, run sudo pip3 install pipenv. Create a separate directory for each project you work on, and run pipenv shell from that directory every time you work on it. Don't ever bother installing any packages system-wide, and don't overwrite macOS's Python. Anything you do, do inside a Pipenv managed virtual environment -- only install packages via pipenv install <pkg>.
Doing all this will keep the right version of the Python binary and all related packages inside a directory inside ~/.local/share/virtualenvs/ for each project. This way, future macOS updates shouldn't every break dependencies.
I had a similar problem after upgrading to Catalina since I was already using homebrew and Python/pipenv stopped to work as expected. My Python crashed every time, I ran pipenv install with an error described in this developer.apple.com thread. The answer by Mickey Ristroph sounds like a okay'ish workaround, but it doesn't really solve the problem.
I want to be able to use homebrew for all my MacOS installed software - including Python. But there was help, since the problem was the usage of a wrong version libcrypto dylib version. To fix the issue, update & upgrade brew packages and be sure openssl is installed:
brew update && brew upgrade && brew install openssl
Then we create new symbolic links to the homebrew installed libssl.dylib and libcrypto.dylib libraries:
# go to homebrew installed openssl dir:
cd /usr/local/Cellar/openssl/1.0.2t/lib
sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/
cd /usr/local/lib
# if there are links already, you may backup them:
mv libssl.dylib libssl_bak.dylib
mv libcrypto.dylib libcrypto_bak.dylib
# now create new symbolic links:
sudo ln -s libssl.1.0.0.dylib libssl.dylib
sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib
Now my homebrew installed Python (and pipenv) works like a charm again.
You need to change the raw command used to install libraries and supports in macOS Catalina to this:
python3 -m pip install pipenv
(instead of pip3 install pipenv)

pip not running with Python 3.5

I have installed Python 3.5 and Pip but When I am type pip or pip3 in console, i get this error
The folder you are executing pip from can no longer be found.
If I run pwd, I get
/home/zahid
Pip was installed using
sudo python /usr/local/lib/python3.5/site-packages/easy_install.py pip
and output that I got was
[sudo] password for zahid:
Searching for pip
Best match: pip 8.1.1
Adding pip 8.1.1 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip3.5 script to /usr/local/bin
Installing pip3 script to /usr/local/bin
Using /usr/local/lib/python3.5/site-packages
Processing dependencies for pip
Finished processing dependencies for pip
Can anyone tell me what is going on here
which python3 returns
/usr/bin/python3
which pip returns
/usr/local/bin/pip
which pip3 returns
/usr/local/bin/pip3
echo $PYTHONPATH returns
nothing blank
Regards
Please close this terminal and open a new terminal. You may have deleted some files inadvertently. As a result the terminal is unable to locate some links or environment variables. I faced the same issue. In a new terminal everything went fine.
I had this error on my Mac and restarting fixed this problem for me.
Does sudo pip work?
If so, check to make sure your profile isn't messed up. Check your path variable using the echo command with something like echo $PATH
You need to make sure /usr/local/bin is present in your user profile.
If not, did you install pip into 3.5 and are you accidentally running some other version of python like python 2?
Create a symbolic link using
ln -s /usr/local/bin/pip /usr/bin/pip
test it by running
pip -V

Install pip3 package locally

Having used npm for some time, I'm struggling to understand why pip3 (i.e.: pip with Python 3) is so stubborn when it comes to manage permissions.
So far, I've been using pip3 with sudo as I'm the only one using this computer and I don't mind installing packages globally
Today I wanted to install the pep8 package and use it locally without sudo. pep8 can be used by IDEs and they would not be able to use it without sudo. Therefore, I'd like to run
pip3 install --user pep8
However, command doesn't work without sudo. Console throws a traceback with a PermissionError:
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.4/site-packages/pip/__init__.py'
And if run with sudo, quite logically, pep8 is installed in /root
With 2.7, the workaround is to uninstall pip and then reinstall it locally with --user. At the moment, though, I'm unable to uninstall pip3. At least in Fedora 22, dependencies seem to be quite tight. My guess is that pip3 comes bundled with 3.4 and that makes matters worse.
And so, running
python3 get-pip.py --user
gives a permission error because the script looks at current pip3 installations. If I run the command with sudo, the --user works (I believe it's still in testing mode?) but, logically, it installs it in the /root folder
In short, is there a way to use pip with Python3 to install packages locally?
Within a console start your version of python you want to install the package for.
Run the python with the permission you want it to be installed with.
Python 3 and without sudo in this case.
python3
Thank in the python instance install the package you want.
import pip
#Ininstall the package
#This is the path to the setup and unzipped package. Path to the folder with setup.py.
path_to_setup = "/usr/lib/python3.4/site-packages/pep8"
#finelly runs the installation
pip.main (['install', path_to_setup])
#You will see some data processed.
#Now test it. In this case the package is pep8
import pep8

Resources