Unable to install pyserial - python-3.x

PI3B, Buster.
I have installed both python3 and pip3 but when I use pip3 to install pyserial I get a no module error. The wrong directory is being used. How can I fix it please? volumio#pnbvolumio:~$ sudo python -m pip3 install pyserial /usr/bin/python3: No module named pip3 volumio#pnbvolumio:~$ pip3 --version pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)

Using pip with sudo is not a good idea.
Read more here
Try to install pyserial using this command:
python3 -m pip install pyserial
You can also try to instal it for current user only:
python3 -m pip install pyserial --user
Also consider using virtual environmet to manage multiple environments and hassle free module managing.

Related

how to install latest version of python and pip in arch linux?

My default operating system is ArchLinux and the Python version installed on it is 3.1.
I installed version 3.9 using aur, but I do not know how to systematize this version of Python by default and install pip for it, because when I try to use pip, I get this message:
$ python3.9 -m pip
/usr/bin/python3.9: No module named pip
Pip should be installed normally, and if not, there should be a package for pip, but if you cannot install it for whatever reason, installing pip can be done via the ensurepip module:
python -m ensurepip
Reference the documentation for more information.

pip installs modules for python 2.7

I want to install a module with pip, in my case pydub.
However pip install pydub installs pydub in /home/<user>/.local/lib/python2.7/
So when I run my script
python3 myScript.py
it tells me
ModuleNotFoundError: No module named 'pydub'
How do I get pip to install pydub for 3.x rather than 2.7?
Use pip3 install xxx, or better yet, python3 -m pip install xxx. The problem here is that by default pip is aliased to python2's installation.

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 install not working -- How to install/upgrade PyPi packages with pip v10 and above, using Python?

After upgrading my pip to version 10 using pip3 install --upgrade pip and above I cannot I want to install/upgrade PyPi packages using pip3 install PyPiPackageName as I get the following error:
from pip import main
ImportError: cannot import name main
I wonder how I can install PyPi packages using pip when I'm using new versions of pip? I've seen some people use pyhton3 to do this but doing python3 -m pip install --upgrade pip gave me the following error and I cannot upgrade pip to higher versions:
/usr/bin/python3: No module named pip
Before doing python3 -m pip install --upgrade pip I do python3 -m pip install -U pip and I get the following error:
/usr/bin/python3: No module named pip
So I'm confused on what I need to do to be able to upgrade or install PyPi packages.
In addition to executing the following:
curl https://bootstrap.pypa.io/get-pip.py | python3.6
I also had to make sure python3 is using Python 3.6 otherwise Python 3.5 is used (which does not come with pip by default). So I did the following and things work fine now:
ln -s /usr/bin/python3.6 /usr/local/bin/python3

unable to upgrade pip version 10.0.1 to 18.0 in cmd

I'm trying to upgrade pip but the below command didn't worked out. Currently, I have pip version 10.0.1 and I want to upgrade it to 18.0
command I tried in cmd:
python -m pip install --upgrade pip
It's showing:
Attribute Error:module 're' has no attribute 'findall'
There might be something wrong with your pip instalation
try this:
curl bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
My problem is with my version of pip 9.0, upgrading always fails (I run a MacBook with OSX 10.7.5) showing similar message like this example , If any one had an idea...:
$ python -m pip install --upgrade pip
Requirement already up-to-date: pip in /Library/Python/2.7/site-packages
But every time I use pip install, is this:
$ pip install lxml
Collecting lxml
Could not fetch URL https://pypi.python.org/simple/lxml/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:645) - skipping
Could not find a version that satisfies the requirement lxml (from versions: )
No matching distribution found for lxml
Make sure you have exited python and you are back in main Anaconda terminal. Press
exit
to leave python and then run this code
python -m pip install --upgrade pip
or run the commands below;
conda config --add channels conda-forge
conda update pip
If you are in windows and using virtual env then use
(virtual env) c/path>easy_install -U pip
this will update pip inside the virtual env and if you do it outside of virtual env then it should also work there as well.
this will update pip 18.0 in virtual env and if you do it outside of virtual env then it should also work there as well.
python -m pip install --upgrade pip 18.0

Resources