Installing packages with pip in command prompt are throwing errors - python

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.

Related

ModuleNotFoundError import seaborn as sns

When I type import seaborn as sns on jupyter and on VScode, it always happens ModuleNotFoundError.
I have already did pip install seaborn in my terminal.
Has someone a solution? Thank you in advance
PS
I have already done install seaborn in terminal
pip install seaborn
Requirement already satisfied: seaborn in c:\python39\lib\site-packages (0.11.1)
Requirement already satisfied: scipy>=1.0 in c:\python39\lib\site-packages (from seaborn) (1.6.3)
Requirement already satisfied: numpy>=1.15 in c:\python39\lib\site-packages (from seaborn) (1.20.3)
Requirement already satisfied: pandas>=0.23 in c:\python39\lib\site-packages (from seaborn) (1.2.4)
Requirement already satisfied: matplotlib>=2.2 in c:\python39\lib\site-packages (from seaborn) (3.4.2)
Requirement already satisfied: pytz>=2017.3 in c:\python39\lib\site-packages (from pandas>=0.23->seaborn) (2021.1)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\python39\lib\site-packages (from pandas>=0.23->seaborn) (2.8.1)
Requirement already satisfied: cycler>=0.10 in c:\python39\lib\site-packages (from matplotlib>=2.2->seaborn) (0.10.0)
Requirement already satisfied: pillow>=6.2.0 in c:\python39\lib\site-packages (from matplotlib>=2.2->seaborn) (8.2.0)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\python39\lib\site-packages (from matplotlib>=2.2->seaborn) (1.3.1)
Requirement already satisfied: pyparsing>=2.2.1 in c:\python39\lib\site-packages (from matplotlib>=2.2->seaborn) (2.4.7)
Requirement already satisfied: six>=1.5 in c:\python39\lib\site-packages (from python-dateutil>=2.7.3->pandas>=0.23->seaborn) (1.16.0)
Numpy and pandas work.
Screen shot
Try
conda install seaborn
or
conda install -c conda-forge seaborn

Cannot run Jupyter notebook directly in the terminal on Mac

I want to run jupyter notebook on my mac using jupyter notebook in the terminal, but if I run this code, it gives me an error:
vlan-2625-10-16-106-253:~ brandon$ jupyter notebook
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 5, in <module>
from notebook.notebookapp import main
ModuleNotFoundError: No module named 'notebook'
But if I use /usr/local/bin/python3.7 -m jupyter notebook, then it works.
I know maybe it's because I have several versions of python on my computer, or it's because the path of jupyter is incorrect, but I don't know how to deal with it.
vlan-2625-10-16-106-253:~ brandon$ which jupyter
/usr/local/bin/jupyter
vlan-2625-10-16-106-253:~ brandon$ which python3
/usr/local/bin/python3
If I tried to uninstall jupyter by brew uninstall jupyter or pip3 uninstall jupyter and then pip3 install jupyter, it still doesn't work.
If I install jupyter again, it shows:
vlan-2625-10-16-106-253:~ brandon$ pip3 install jupyter
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: jupyter in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.0.0)
Requirement already satisfied: notebook in ./Library/Python/3.7/lib/python/site-packages (from jupyter) (6.3.0)
Requirement already satisfied: nbconvert in ./Library/Python/3.7/lib/python/site-packages (from jupyter) (5.6.1)
Requirement already satisfied: qtconsole in ./Library/Python/3.7/lib/python/site-packages (from jupyter) (4.7.6)
Requirement already satisfied: ipykernel in ./Library/Python/3.7/lib/python/site-packages (from jupyter) (5.3.4)
Requirement already satisfied: jupyter-console in ./Library/Python/3.7/lib/python/site-packages (from jupyter) (6.2.0)
Requirement already satisfied: ipywidgets in ./Library/Python/3.7/lib/python/site-packages (from jupyter) (7.5.1)
Requirement already satisfied: jupyter-client in ./Library/Python/3.7/lib/python/site-packages (from ipykernel->jupyter) (6.1.7)
Requirement already satisfied: traitlets>=4.1.0 in ./Library/Python/3.7/lib/python/site-packages (from ipykernel->jupyter) (5.0.0)
Requirement already satisfied: ipython>=5.0.0 in ./Library/Python/3.7/lib/python/site-packages (from ipykernel->jupyter) (7.18.1)
Requirement already satisfied: appnope in ./Library/Python/3.7/lib/python/site-packages (from ipykernel->jupyter) (0.1.0)
Requirement already satisfied: tornado>=4.2 in ./Library/Python/3.7/lib/python/site-packages (from ipykernel->jupyter) (6.1)
Requirement already satisfied: pexpect>4.3 in ./Library/Python/3.7/lib/python/site-packages (from ipython>=5.0.0->ipykernel->jupyter) (4.8.0)
Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in ./Library/Python/3.7/lib/python/site-packages (from ipython>=5.0.0->ipykernel->jupyter) (3.0.7)
Requirement already satisfied: backcall in ./Library/Python/3.7/lib/python/site-packages (from ipython>=5.0.0->ipykernel->jupyter) (0.2.0)
Requirement already satisfied: pickleshare in ./Library/Python/3.7/lib/python/site-packages (from ipython>=5.0.0->ipykernel->jupyter) (0.7.5)
Requirement already satisfied: setuptools>=18.5 in ./Library/Python/3.7/lib/python/site-packages (from ipython>=5.0.0->ipykernel->jupyter) (49.2.0)
Requirement already satisfied: jedi>=0.10 in ./Library/Python/3.7/lib/python/site-packages (from ipython>=5.0.0->ipykernel->jupyter) (0.17.2)
Requirement already satisfied: decorator in ./Library/Python/3.7/lib/python/site-packages (from ipython>=5.0.0->ipykernel->jupyter) (4.4.2)
Requirement already satisfied: pygments in ./Library/Python/3.7/lib/python/site-packages (from ipython>=5.0.0->ipykernel->jupyter) (2.6.1)
Requirement already satisfied: parso<0.8.0,>=0.7.0 in ./Library/Python/3.7/lib/python/site-packages (from jedi>=0.10->ipython>=5.0.0->ipykernel->jupyter) (0.7.1)
Requirement already satisfied: ptyprocess>=0.5 in ./Library/Python/3.7/lib/python/site-packages (from pexpect>4.3->ipython>=5.0.0->ipykernel->jupyter) (0.6.0)
Requirement already satisfied: wcwidth in ./Library/Python/3.7/lib/python/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=5.0.0->ipykernel->jupyter) (0.2.5)
Requirement already satisfied: ipython-genutils in ./Library/Python/3.7/lib/python/site-packages (from traitlets>=4.1.0->ipykernel->jupyter) (0.2.0)
Requirement already satisfied: widgetsnbextension~=3.5.0 in ./Library/Python/3.7/lib/python/site-packages (from ipywidgets->jupyter) (3.5.1)
Requirement already satisfied: nbformat>=4.2.0 in ./Library/Python/3.7/lib/python/site-packages (from ipywidgets->jupyter) (5.0.7)
Requirement already satisfied: jupyter-core in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from nbformat>=4.2.0->ipywidgets->jupyter) (4.7.1)
Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in ./Library/Python/3.7/lib/python/site-packages (from nbformat>=4.2.0->ipywidgets->jupyter) (3.2.0)
Requirement already satisfied: pyrsistent>=0.14.0 in ./Library/Python/3.7/lib/python/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->jupyter) (0.16.0)
Requirement already satisfied: six>=1.11.0 in ./Library/Python/3.7/lib/python/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->jupyter) (1.15.0)
Requirement already satisfied: attrs>=17.4.0 in ./Library/Python/3.7/lib/python/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->jupyter) (20.1.0)
Requirement already satisfied: importlib-metadata in ./Library/Python/3.7/lib/python/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->jupyter) (1.7.0)
Requirement already satisfied: terminado>=0.8.3 in ./Library/Python/3.7/lib/python/site-packages (from notebook->jupyter) (0.8.3)
Requirement already satisfied: Send2Trash>=1.5.0 in ./Library/Python/3.7/lib/python/site-packages (from notebook->jupyter) (1.5.0)
Requirement already satisfied: jinja2 in ./Library/Python/3.7/lib/python/site-packages (from notebook->jupyter) (2.11.2)
Requirement already satisfied: pyzmq>=17 in ./Library/Python/3.7/lib/python/site-packages (from notebook->jupyter) (22.0.3)
Requirement already satisfied: prometheus-client in ./Library/Python/3.7/lib/python/site-packages (from notebook->jupyter) (0.8.0)
Requirement already satisfied: argon2-cffi in ./Library/Python/3.7/lib/python/site-packages (from notebook->jupyter) (20.1.0)
Requirement already satisfied: python-dateutil>=2.1 in ./Library/Python/3.7/lib/python/site-packages (from jupyter-client->ipykernel->jupyter) (2.8.1)
Requirement already satisfied: cffi>=1.0.0 in ./Library/Python/3.7/lib/python/site-packages (from argon2-cffi->notebook->jupyter) (1.14.2)
Requirement already satisfied: pycparser in ./Library/Python/3.7/lib/python/site-packages (from cffi>=1.0.0->argon2-cffi->notebook->jupyter) (2.20)
Requirement already satisfied: zipp>=0.5 in ./Library/Python/3.7/lib/python/site-packages (from importlib-metadata->jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets->jupyter) (3.1.0)
Requirement already satisfied: MarkupSafe>=0.23 in ./Library/Python/3.7/lib/python/site-packages (from jinja2->notebook->jupyter) (1.1.1)
Requirement already satisfied: entrypoints>=0.2.2 in ./Library/Python/3.7/lib/python/site-packages (from nbconvert->jupyter) (0.3)
Requirement already satisfied: mistune<2,>=0.8.1 in ./Library/Python/3.7/lib/python/site-packages (from nbconvert->jupyter) (0.8.4)
Requirement already satisfied: pandocfilters>=1.4.1 in ./Library/Python/3.7/lib/python/site-packages (from nbconvert->jupyter) (1.4.2)
Requirement already satisfied: testpath in ./Library/Python/3.7/lib/python/site-packages (from nbconvert->jupyter) (0.4.4)
Requirement already satisfied: defusedxml in ./Library/Python/3.7/lib/python/site-packages (from nbconvert->jupyter) (0.6.0)
Requirement already satisfied: bleach in ./Library/Python/3.7/lib/python/site-packages (from nbconvert->jupyter) (3.1.5)
Requirement already satisfied: packaging in ./Library/Python/3.7/lib/python/site-packages (from bleach->nbconvert->jupyter) (20.4)
Requirement already satisfied: webencodings in ./Library/Python/3.7/lib/python/site-packages (from bleach->nbconvert->jupyter) (0.5.1)
Requirement already satisfied: pyparsing>=2.0.2 in ./Library/Python/3.7/lib/python/site-packages (from packaging->bleach->nbconvert->jupyter) (2.4.7)
Requirement already satisfied: qtpy in ./Library/Python/3.7/lib/python/site-packages (from qtconsole->jupyter) (1.9.0)
If I want to run .ipynb file in pyCharm, I also receive the same error:
I think it's the same problem as I cannot directly run jupyter notebook in the terminal. This problem has been bothering me a lot and i searched a lot but I still can't figure it out. I wonder if I can change the path of jupyter command? It would be helpful if someone can answer this.
Thanks in advance!
you can check if python.exe is added on path .Environment Variables >>> System variables >>> path.(This is for windows) but i think there should be sth similar.

No module named 'sklearn', but pip and pip3 both show the package exist

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)

No module named seaborn even if I installed it

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.

ModuleNotFoundError: No module named 'matplotlib' even when matplotlib is installed

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

Categories

Resources