Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Module installed using pip, but not found in python

Installed calplot:

$ pip install calplot
Requirement already satisfied: calplot in /home/lamy/.local/lib/python3.10/site-packages (0.1.7.5)
Requirement already satisfied: matplotlib in /home/lamy/.local/lib/python3.10/site-packages (from calplot) (3.7.1)
Requirement already satisfied: numpy in /home/lamy/.local/lib/python3.10/site-packages (from calplot) (1.24.2)
Requirement already satisfied: pandas>=1 in /home/lamy/.local/lib/python3.10/site-packages (from calplot) (2.0.0)
Requirement already satisfied: pytz>=2020.1 in /home/lamy/.local/lib/python3.10/site-packages (from pandas>=1->calplot) (2023.3)
Requirement already satisfied: python-dateutil>=2.8.2 in /home/lamy/.local/lib/python3.10/site-packages (from pandas>=1->calplot) (2.8.2)
Requirement already satisfied: tzdata>=2022.1 in /home/lamy/.local/lib/python3.10/site-packages (from pandas>=1->calplot) (2023.3)
Requirement already satisfied: pyparsing>=2.3.1 in /home/lamy/.local/lib/python3.10/site-packages (from matplotlib->calplot) (3.0.9)
Requirement already satisfied: cycler>=0.10 in /home/lamy/.local/lib/python3.10/site-packages (from matplotlib->calplot) (0.11.0)
Requirement already satisfied: kiwisolver>=1.0.1 in /home/lamy/.local/lib/python3.10/site-packages (from matplotlib->calplot) (1.4.4)
Requirement already satisfied: fonttools>=4.22.0 in /home/lamy/.local/lib/python3.10/site-packages (from matplotlib->calplot) (4.39.3)
Requirement already satisfied: pillow>=6.2.0 in /home/lamy/.local/lib/python3.10/site-packages (from matplotlib->calplot) (9.5.0)
Requirement already satisfied: packaging>=20.0 in /home/lamy/.local/lib/python3.10/site-packages (from matplotlib->calplot) (23.0)
Requirement already satisfied: contourpy>=1.0.1 in /home/lamy/.local/lib/python3.10/site-packages (from matplotlib->calplot) (1.0.7)
Requirement already satisfied: six>=1.5 in /home/linuxbrew/.linuxbrew/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas>=1->calplot) (1.16.0)
  • CalPlot.py
import calplot
import numpy as np; np.random.seed(sum(map(ord, 'calplot')))
import pandas as pd
all_days = pd.date_range('1/1/2019', periods=730, freq='D')
days = np.random.choice(all_days, 500)
events = pd.Series(np.random.randn(len(days)), index=days)
calplot.calplot(events)
  • Executing python program:
$ python CalPlot.py 
Traceback (most recent call last):
  File "/home/lamy/Documents/Git/Cs/Architecture/ArchitectureSrc/Hardware/Memory/Harddisk/Backup/Borg/Src/CalPlot.py", line 10, in <module>
    import calplot
ModuleNotFoundError: No module named 'calplot'

Any suggestions?


Edit

type pip
pip is /home/linuxbrew/.linuxbrew/bin/pip
pip is /usr/bin/pip
pip is /bin/pip

$ type python
python is aliased to `python3'
python is /usr/bin/python
python is /bin/python

$ type python3
python3 is /home/linuxbrew/.linuxbrew/bin/python3
python3 is /usr/bin/python3
python3 is /bin/python3

$ python --version
Python 3.11.2

$ pip --version
pip 23.0.1 from /home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/site-packages/pip (python 3.11)
$ python -m pip --version
pip 23.0.1 from /home/linuxbrew/.linuxbrew/Cellar/python@3.11/3.11.2_1/lib/python3.11/site-packages/pip (python 3.11)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The keyword python is usually associated with the default version of python installed on your system. If you are using a Linux distro or Mac, this most likely python 2.7.

It therefore means you probably have two versions of python on your system. In this case you will need to be specific on the version of python associated with the library you installed. SO modify your command:

python3.10 CalPlot.py
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading