Use or install different versions of python3 pip - python-3.x

I'm trying to install packages for my python 3.5.0 versus my python 3.4.3
I can run both by typing either python3.4 or python3.5
I have pip2 and pip3. I also ran the script sudo easy_install3 pip, which made me be able to use pip3.4 But I am still having trouble installing modules for python3.5. pip3 just installs for python3.4
I am looking to install termcolor for python3.5 and I am having no success. Can anyone help?

I am on Windows, and you appear not to be, but maybe the following will help.
If pip is in your system's equivalent of python35/Lib/site-packages, then python3.5 -m pip should run pip so that it installs into the 3.5 site-packages.
If you do not have pip in the 3.5 site-packages, copy its directory, along with its dependencies (pip....dist-info/, setuptools/, setuptools....dist-info/, and easyinstall.py) from the 3.4 site_packages.
Or, if pip3 or even pip3.4 is in python35/Scripts, run it with its full path name so you are not running the 3.4 version.

Related

no module named "pip" in python

I am on python 3.8.5 I am using python and pip, pipenv recently without any issue on any terminal and project. But, today when I try to do anything with pip or pipenv, I get this error
No Module Named "pip"
I even installed python latest version again and I know that on 3.8.5, I don't have to download pip. I can't even check the pip version in the terminal.
Type in sudo apt-get install python3-pip in the terminal to install pip

pip install doesn't find my highest installed version of python

My problem is that when I try to install a product that requires python >= 3.7, the installer fails, saying that it could not find the required python version, even though I do have python 3.8 installed.
I'm running Ubuntu for Windows 10 (the MS-store product.)
It comes with python 3.6 installed.
From a clean ubuntu install, I
sudo apt update
sudo apt install python3.8
sudo apt install python3-pip
At this point the command "python" is not mapped (not available), but I can run "python3" to get python3.6 or "python3.8" to get that version.
pip3 reports that it is using python 3.6.
pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
So it appears that pip is not recognizing the python 3.8 that I have.
When I attempt my product install, it fails, indicating that
sudo pip3 install --verbose (mypackage name)
(... various messages...)
(requires-python:>=3.7) is incompatible with the pythonversion in use. Acceptable python versions are:>=3.7
Could not find a version that satisfies the requirement cbordplatform (from versions: )
No matching distribution found for (my package name)
How can I get pip3 to recognize my python3.8?
If you want to make sure that pip is using the correct version of Python, call it with the specific Python like this:
python3.8 -m pip ...

Updating 'pip' after configuring 'pip' to point to Homebrew's pip3 causes errors

After installing Python 3 using Homebrew and putting the Homebrew aliases (e.g. pip -> pip3) on my path
export PATH=/usr/local/opt/python/libexec/bin:$PATH
and then updating pip with
pip3 install -U pip
I get errors whenever I run pip:
pkg_resources.VersionConflict: (pip 19.1 (/usr/local/lib/python3.7/site-packages), Requirement.parse('pip==19.0.3'))
How do I configure my Homebrew Python 3 correctly with pip3 so that updates to pip (and other packages) work when the aliases provided with Homebrew's Python 3 are on my path?

How to install xlrd in python3 library

I am trying to install xlrd to read Excel files in python.
I have tried this: pip install -U pip setuptools. My macOS Mojave 10.4.3 has Python 2.7 which is where the default install goes to. But I have also installed Python3.7. How do I get pip install to my 3.7 directory?
I am on Mac machine(Catalina -version 10.15.5) and below pip3 command worked for me.
pip3 install xlrd
python version : 3.7.6
OS : Mac-Catalina(10.15.5)
Thanks to #Tapan Hegde, pip3 install xlrd worked from me, after installing the pip3, like this:
sudo apt update
apt install python3-pip
pip3 install xlrd
I reckon the easiest/cleanest solution would be to use a tool that isolates your python environment, such as virtualenv
Once installed, create a virtual env by specifying which version of python you want to use:
$> virtualenv -p python3 env
Note: puttin python3 directly works only for mac, with linux, you must specify the absolute path or your python binary.
And then 'activate' your environment:
$> source env/bin/activate
From here, any python or pip command you use will use python3.
$> pip install xlrd
Virtualenv has the advantage of not 'polluting' your local python installation, your can manage your pip modules installed more easily.
If you want more detail on how it works and the other alternatives, check this post
When pip install xlrd not work and in computer is still old version, then try do it with current version, for example pip install xlrd==2.0.1.
The current versions are here

Pip won't install into python 3 when using homebrew python?

So I've got a virtualenv I've created using pyvenv-3.3, which I thought set up pip to install things into the virtualenv's path. However, I get the following outputs after I've activated by virtualenv:
$ pip --version
pip 1.4.1 from /usr/local/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg (python 2.7)
pip-3.3 --version
pip 1.4.1 from /usr/local/lib/python3.3/site-packages/pip-1.4.1-py3.3.egg (python 3.3)
This is all fine and good, but then my sys.path is this:
['',
'/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python33.zip',
'/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3',
'/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/plat-darwin',
'/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/Versions/3.3/lib/python3.3/lib-dynload',
'/Users/alexgolec/Documents/gutenberg/virtualenv/lib/python3.3/site-packages']
Most notably, the whole site-packages directory is outright missing. Furthermore, this output indicates to me that I'm probably using a python that installed through homebrew at some point. Most infuriatingly, none of the directories in my sys.path are compatible with pip.
Any thoughts on remedies? I won't manually edit my sys.path, but maybe there's some configuration with pip I can do?
Install virtualenvwrapper (makes using virtualenv so much easier):
pip install virtualenvwrapper
.. and then try this:
mkvirtualenv <your_env> -p /usr/local/bin/python3
Where homebrew sticks python is different from where your system has it. You can run the following to see what I'm talking about:
which python
which python3

Resources