Pyserial installation troubleshooting - installation

On macOS Monterey:
pip3 install pyserial
import serial returned :
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'serial'
The command:
sudo python3 -m pip install pyserial
solved the serial error. What is the difference? Why did the latter command work (and not the former)?
https://stackoverflow.com/a/63864708/4953146

Related

unable to install pip on python 2.6.6 - lack of dependencies

I'm on Ubuntu 18.04 and using python 2.6.6 that I installed from tgz package from here https://www.python.org/downloads/release/python-266/ using this instruction: https://askubuntu.com/questions/25961/how-do-i-install-a-tar-gz-or-tar-bz2-file. I'm trying to install pip using this instruction https://pip.pypa.io/en/latest/installing/
but when I run
python get-pip.py
I got errors about dependencies:
Traceback (most recent call last): File "get-pip.py", line 28, in
import tempfile File "/usr/local/lib/python2.6/tempfile.py", line 34, in
from random import Random as _Random File "/usr/local/lib/python2.6/random.py", line 47, in
from os import urandom as _urandom ImportError: cannot import name urandom
First it was cannot import name zlib. I installed zlib and now I got about urandom so I guess there might be more that I don't have installed. What's the best way to deal with it?
You could try sudo. If that doesn't work, try stating the python version.
$ sudo python2.6 get-pip.py
I think it is better to install via OS package:
apt install python python-pip python-setuptools

DLVM - pip install error

Trying to pip install on Azure Deep Learning VM is giving this error-
Complete output from command python setup.py egg_info:
ERROR:root:Error parsing
Traceback (most recent call last):
File "/anaconda/envs/py35/lib/python3.5/site-packages/pbr/core.py", line 111, in pbr
attrs = util.cfg_to_args(path, dist.script_args)
File "/anaconda/envs/py35/lib/python3.5/site-packages/pbr/util.py", line 267, in cfg_to_args
wrap_commands(kwargs)
File "/anaconda/envs/py35/lib/python3.5/site-packages/pbr/util.py", line 569, in wrap_commands
cmdclass = ep.resolve()
File "/anaconda/envs/py35/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 2264, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named 'setuptools.command.build_clib'
error in setup command: Error parsing /tmp/pip-build-9ucgxr1d/cliff/setup.cfg: ImportError: No module named 'setuptools.command.build_clib'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9ucgxr1d/cliff/
Given the paths above it appears this is happenning on the Python 3.5 (py35) conda environment on the Linux edition of the Azure Data Science VM (DSVM) and Deep Learning VM (DLVM).
Based on the error message, the general guidance to resolve this is to update the setuptools and then try to install the library.
The commands to do that on the DSVM/DLVM on the global py35 conda environment is:
sudo /anaconda/envs/py35/bin/pip install --upgrade setuptools
sudo /anaconda/envs/py35/bin/pip install <<package name>>
For the root (Python 2.7) environment on the DSVM the commands are:
sudo /anaconda/bin/pip install --upgrade setuptools
sudo /anaconda/bin/pip install <<package name>>
Hope this resolves the issue.

homebrew pip install jupyter error: ImportError: Entry point ('console_scripts', 'pip2') not found

The end goal is to get jupyter notebook working on Mac OSX. Due to some conflicts with mac system python, I went the homebrew route:
brew install python
After homebrew is done installing python (and pip2)
export PATH=/usr/local/bin:/usr/local/sbin:$PATH is added to ~/.zshrc
source ~/.zshrc
Now running pip or pip2 gives the following error:
pip2 install jupyter
Traceback (most recent call last):
File "/usr/local/bin/pip2", line 11, in <module>
load_entry_point('pip==9.0.1', 'console_scripts', 'pip2')()
File "/Users/user1/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 564, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Users/user1/Library/Python/2.7/lib/python/site-packages/pkg_resources/__init__.py", line 2661, in load_entry_point
raise ImportError("Entry point %r not found" % ((group, name),))
ImportError: Entry point ('console_scripts', 'pip2') not found

Not being able to install LinkChecker

I'm having issues installing broken link-checker.
When I do 'sudo pip install LinkChecker' like said in installation, I get following error
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-uBq7xh/LinkChecker/setup.py", line 95, in <module>
import py2app
File "/Library/Python/2.7/site-packages/py2app/__init__.py", line 31, in <module>
__version__ = pkg_resources.require('py2app')[0].version
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 968, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 854, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'macholib>=1.4' distribution was not found and is required by py2app
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-uBq7xh/LinkChecker/
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
The error message you get suggests you fail to meet the dependencies needed for the package you're installing.
Try installing macholib and upgrading pip, as suggested by the log
pip install macholib
pip install --upgrade pip

How can I use jython setup.py install?

I am using a Jython virtualenv where I can install whatever software via pip or via easy_install, but there is a software that is not registered yet and the installation mode via:
[sudo] python setup.py install
and I am trying to do the same with jython:
[sudo] jython setup.py install
So, I am getting these follow errors:
Traceback (most recent call last):
File "setup.py", line 3, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools
I checked and installed jython ez_setup.py again.
I downloaded the yolk and didn't solved too.
My folder:
╭─hudson#hudson-pc ~/jython2.7a1/Lib/site-packages ‹› ‹master*›
╰─$ ls
easy-install.pth setuptools.pth yolk 0.4.3-py2.7.egg README should_dsl-2.0a5-py2.7.egg setuptools-0.6c11-py2.7.egg virtualenv-1.7.2-py2.7.egg
And at the normal(real) environment, without virtualenvs, I got the same erros.
At Python I already installed this software and worked well.
If I enter at Jython Shell and try import setuptools, I got the same erros too:
>>> import setuptools
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named setuptools
>>> import sys
>>> sys.path
['', '/home/hudson/jython2.7a1/Lib', '/home/hudson/__classpath__', '/home/hudson/__pyclasspath__']
Then, I add the site-packages to the sys (It can be a stupid attempt):
>>> sys.path.append('/home/hudson/jython2.7a1/Lib/site-packages')
>>> sys.path
['', '/home/hudson/jython2.7a1/Lib', '/home/hudson/__classpath__', '/home/hudson/__pyclasspath__', '/home/hudson/jython2.7a1/Lib/site-packages']
>>> import setuptools
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named setuptools
Why is not recognizing?
If pip "works" then you could use it to install your software. To try it, run from a directory with setup.py:
$ pip install -e .
If you have a tarball of the package:
$ pip install your_package-0.0.1.tar.gz
pip can install from a git repository, use custom urls from where to get packages, etc.
I've tested it: jython works with virtualenv, distribute (a fork of setuptools), pip. So jython can install a package if it uses setuptools in setup.py.
Basically you need to install the installtool first. To do so see the doc linked below.
install this: http://peak.telecommunity.com/dist/ez_setup.py
(see here:http://www.jython.org/jythonbook/en/1.0/appendixA.html#setuptools)

Resources