When I try to run my python script I get the following error
import matplotlib.pyplot as plt
ModuleNotFoundError: No module named 'matplotlib'
SO I tried to install Matplotlib using
"pip install matplotlib"
Then I get the error
Requirement already satisfied: matplotlib in
c:\users\harla\anaconda2\lib\site-packages
Requirement already satisfied: numpy>=1.7.1 in
c:\users\harla\anaconda2\lib\site-packages (from matplotlib)
Requirement already satisfied: six>=1.10 in
c:\users\harla\anaconda2\lib\site-packages (from matplotlib)
Requirement already satisfied: python-dateutil in
c:\users\harla\anaconda2\lib\site-packages (from matplotlib)
Requirement already satisfied: functools32 in
c:\users\harla\anaconda2\lib\site-packages (from matplotlib)
Requirement already satisfied: pytz in c:\users\harla\anaconda2\lib\site-
packages (from matplotlib)
Requirement already satisfied: cycler>=0.10 in
c:\users\harla\anaconda2\lib\site-packages (from matplotlib)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in
c:\users\harla\anaconda2\lib\site-packages (from matplotlib)
I know I have installed anaconda. I don't want to use Anaconda for this. How do I install the library matplotlib ?
I solved it by removing the environment variable to C:\Users\harla\Anaconda2\Scripts_flag
Not sure if there is a better solution.
Related
I am trying to work with the TimeSynth Python package in my Conda environment. It is not available on the pkgs list or conda-forge list of Conda-supported packages, so I found this post that seems to get around the issue by installing the package in the Conda environment using pip.
I followed the instructions in the accepted answer, however when I do the last step:
.conda/envs/tcl/bin/pip install timesynth
(tcl is the name of my environment)
It says the requirement is already satisfied:
Requirement already satisfied: timesynth in
./.conda/envs/tcl/lib/python3.6/site-packages (0.2.4)
Requirement already satisfied: scipy in
./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.1)
Requirement already satisfied: jitcxde-common==1.4.1 in
./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.1)
Requirement already satisfied: numpy in
./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth)
(1.18.1)
Requirement already satisfied: sympy in
./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.8)
Requirement already satisfied: symengine==0.4 in
./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (0.4.0)
Requirement already satisfied: jitcdde==1.4 in
./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.0)
Requirement already satisfied: jinja2 in
./.conda/envs/tcl/lib/python3.6/site-packages (from
jitcxde-common==1.4.1->timesynth) (3.0.0a1)
Requirement already satisfied: setuptools in
./.local/lib/python3.6/site-packages (from
jitcxde-common==1.4.1->timesynth) (56.2.0)
Requirement already satisfied: MarkupSafe>=1.1 in
./.conda/envs/tcl/lib/python3.6/site-packages (from
jinja2->jitcxde-common==1.4.1->timesynth) (2.0.0)
Requirement already satisfied: mpmath>=0.19 in
./.conda/envs/tcl/lib/python3.6/site-packages (from sympy->timesynth)
(1.2.1)
However when I run a Python script that imports timesynth, it doesn't recognize the module. Any advice?
EDIT:
Per request, here is the start of the file I'm trying to use timesynth in:
import numpy as np
import TimeSynth.timesynth as ts
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()
And the error cites line 2 and states:
ModuleNotFoundError: No module named 'TimeSynth'
Following the TimeSynth library's example, the import statement of OP
import TimeSynth.timesynth as ts
should instead be
import timesynth as ts
I got a problem with seaborn. When I run poetry, the shell said that No module named 'seaborn' even I install it by pip install seaborn:
$ pip install seaborn
Requirement already satisfied: seaborn in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (0.10.0)
Requirement already satisfied: scipy>=1.0.1 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from seaborn) (1.4.1)
Requirement already satisfied: matplotlib>=2.1.2 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from seaborn) (3.2.0)
Requirement already satisfied: pandas>=0.22.0 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from seaborn) (1.0.1)
Requirement already satisfied: numpy>=1.13.3 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from seaborn) (1.18.1)
Requirement already satisfied: cycler>=0.10 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib>=2.1.2->seaborn) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib>=2.1.2->seaborn) (2.4.6)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib>=2.1.2->seaborn) (2.8.1)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from matplotlib>=2.1.2->seaborn) (1.1.0)
Requirement already satisfied: pytz>=2017.2 in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from pandas>=0.22.0->seaborn) (2019.3)
Requirement already satisfied: six in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from cycler>=0.10->matplotlib>=2.1.2->seaborn) (1.14.0)
Requirement already satisfied: setuptools in c:\users\administrator\appdata\local\programs\python\python38-32\lib\site-packages (from kiwisolver>=1.0.1->matplotlib>=2.1.2->seaborn) (41.2.0)
When I check the import as this question: How to import seaborn in Python? (by python -c "import seaborn"), the shell run in about 8 - 10 seconds but nothing appear next.
What is the problem? What should I do to fix it error? Do I install seaborn properly? I'm using Windows, git bash as shell and Python 3.8.2.
If you are using poetry as a dependency manager, you need to install the dependency for the poetry virtual environment.
Just add a line in the pyproject.toml file under the:
[tool.poetry.dependencies]
seaborn = "^0.9.0"
And then run the command poetry install. The next time you run your project, it will have seaborn installed in the environment the project is running.
I can't seem to import matplotlib.
import matplotlib
ModuleNotFoundError: No module named 'matplotlib'
Trying conda list matplotlib give the following output:
# Name Version Build Channel
matplotlib 3.1.1 py37_1 conda-forge
matplotlib-base 3.1.1 py37h2852a4a_1 conda-forge
I tried to install it using pip: pip install matplotlib. It resulted in:
Requirement already satisfied: matplotlib in c:\programdata\anaconda3\envs\tf-gpu\lib\site-packages (3.1.1)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\programdata\anaconda3\envs\tf-gpu\lib\site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: numpy>=1.11 in c:\programdata\anaconda3\envs\tf-gpu\lib\site-packages (from matplotlib) (1.16.5)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\envs\tf-gpu\lib\site-packages (from matplotlib) (2.8.0)
Requirement already satisfied: cycler>=0.10 in c:\programdata\anaconda3\envs\tf-gpu\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\programdata\anaconda3\envs\tf-gpu\lib\site-packages (from matplotlib) (2.4.2)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\envs\tf-gpu\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (41.4.0)
Requirement already satisfied: six>=1.5 in c:\programdata\anaconda3\envs\tf-gpu\lib\site-packages (from python-dateutil>=2.1->matplotlib) (1.12.0)
What should I do?
Edit: I later found that i could import it in my base env. But still can't do it in tf-gpu env
I want to use Toastr, for showing non-blocking notifications in my Flask app. I already installed the package with pip :
sudo pip install Flask-Toastr
Here is the output of the installation
Requirement already satisfied: Flask-Toastr in
/Users/****/.local/lib/python3.7/site-packages (0.5.2)
Requirement already satisfied: Flask in
/Users/****/anaconda3/lib/python3.7/site-packages (from Flask-Toastr)
(1.1.1)
Requirement already satisfied: Jinja2 in
/Users/****/anaconda3/lib/python3.7/site-packages (from Flask-Toastr)
(2.10.1)
Requirement already satisfied: click>=5.1 in
/Users/****/anaconda3/lib/python3.7/site-packages (from
Flask->Flask-Toastr) (7.0)
Requirement already satisfied: Werkzeug>=0.15 in
/Users/****/anaconda3/lib/python3.7/site-packages (from
Flask->Flask-Toastr) (0.15.4)
Requirement already satisfied: itsdangerous>=0.24 in
/Users/****/anaconda3/lib/python3.7/site-packages (from
Flask->Flask-Toastr) (1.1.0)
Requirement already satisfied: MarkupSafe>=0.23 in
/Users/****/anaconda3/lib/python3.7/site-packages (from
Jinja2->Flask-Toastr) (1.1.1)
Here is theimport statement:
from flask_toastr import Toastr
But when I run my script I have this ImportError. How can I fix this? Thank you
Without seeing your import statement I suspect you have used a '-' instead of an underscore in the import statement:
Try this:
from flask_toastr import Toastr
I am trying to install Python packages with pip in command window. However, I am facing the following errors.
C:\Users\sidra aleem>pip install matplotlib
Requirement already satisfied: matplotlib in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (2.2.2)
Requirement already satisfied: pytz in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (2018.3)
Requirement already satisfied: cycler>=0.10 in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (0.10.0)
Requirement already satisfied: six>=1.10 in c:\users\sidra aleem\appdata\roaming\python\python36\site-packages (from matplotlib) (1.11.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (2.2.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (2.7.2)
Requirement already satisfied: numpy>=1.7.1 in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (from matplotlib) (1.14.3+mkl)
Requirement already satisfied: setuptools in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (from kiwisolver>=1.0.1->matplotlib) (28.8.0)
and for numpy
C:\Users\sidra aleem>pip install numpy
Requirement already satisfied: numpy in c:\users\sidra aleem\appdata\local\programs\python\python36\lib\site-packages (1.14.3+mkl)
The version of Python I am using is 3.6.4.on window 10.
Usually this doesn't mean something is wrong. Just check if you can use the packages.
Or you try uninstalling and reinstalling the packages.