I am using python 3.6.0, when importing the sklearn, it shows No module named 'sklearn'.
But I have installed the package in the interpreter, what can I do?
Thanks!
(env) (base) MacBook:$ pip3 install sklearn
Requirement already satisfied: sklearn in ./env/lib/python3.6/site-packages (0.0)
Requirement already satisfied: scikit-learn in ./env/lib/python3.6/site-packages (from sklearn) (0.23.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in ./env/lib/python3.6/site-packages (from scikit-learn->sklearn) (2.1.0)
Requirement already satisfied: numpy>=1.13.3 in ./env/lib/python3.6/site-packages (from scikit-learn->sklearn) (1.19.1)
Requirement already satisfied: joblib>=0.11 in ./env/lib/python3.6/site-packages (from scikit-learn->sklearn) (0.16.0)
Requirement already satisfied: scipy>=0.19.1 in ./env/lib/python3.6/site-packages (from scikit-learn->sklearn) (1.5.2)
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 have an environment of Anaconda (apart of root) and I'm trying to install this two libraries with no success. I tried:
Install libraries by the environment tools of Anaconda Navigator with
'Multiple Errors Encountered.' error. Could I get more info about it? The options that I saw didn't say anything more.
'Multiple Errors Encountered.'
Install Jupyter with the install option of the apps of Anaconda Navigator with the same error too
'Multiple Errors Encountered.'
Install with conda install jupyter and conda install matplotlib in the console and cd where the environment is located. The console
made its process and it said that both libraries were already
installed. I check it in the libraries list of Anaconda Navigator and
it doesn't appear.
(base) C:\Users...>cd C:\Users\Alvaro\Anaconda3\envs\tensorflow
(base) C:\Users...\Anaconda3\envs\tensorflow>conda install
matplotlib Solving environment: done
All requested packages already installed.
(base) C:\Users\Alvaro\Anaconda3\envs\tensorflow>conda install jupyter
Solving environment: done
All requested packages already installed.
Install with pip install jupyter and pip install matplotlib with the similar result than conda install option.
(base) C:\Users\Alvaro\Anaconda3\envs\tensorflow>pip install jupyter Requirement already satisfied: jupyter in
c:\users\alvaro\anaconda3\lib\site-packages (1.0.0) Requirement
already satisfied: notebook in
c:\users\alvaro\anaconda3\lib\site-packages (from jupyter) (5.5.0)
Requirement already satisfied: qtconsole in
c:\users\alvaro\anaconda3\lib\site-packages (from jupyter) (4.3.1)
Requirement already satisfied: jupyter-console in
c:\users\alvaro\anaconda3\lib\site-packages (from jupyter) (5.2.0)
Requirement already satisfied: nbconvert in
c:\users\alvaro\anaconda3\lib\site-packages (from jupyter) (5.3.1)
Requirement already satisfied: ipykernel in
c:\users\alvaro\anaconda3\lib\site-packages (from jupyter) (4.8.2)
Requirement already satisfied: ipywidgets in
c:\users\alvaro\anaconda3\lib\site-packages (from jupyter) (7.2.1)
Requirement already satisfied: jupyter-client>=5.2.0 in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(5.2.3) Requirement already satisfied: nbformat in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(4.4.0) Requirement already satisfied: ipython-genutils in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(0.2.0) Requirement already satisfied: Send2Trash in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(1.5.0) Requirement already satisfied: traitlets>=4.2.1 in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(4.3.2) Requirement already satisfied: terminado>=0.8.1 in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(0.8.1) Requirement already satisfied: jinja2 in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(2.10) Requirement already satisfied: jupyter-core>=4.4.0 in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(4.4.0) Requirement already satisfied: tornado>=4 in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(5.0.2) Requirement already satisfied: pyzmq>=17 in
c:\users\alvaro\anaconda3\lib\site-packages (from notebook->jupyter)
(17.0.0) Requirement already satisfied: ipython in
c:\users\alvaro\anaconda3\lib\site-packages (from
jupyter-console->jupyter) (6.4.0) Requirement already satisfied:
prompt_toolkit<2.0.0,>=1.0.0 in
c:\users\alvaro\anaconda3\lib\site-packages (from
jupyter-console->jupyter) (1.0.15) Requirement already satisfied:
pygments in c:\users\alvaro\anaconda3\lib\site-packages (from
jupyter-console->jupyter) (2.2.0) Requirement already satisfied:
mistune>=0.7.4 in c:\users\alvaro\anaconda3\lib\site-packages (from
nbconvert->jupyter) (0.8.3) Requirement already satisfied:
entrypoints>=0.2.2 in c:\users\alvaro\anaconda3\lib\site-packages
(from nbconvert->jupyter) (0.2.3) Requirement already satisfied:
bleach in c:\users\alvaro\anaconda3\lib\site-packages (from
nbconvert->jupyter) (2.1.3) Requirement already satisfied:
pandocfilters>=1.4.1 in c:\users\alvaro\anaconda3\lib\site-packages
(from nbconvert->jupyter) (1.4.2) Requirement already satisfied:
testpath in c:\users\alvaro\anaconda3\lib\site-packages (from
nbconvert->jupyter) (0.3.1) Requirement already satisfied:
widgetsnbextension~=3.2.0 in
c:\users\alvaro\anaconda3\lib\site-packages (from ipywidgets->jupyter)
(3.2.1) Requirement already satisfied: python-dateutil>=2.1 in
c:\users\alvaro\anaconda3\lib\site-packages (from
jupyter-client>=5.2.0->notebook->jupyter) (2.7.3) Requirement already
satisfied: jsonschema!=2.5.0,>=2.4 in
c:\users\alvaro\anaconda3\lib\site-packages (from
nbformat->notebook->jupyter) (2.6.0) Requirement already satisfied:
six in c:\users\alvaro\anaconda3\lib\site-packages (from
traitlets>=4.2.1->notebook->jupyter) (1.11.0) Requirement already
satisfied: decorator in c:\users\alvaro\anaconda3\lib\site-packages
(from traitlets>=4.2.1->notebook->jupyter) (4.3.0) Requirement already
satisfied: MarkupSafe>=0.23 in
c:\users\alvaro\anaconda3\lib\site-packages (from
jinja2->notebook->jupyter) (1.0) Requirement already satisfied:
setuptools>=18.5 in c:\users\alvaro\anaconda3\lib\site-packages (from
ipython->jupyter-console->jupyter) (39.1.0) Requirement already
satisfied: simplegeneric>0.8 in
c:\users\alvaro\anaconda3\lib\site-packages (from
ipython->jupyter-console->jupyter) (0.8.1) Requirement already
satisfied: backcall in c:\users\alvaro\anaconda3\lib\site-packages
(from ipython->jupyter-console->jupyter) (0.1.0) Requirement already
satisfied: pickleshare in c:\users\alvaro\anaconda3\lib\site-packages
(from ipython->jupyter-console->jupyter) (0.7.4) Requirement already
satisfied: colorama; sys_platform == "win32" in
c:\users\alvaro\anaconda3\lib\site-packages (from
ipython->jupyter-console->jupyter) (0.3.9) Requirement already
satisfied: jedi>=0.10 in c:\users\alvaro\anaconda3\lib\site-packages
(from ipython->jupyter-console->jupyter) (0.12.0) Requirement already
satisfied: wcwidth in c:\users\alvaro\anaconda3\lib\site-packages
(from prompt_toolkit<2.0.0,>=1.0.0->jupyter-console->jupyter) (0.1.7)
Requirement already satisfied:
html5lib!=1.0b1,!=1.0b2,!=1.0b3,!=1.0b4,!=1.0b5,!=1.0b6,!=1.0b7,!=1.0b8,>=0.99999999pre in c:\users\alvaro\anaconda3\lib\site-packages (from
bleach->nbconvert->jupyter) (1.0.1) Requirement already satisfied:
parso>=0.2.0 in c:\users\alvaro\anaconda3\lib\site-packages (from
jedi>=0.10->ipython->jupyter-console->jupyter) (0.2.0) Requirement
already satisfied: webencodings in
c:\users\alvaro\anaconda3\lib\site-packages (from
html5lib!=1.0b1,!=1.0b2,!=1.0b3,!=1.0b4,!=1.0b5,!=1.0b6,!=1.0b7,!=1.0b8,>=0.99999999pre->bleach->nbconvert->jupyter)
(0.5.1) distributed 1.21.8 requires msgpack, which is not installed.
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade
pip' command.
Install with PyCharm, with the libraries installation function of the interpreter settings of it. It gets also an error to install:
Install packages failed: Installing packages: error occurred.
Details...
I tried to install other libraries with success (sympy, for example), but I didn't achieve it with Jupyter and Matplotlib.
The root environment has this libraries, but I don't know if I could import from there.
How I should to proceed?
Thank you very much
This blog post explains how to install jupyter into a virtualenv (Disclaimer: I didn't come up with it myself):
http://anbasile.github.io/programming/2017/06/25/jupyter-venv/
In summary:
$ python -m venv projectname
$ source projectname/bin/activate
(venv) $ pip install ipykernel
(venv) $ ipython kernel install --user --name=projectname
I seem to have got it probably.
TLDR: You probably installed jupyter in your base (or root in your language) environment.
I have copied over a small snippet of your messages.
Install with conda install jupyter and conda install matplotlib in the console and cd where the environment is located. The console made its process and it said that both libraries were already installed. I check it in the libraries list of Anaconda Navigator and it doesn't appear.
(base) C:\Users...>cd C:\Users\Alvaro\Anaconda3\envs\tensorflow
(base) C:\Users...\Anaconda3\envs\tensorflow>conda install matplotlib Solving environment: done
All requested packages are already installed.
(base) C:\Users\Alvaro\Anaconda3\envs\tensorflow>conda install jupyter Solving environment: done
Now I am assuming that the above packages really got installed properly.
Why I am doubtful.Solving environment: done is not the last line after a package gets installed.
If you see the first line of each of these messages they all begin with base. This indicates that the packages got installed in the base environment, not your `TensorFlow environment.
So you really won't find them in your `TensorFlow environment.
It would help if you also answer my questions in the comments below the question.
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.
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.