Install pip without root but with the system's python - python

I am trying to install pip without sudo.
Reading the Install Docs, it appears to be possible to use --user to have it being installed in my home directory.
After uninstalling pip from the global scope I tried python get-pip.py --user and obtain the following error:
PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/wheel-0.29.0.dist-info'
Checking the Install Docs I found the following notice:
Be cautious if you're using a Python install that's managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.
Can I install pip into my home with the casual Ubuntu apt-get python? Or do I also need to build python locally?

As phd mentoined in the comment of my question, cloning pip and installing it via python setup.py install --user worked out fine.

Related

Attempting to upgrade pip from version 20.3.1 to version 21.3. How do I use the `--user` option?

For the sake of experience, I'd prefer to try this in cmd and not use get-pip in pypi.org
Tried changing windows account from user to administrator and a youtube instruction video.
Was awarded the following error message:
Successfully uninstalled pip-20.3.1
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'C:\Users\User\AppData\Local\Temp\pip-uninstall-j78tgiwv\pip.exe'
Consider using the --user option or check the permissions.
Running pip install --upgrade --user pip (like pip is suggesting) will install pip on the user site packages (not the global). This works fine on some cases, but the upgraded package will only be available to the user who installed.
As I can read, your message seems harmless (it failed on a temporary file), if you run pip --version you should see the latest version. However, if that doesn't work, you may have to add the --user option to your command.

How to fix error when downloading pyPDF2 on Python 3.6.0?

I am trying to install the pyPDF2 package on Python 3.6.0. When I open the Command Prompt and type python -m pip install pyPDF2 I receive the following error:
Successfully built pyPDF2
Installing collected packages: pyPDF2
ERROR: Could not install packages due to an EnvironmentError:
[WinError 5] Access is denied: 'C:\Program
Files\Python36\Lib\site-packages\PyPDF2' Consider using the
--user option or check the permissions.
Previously, I experienced a similar issue with installing the pip library. I had to receive administrative rights from another user before successfully downloading pip.
I am using Windows 10 OS.
There are a number of options:
Install packages in your user directory using pip --user (answer of PoorProgrammer)
This is also the solution provided in the error message itself, and should always work.
Run the python/pip as administrator (answer of Sıddık Açıl)
This is only useful if you have administrative rights.
Install Python in a non-protected directory (e.g. C:\Python\3.6) instead of in C:\Program Files.
This should work as long as you're allowed to install software on the computer. Once installed, you can install additional packages without administrative rights.
Install packages in a virtual environment.
This also works without administrative rights, but you need to install virtualenv once first (e.g. using python -m pip install --users virtualenv).
To create a virtual environment for Python 3.6 and install the package in it:
py -3.6 -m virtualenv --python=3.6 my_virtual_environent
my_virtual_environent\Scripts\activate
python -m pip install pyPDF2
You can install it locally on your user as well. I assume that you don't want to have to go and get your cmd elevated every time so the following should work:
python -m pip install --user pyPDF2
If you want to see the location, it should be at %APPDATA%\Python since you are using windows.
Open cmd as an administrator to get elevated access and run your Python pip install script again.

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.

python pip broken by virtualenv

I recently had to switch my machine at work. On the new machine, pip is not anymore.
$ pip --version
...
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/virtualenv-15.0.1.dist-info'
I imagine that this issue is caused by virtualenv, as I never encountered any problems on my old machine and the only difference I find, is that there was no virtualenv package installed on the old machine.
However
$ python -c "import pip; print pip.__version__"
10.0.1
still works.
I would be grateful if anyone could provide help, how to fix this problem or trace down the real problem.
Please note: I do not have root rights.
Here the problem is you don't have permission to the system folder. So whenever you use pip try to use it like this.
python -m pip install --user package
Here the package means the package you need to install using pip. Furthermore try using the following command to upgrade the version of your pip.
python -m pip install --user --upgrade pip

"Not a directory" when using PyCharm, pip to install numpy

I'm trying to install Python packages, specifically numpy and networkx, using PyCharm on a laptop running Gallium, and I keep getting:
IOError: [Errno 20] Not a directory: '/tmp/pip-build-xMS1YA/numpy/doc/f2py/oldnews.html'
The path that isn't a directory varies depending on what I'm doing. I tried this through the PyCharm IDE and by running a similar command through the command line, e.g., sudo pip install numpy.
I did see this question, which is similar, but the original poster reinstalled the OS as the solution, which I'd rather not do. I had installed PyCharm using these instructions:
sudo add-apt-repository ppa:mystic-mirage/pycharm
sudo apt-get update
sudo apt-get install pycharm
As with the SO question I linked above, I tried:
pip install headers_workaround
pip install spacy
but I also got that "Not a directory" error with spacy.
When the other person reinstalled their OS I imagine the only thing that really mattered was reinstalling pip.
The instructions to reinstall pip can be found here. Assuming this issue is related to a bug in (your version of) pip running get-pip.py should fix the issue.

Categories