Issues importing pandas and matplotlib in anaconda spyder - python

I tried installing pandas and matplotlib using the pip-command in Anaconda prompt
pip install matplotlib and it gave me the following:
Requirement already satisfied: matplotlib in c:\programdata\anaconda3\lib\site-p
ackages (3.1.3)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\
lib\site-packages (from matplotlib) (2.8.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\pr
ogramdata\anaconda3\lib\site-packages (from matplotlib) (2.4.6)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\programdata\anaconda3\lib
\site-packages (from matplotlib) (1.1.0)
Requirement already satisfied: cycler>=0.10 in c:\programdata\anaconda3\lib\site
-packages (from matplotlib) (0.10.0)
Requirement already satisfied: numpy>=1.11 in c:\programdata\anaconda3\lib\site-
packages (from matplotlib) (1.18.1)
Requirement already satisfied: six>=1.5 in c:\programdata\anaconda3\lib\site-pac
kages (from python-dateutil>=2.1->matplotlib) (1.14.0)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-p
ackages (from kiwisolver>=1.0.1->matplotlib) (45.2.0.post20200210)
And when trying to import in Spyder, it says no module found.
What should I do? Thanks in advance.

Make sure your spyder points to your anaconda environment. Currently it is not pointing to your anaconda env that is the reason you are getting this error.

Related

DeprecationWarning when importing Scikit-learn

I'm using JupyterLab.
When importing some packages, or executing some functions from scikit-learn,
very long list of deprecation warnings fill the screen.
I googled about this problem and upgraded the packages (scikit-learn, numpy), but I still get the warnings.
pip install scikit-learn --upgrade
Requirement already satisfied: scikit-learn in c:\users\...\appdata\local\programs\python\python39\lib\site-packages (1.0.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\...\appdata\local\programs\python\python39\lib\site-packages (from scikit-learn) (3.0.0)
Requirement already satisfied: joblib>=0.11 in c:\users\...\appdata\local\programs\python\python39\lib\site-packages (from scikit-learn) (1.1.0)
Requirement already satisfied: numpy>=1.14.6 in c:\users\...\appdata\local\programs\python\python39\lib\site-packages (from scikit-learn) (1.22.1)
Requirement already satisfied: scipy>=1.1.0 in c:\users\...\appdata\local\programs\python\python39\lib\site-packages (from scikit-learn) (1.7.2)
Some say that these are not problems because they are just warnings and not harmful.
But it's very annoying. How can I solve this problem?

Issue of installing tensorflow 1.15 with python 3.7.7

I am trying to install tensorflow 1.15, and it's installed well. When I run again pip install tensorflow==1.15 it shows me the below screen:
C:\Users\Fatima>pip install tensorflow==1.15
Requirement already satisfied: tensorflow==1.15 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (1.15.0)
Requirement already satisfied: tensorflow-estimator==1.15.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.1)
Requirement already satisfied: keras-applications>=1.0.8 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.0.8)
Requirement already satisfied: grpcio>=1.8.6 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.37.1)
Requirement already satisfied: termcolor>=1.1.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.1.0)
Requirement already satisfied: six>=1.10.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.0)
Requirement already satisfied: keras-preprocessing>=1.0.5 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.1.2)
Requirement already satisfied: gast==0.2.2 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.2.2)
Requirement already satisfied: absl-py>=0.7.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.12.0)
Requirement already satisfied: opt-einsum>=2.3.2 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (3.3.0)
Requirement already satisfied: wrapt>=1.11.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.12.1)
Requirement already satisfied: numpy<2.0,>=1.16.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.20.2)
Requirement already satisfied: protobuf>=3.6.1 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (3.15.8)
Requirement already satisfied: astor>=0.6.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.8.1)
Requirement already satisfied: wheel>=0.26 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.36.2)
Requirement already satisfied: tensorboard<1.16.0,>=1.15.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (1.15.0)
Requirement already satisfied: google-pasta>=0.1.6 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorflow==1.15) (0.2.0)
Requirement already satisfied: h5py in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from keras-applications>=1.0.8->tensorflow==1.15) (3.2.1)
Requirement already satisfied: markdown>=2.6.8 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.3.4)
Requirement already satisfied: setuptools>=41.0.0 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (41.2.0)
Requirement already satisfied: werkzeug>=0.11.15 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (1.0.1)
Requirement already satisfied: importlib-metadata in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (4.0.1)
Requirement already satisfied: cached-property in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from h5py->keras-applications>=1.0.8->tensorflow==1.15) (1.5.2)
Requirement already satisfied: typing-extensions>=3.6.4 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.10.0.0)
Requirement already satisfied: zipp>=0.5 in c:\users\Fatima\appdata\local\programs\python\python37\lib\site-packages (from importlib-metadata->markdown>=2.6.8->tensorboard<1.16.0,>=1.15.0->tensorflow==1.15) (3.4.1)
That means that tensorflow is installed, right? The python I am using is V3.7.7
I use Pycharm to run the following code as test:
import tensorflow as tf
print(tf.__version__)
It gives me an error as follows:
Traceback (most recent call last):
File "C:/Python394/for_trials.py", line 1, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
It's like it couldn't identify the tensorflow, or the python is not compatible with Tf1. However, following the guide, that python 3.7 and older are compatible with Tf1.
Could you please help me in solving that issue to install Tf1 ?
thank you
The problem is that tensorflow is well installed in your machine but in which environment? for pycharm to see tensorflow, tensorflow must be installed in the same environment that pycharm uses to execute code. But if for example your pycharm is configured to execute codes in a virtual environment and tensorflow is installed in anaconda, there is has no way it works. So the simple solution that you can do is to change the environment of pycham to the environment where tensorflow is installed
tu change l’interpréteur comme ceci
tu change l’interpréteur comme ceci
tu change l’interpréteur comme ceci

Could not find a version that satisfies the requirement statsmodels.api [ Python ]

When I try pip install statsmodels.api command,
I had these errors
ERROR: Could not find a version that satisfies the requirement statsmodels.api (from versions: none)
ERROR: No matching distribution found for statsmodels.api
Python version is Python 3.8.5
C:\Windows\system32>pip install statsmodels
Requirement already satisfied: statsmodels in c:\python38\lib\site-packages (0.12.0)
Requirement already satisfied: numpy>=1.15 in c:\python38\lib\site-packages (from statsmodels) (1.19.1)
Requirement already satisfied: patsy>=0.5 in c:\python38\lib\site-packages (from statsmodels) (0.5.1)
Requirement already satisfied: pandas>=0.21 in c:\python38\lib\site-packages (from statsmodels) (1.1.2)
Requirement already satisfied: scipy>=1.1 in c:\python38\lib\site-packages (from statsmodels) (1.5.2)
Requirement already satisfied: six in c:\python38\lib\site-packages (from patsy>=0.5->statsmodels) (1.15.0)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\python38\lib\site-packages (from pandas>=0.21->statsmodels) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in c:\python38\lib\site-packages (from pandas>=0.21->statsmodels) (2020.1)
I think you want this:
pip install statsmodels
You're trying to install one submodule of a Python module/package. You have to install the whole package.
If you've already done this, then you already have the statsmodels.api module and don't have to install anything else.
I do not know how you have configured your environments (if you have many). but ensure that you install your package in the correct environment. However, please try the following for me:
conda install -c anaconda statsmodels

pip install fail: Terminal lists most recent attempts of package installation, won't install packages

In an attempt to access and run Matlab code via Jupyter notebook and Python, I tried installing 'matlab_kernal' (w/ typo) and 'matlab_kernel' as suggested by a blog, I didn't realize I needed MatLab, not MatLab Compiler Runtime.
I received the error:
"Collecting matlab_kernal
Could not find a version that satisfies the requirement matlab_kernal (from versions: )
No matching distribution found for matlab_kernal"
As a work around, I found python code on GitHub that calculated the metric I wanted, but the author said I'd need to install 'MPI' from 'mpi4py'.
However, it seems my Terminal is now stuck on my previous installation attempts of 'matlab_kernal'. It lists my previous attempts to install these packages (see all white text above red error message in the attached screen capture).
I'm running: pip 18.1 from /anaconda3/lib/python3.7/site-packages/pip (python 3.7)
I've tried:
pip uninstall 'package'
Terminal restart
laptop restart
Screenshot of Terminal error
Please use:
pip install matlab-kernel
Try with conda as well:
conda install -c pchrapka matlab_kernel
I think you're making a typo with kernal.
I am on py3.7 with pip v19.3.
Output:
$ pip install matlab-kernel
Collecting matlab-kernel
Downloading https://files.pythonhosted.org/packages/64/ad/5f471160ec33e2f0f3586d285cd5e3b6dff51027849f28369d43d1d57fd1/matlab_kernel-0.16.7-py3-none-any.whl
Requirement already satisfied: jupyter-client>=4.4.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from matlab-kernel) (5.3.4)
Collecting metakernel>=0.23.0
Downloading https://files.pythonhosted.org/packages/ad/a9/0cd74cfbc9c4aeb117bdb7fd9ff12c3890be34ef5c77932e00ef4afaca98/metakernel-0.24.3-py2.py3-none-any.whl (208kB)
|████████████████████████████████| 215kB 246kB/s
Collecting wurlitzer>=1.0.2; platform_system != "Windows"
Downloading https://files.pythonhosted.org/packages/24/5e/f3bd8443bfdf96d2f5d10097d301076a9eb55637b7864e52d2d1a4d8c72a/wurlitzer-2.0.0-py2.py3-none-any.whl
Requirement already satisfied: ipython>=4.0.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from matlab-kernel) (7.8.0)
Requirement already satisfied: pyzmq>=13 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (18.1.0)
Requirement already satisfied: tornado>=4.1 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (6.0.3)
Requirement already satisfied: traitlets in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (4.3.3)
Requirement already satisfied: python-dateutil>=2.1 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (2.8.0)
Requirement already satisfied: jupyter-core>=4.6.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jupyter-client>=4.4.0->matlab-kernel) (4.6.0)
Requirement already satisfied: pexpect>=4.2 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from metakernel>=0.23.0->matlab-kernel) (4.7.0)
Collecting portalocker
Downloading https://files.pythonhosted.org/packages/91/db/7bc703c0760df726839e0699b7f78a4d8217fdc9c7fcb1b51b39c5a22a4e/portalocker-1.5.2-py2.py3-none-any.whl
Requirement already satisfied: ipykernel in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from metakernel>=0.23.0->matlab-kernel) (5.1.2)
Collecting ipyparallel
Downloading https://files.pythonhosted.org/packages/3f/82/aaa7a357845a98d4028f27c799f0d3bb2fe55fc1247c73dc712b4ae2344c/ipyparallel-6.2.4-py2.py3-none-any.whl (198kB)
|████████████████████████████████| 204kB 698kB/s
Requirement already satisfied: decorator in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (4.4.0)
Requirement already satisfied: setuptools>=18.5 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (39.0.1)
Requirement already satisfied: pickleshare in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.7.5)
Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (2.0.10)
Requirement already satisfied: jedi>=0.10 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.15.1)
Requirement already satisfied: pygments in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (2.4.2)
Requirement already satisfied: appnope; sys_platform == "darwin" in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.1.0)
Requirement already satisfied: backcall in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from ipython>=4.0.0->matlab-kernel) (0.1.0)
Requirement already satisfied: ipython-genutils in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from traitlets->jupyter-client>=4.4.0->matlab-kernel) (0.2.0)
Requirement already satisfied: six in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from traitlets->jupyter-client>=4.4.0->matlab-kernel) (1.12.0)
Requirement already satisfied: ptyprocess>=0.5 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from pexpect>=4.2->metakernel>=0.23.0->matlab-kernel) (0.6.0)
Requirement already satisfied: wcwidth in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython>=4.0.0->matlab-kernel) (0.1.7)
Requirement already satisfied: parso>=0.5.0 in /Users/siddheshpisal/.pyenv/versions/3.6.7/envs/ori_venv/lib/python3.6/site-packages (from jedi>=0.10->ipython>=4.0.0->matlab-kernel) (0.5.1)
Installing collected packages: portalocker, ipyparallel, metakernel, wurlitzer, matlab-kernel
Successfully installed ipyparallel-6.2.4 matlab-kernel-0.16.7 metakernel-0.24.3 portalocker-1.5.2 wurlitzer-2.0.0
WARNING: You are using pip version 19.3; however, version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
It's a version issue for pip and MacOS
See this thread
terminal error in MacOS from command 'pip install 'package-name':
"Collecting 'package-name'
Could not find a version that satisfies the requirement 'package-name' (from versions: )
No matching distribution found for 'package-name'"
Uninstall pip and reinstall pip in terminal

I cant'g get virtualenvwrapper to inbstall on Ubuntu where it needs to be

I have followed the instructions to the letter on the website. The problem is inconsistency where things end up. When I type:
which virtualenv
I get back
/usr/local/bin/virtualenv
which looks OK to me (I am not a unix expert). But after doing
pip install virtualenvironmentwrapper
I get this:
Requirement already satisfied: virtualenvwrapper in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: virtualenv-clone in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied: stevedore in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied: virtualenv in /usr/local/lib/python2.7/dist-packages (from virtualenvwrapper)
Requirement already satisfied: pbr!=2.1.0,>=2.0.0 in /usr/local/lib/python2.7/dist-packages (from stevedore->virtualenvwrapper)
Requirement already satisfied: six>=1.9.0 in ./.local/lib/python2.7/site-packages (from stevedore->virtualenvwrapper)
What do you do to fix this?
It rurns out warpper is not that much more useful. However, the original problem was never resolved.

Categories