How do I use newer pip after the upgrade? (10 --> 18) - python

I'm using Python 3.6 on Pycharm venv (virtual environment provided by IDE)
Terminal kept telling me to upgrade my pip from old 10.0.1 to newer 18:
You are using pip version 10.0.1, however version 18.0 is available
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
So I upgraded my pip with the suggested command.
However, when I check my pip version by pip --version, it's still on 10.0.1 and pip keeps telling me to upgrade.
pip 10.0.1 from
h:\pycharmprojects\my_project\venv\lib\site-packages\pip-10.0.1-py3.6.egg\pip
(python 3.6)
I'm sure it's already up-to-date by checking IDE's interpreter settings.
I know it doesn't really matter but it bothers me pretty much.
I already tried closing and opening new terminal but that clearly doesn't work.
How do I use my newly installed pip? Is it just Pycharm's problem?

When you are using a virtual environment in pycharm, you update the version of pip inside that virtual environment.
If you want to upgrade pip outside of the venv, type
python -m pip install pip -U
Where python is how you start python from the terminal,
which may be python3 or py -3.6 depending on your operating system.
To install inside the virtual environment, you can activate
that inside the terminal and then type the above command.

If you run this command in your PyCharm terminal, it will resolve the warning about pip:
python -m pip install -U --force-reinstall pip
Here are some comments on the JetBrains community page

Related

Unable to install Django Version 1.11.22 with python 2.7 installed on windows 10

I have python 2.7 installed on my machine globally and the pip version is pip 20.3.4. I want to install Django version 1.11.22. When I am trying to do so with pip install Django==1.11.22, I am getting the error as mentioned in the picture. This is not just while installing Django, I am getting the same error while installing anything like pip install openpyxl.
The latest version Python 2.7.18 should work fine. Install it with pip enabled or install pip after using python -m ensurepip. Upgrade pip:
pip install --upgrade "pip<21.0" "setuptools<45"
Install virtualenv:
pip install --upgrade "virtualenv<20"
Create a virtual environment (very much recommended) somewhere and activate it:
virtualenv django-venv
django-venv\Scripts\activate.
Install Django (can be done without a virtual environment):
pip install --upgrade "Django==1.11.22".
Remember to activate the virtual environment (if you use it) every time you open a new terminal.
As the error says and #Willem Van Onsem said, python 2.7 is no longer support, you can't install it nowadays

How to Install virtualenv without pip?

I have a problem on pip.
As I use pyenv, using python version 3.7.x, there is no problem around pip.
$ /home/yuis/.pyenv/shims/pip --version
pip 19.2.3 from /home/yuis/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pip (python 3.7)
But using python version 3.6.x, I get a result that saying the pip is located on "~/.local", but not on "~/.pyenv".
This is very bad for me. Because the version what I need now is 3.6.x.
This incomprehensive pip behavior continues if I install other python 3.6 version, so python 3.6.12 and 3.6.11 will show this same path.
I guess this bug is most probably because some kind of conflict from the locally installed python and pyenv installed one.
$ /home/yuis/.pyenv/shims/pip --version
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.
pip 20.3.3 from /home/yuis/.local/lib/python3.6/site-packages/pip (python 3.6)
Now, I don't care much about pip anymore, because it seems an unsolvable issue. No time to waste. So now I want to try with virtualenv.
I need to install virtualenv first, because I can see this error.
$ virtualenv venv
pyenv: virtualenv: command not found
The `virtualenv' command exists in these Python versions:
3.5.10
3.7.6
Note: See 'pyenv help global' for tips on allowing both
python2 and python3 to be found.
But both of the followings didn't work.
pip install virtualenv
/home/yuis/.pyenv/shims/pip install virtualenv
python -m pip install virtualenv
Now I have no idea what is going on on my machine and how to solve this problem.
Have you tried python -m virtualenv .venv?
Try this maybe,
pip install git+https://github.com/pypa/virtualenv.git#main
You can visit this link for further details,
Also make sure your python & conda env are properly configured and added to PATH

I'm confused about the difference between pip and pip3, in anaconda env

TL;DR: a package is installed under pip3, but it cannot be found under Python3. Why?
All of this is happening in my anaconda base environemnt:
So I've been struggling with tensorflow and its versions (another post coming up).Turns out version 2.1 is only available at pip and not with conda install. So after upgrading pip3 install --upgrade pip I install pip3 install tensorflow==2.1.0. I open Jupyer-Notebook afterwards, and turns out tensorflow is not installed(running Python3). I check from the terminal first for the version, and then to uninstall tensorflow. It is not installed under pip (as expected) but it is indeed installed under pip3. I also get this message when uninstalling via pip3:
"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."
which might be related. I was under the impression that pip installs packages for the default python (3.7.4 in my case) but pip3 installs them only for Python3. What am I missing?
Thanks!
a package is installed under pip3, but it cannot be found under Python3. Why?
Because you have many different Pythons. pip doesn't install packages for all Pythons; pip3 doesn't install packages for Python3. They install packages for that particular Pythons they're running under. You cannot expect to install a package with one Python and import it in another eve if they're of the same version.
To see what Python is used with a particular pip see its shebang:
head -1 $(which pip)
head -1 $(which pip3)
If the shebang is #!/usr/bin/env python continue investigating with which python (or which python3).
Finding the Python run python -m site to see where from the packages are imported.

If Anaconda comes with pip, why do instructions suggest installing it?

I have just installed Anaconda with Python3.7 on my Ubuntu 18.04. Ubuntu 18.04 comes with Python3.6 by default (but not pip).
After installing Anaconda and reading its documentation, I can see that Anaconda comes with both conda and pip. This is the case, as I can see:
$ which pip
# Output: /home/user-name/anaconda3/bin/pip
$ pip --version
# Output:
pip 10.0.1 from /home/user-name/anaconda3/lib/python3.7/site-packages/pip (python 3.7)
However, I am confused when reading the instructions from this link:
https://conda.io/docs/user-guide/tasks/manage-pkgs.html#installing-non-conda-packages
On one hand it says: " Both pip and conda are included in Anaconda and Miniconda, so you do not need to install them separately." => That's the pip I can see in my commands above.
But on the other hand it says: " It is possible to have pip installed outside a conda environment or inside a conda environment. To gain the benefits of conda integration, be sure to install pip inside the currently active conda environment, and then install packages with that instance of pip. The command conda list shows packages installed this way, with a label showing that they were installed with pip.
So I'm confused:
I clearly got a version of pip when installing Anaconda and I can see in /home/user-name/anaconda3/bin
But if I want to use pip to install a package, I need to install pip in my environment using $ conda install pip and then $ pip install package (all of this in my normal Ubuntu terminal).
I don't understand how this makes sense..
Many thanks!

Why is PyCharm unable to find the correct verion of pip to install a Python module?

OSX: 10.9.5
PyCharm: 4.5
I am working on project in PyCharm IDE, using the 2.7.3 Python interpreter and need to import thepsycopg2 module. I tried to install the module with PyCharm, but it failed and asked me to do it manually:
Image of error message
So I typed that command in the bash shell, the module installed and now it shows up in the project interpreter 2.7.2 but not in 2.7.3 !!!!!
Maybe the pip version is too old? I upgraded pip from the bash shell: pip install --upgrade pip
python 2.7.2 shows version 7.1.0
python 2.7.3 shows version 1.5.6
You should open Preferenes > Project: (projectname) > Project Interpreter.
Choose the interpreter you want from the dropdown. If you have installed Python with Homebrew, as I have, then you maybe want to choose one of the python interpreters from the Cellars to ease usage of other packages you may have installed with Homebrew.
It might simply be that your system doesn't have pip installed, only pip3.
My system only showed me having pip3 not pip.
Use which pip3 and which pip to see if you have either.
I decided to update pip3, first trying pip3 install --upgrade pip3 which, oddly, returned: ERROR: No matching distribution found for pip3
Next, I ran pip3 install --upgrade pip and now PyCharm can install packages from the GUI.
You didn't specify what pip version you have. My guess is that the pip version is too old and PyCharm passing some flag which returns deprecation warning which cause it to fail. Try updating pip: pip install --upgrade pip

Categories