Pyserial won't import - python-3.x

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import serial
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'serial'
I have tried uninstalling and the reinstalling using:
sudo pip3 uninstall pyserial
sudo pip3 install pyserial
sudo pip3.7 install pyserial
No joy!
Im on a Mac if it matters.
A workaround would be appreciated.

Related

python does not import module after pip install

can anyone help me figure this one out ??
pip installs the module but python does not find the module after pip install
user#debian:~$ pip install google
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: google in ./.local/lib/python3.10/site-packages (3.0.0)
user#debian:~$ python3.10 -m site
sys.path = [
'/home/user',
'/usr/local/lib/python310.zip',
'/usr/local/lib/python3.10',
'/usr/local/lib/python3.10/lib-dynload',
'/home/user/.local/lib/python3.10/site-packages',
'/usr/local/lib/python3.10/site-packages',
]
USER_BASE: '/home/user/.local' (exists)
USER_SITE: '/home/user/.local/lib/python3.10/site-packages' (exists)
ENABLE_USER_SITE: True
user#debian:~$ python3.10
Python 3.10.0 (default, Sep 11 2022, 13:22:26) [GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import google
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'google'
>>>

unable to use pyodbc on mac

i am trying to use pyodbc to connect to azure sql from python and i am getting this error saying pyodbc module not found although i have it installed as you can see in snippet below:
(apienv) (base) manishshukla#Manishs-MacBook-Pro scriptureApi % pip3 install pyodbc
Collecting pyodbc
Using cached pyodbc-4.0.32-cp39-cp39-macosx_10_9_x86_64.whl (68 kB)
Installing collected packages: pyodbc
Successfully installed pyodbc-4.0.32
(apienv) (base) manishshukla#Manishs-MacBook-Pro scriptureApi % python3
Python 3.8.5 (default, Sep 4 2020, 02:22:02)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyodbc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pyodbc'
>>>

ModuleNotFoundError: No module named 'pandas.compat.numpy' Venv Py3.6.4, pandas 0.220

I'm stuck with a python virtual env installation and particularly pandas.
Pip list:
numpy (1.14.2)
pandas (0.22.0)
pip (9.0.1)
Python 3.6.4 (default, Mar 12 2018, 17:59:42)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/me/tensorflow/lib/python3.6/site-packages/pandas/__init__.py", line 23, in <module>
from pandas.compat.numpy import *
ModuleNotFoundError: No module named 'pandas.compat.numpy'
>>>
You probably have several installations of pandas (using apt and using pip)
Remove all:
sudo apt-get purge python3-pandas
sudo pip3 uninstall pandas
Install using pip3:
sudo pip3 install pandas
Try the following and it should work
python3
>>import pandas

ImportError: No module named 'PyQT5' Ubuntu 16.10

I wanted to do some Python3 Development.
I did:
$ sudo apt-get install python3-pyqt5
But it doesn't work:
python3
$ python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQT5
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'PyQT5'
>>>
You need to pip install it :
pip3 install PyQt5
Even though one often reads "QT", the package name is not "PyQT5" but rather "PyQt5" with a lowercase 't' at the end.

Installing matplotlib for python3 on Ubuntu

I'm running Ubuntu 12.04, and I need to use matpltlib in Python 3.2.3. I successfully installed it using
sudo apt-get install python-matplotlib
But now it works only in Python 2.7, which seems to be the default version:
$ python2
Python 2.7.3 (default, Feb 27 2014, 20:00:17)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>>
But python 3 doesn't work:
$ python3
Python 3.2.3 (default, Feb 27 2014, 21:33:50)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib
>>>
Also, my python command seems to be 'broken':
$ python
bash: /usr/bin/python: No such file or directory
Any help is appreciated!
In case anyone else stumbles upon this, just use
sudo apt-get install python3-matplotlib
There are many packages involved with matplotlib and using apt-get instead of pip this is the officially recommended approach.
if you are in virtualenv
example: workon cv #cv is my virtualenv name
$ workon cv
$ pip install matplotlib

Resources