Could not find a version that satisfies the requirement statsmodels.api [ Python ] - 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

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?

Issues importing pandas and matplotlib in anaconda spyder

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.

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

“ImportError: No module named boto3” on mac

I am trying a deployment script, which will need to import boto3, when I run the script, it give me error message:
ImportError: No module named boto3
then I ran:
pip install boto3
it returns:
Requirement already satisfied: boto3 in /usr/local/lib/python3.7/site-packages (1.9.228)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.9.4)
Requirement already satisfied: s3transfer<0.3.0,>=0.2.0 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.2.1)
Requirement already satisfied: botocore<1.13.0,>=1.12.228 in /usr/local/lib/python3.7/site-packages (from boto3) (1.12.228)
Requirement already satisfied: docutils<0.16,>=0.10 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (0.14)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1; python_version >= "2.7" in /usr/local/lib/python3.7/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (2.8.0)
Requirement already satisfied: urllib3<1.26,>=1.20; python_version >= "3.4" in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from botocore<1.13.0,>=1.12.228->boto3) (1.25.3)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/site-packages (from python-dateutil<3.0.0,>=2.1; python_version >= "2.7"->botocore<1.13.0,>=1.12.228->boto3) (1.12.0)
I ran pip3 install boto3, still it gave the same output as above.
then I ran the deployment script, the same errors with complaining
ImportError: No module named boto3
Any ideas where goes wrong?
I'm using mac 10.14.6 version.
Requirement already satisfied: boto3 in /usr/local/lib/python3.7/site-packages (1.9.228)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages (from boto3) (0.9.4)
Make sure that /usr/local/lib/python3.7/site-packages and /Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages are in the path.
Use the below code to temporarily append it to the path.:
import sys
print(sys.path)
sys.path.append('/usr/local/lib/python3.7/site-packages')
sys.path.append('/Users/xiaoyiliu/Library/Python/3.7/lib/python/site-packages')
print(sys.path)
import boto3
Make sure you have installed your package with the pip associated with a particular python, use:
python -m pip install <pkg>
instead of:
pip install <pkg>

Can't either install or uninstall package via Anaconda

I've been trying to install the openquake.engine package via Anaconda. At first I got multiple errors one after another but [I thought] I fixed everything (pls see the P.S. for errors and solutions to them). Now, after going through all that, I get the following error:
openquake-engine 3.3.2 has requirement numpy<1.15,>=1.14, but you'll have numpy 1.16.2 which is incompatible.
osmnx 0.9 has requirement networkx>=2.2, but you'll have networkx 2.1 which is incompatible.
osmnx 0.9 has requirement requests>=2.21, but you'll have requests 2.20.1 which is incompatible.
First, it does not make sense as in PyPi the last released date of the package is Jan 22, 2019! Then here is the main issue: when I use conda list, openquake.engine is not listed!!
But when I runpip install openquake.engine, I get the following:
Requirement already satisfied: openquake.engine in c:\users\ameri19\appdata\roaming\python\python36\site-packages (3.3.2)
Requirement already satisfied: numpy<1.15,>=1.14 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (1.14.6)
Requirement already satisfied: nose<1.4,>=1.3 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (1.3.7)
Requirement already satisfied: requests<2.21,>=2.20 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (2.20.1)
Requirement already satisfied: scipy<1.2,>=1.0.1 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (1.1.0)
Requirement already satisfied: docutils<0.15,>=0.11 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (0.14)
Requirement already satisfied: mock<2.1,>=1.0 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (2.0.0)
Requirement already satisfied: rtree==0.8.3 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (0.8.3)
Requirement already satisfied: decorator>=4.3 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (4.3.2)
Requirement already satisfied: shapely<1.7,>=1.3 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (1.6.4.post2)
Requirement already satisfied: matplotlib<2.3,>=1.5 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (2.2.4)
Requirement already satisfied: pyshp==1.2.3 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (1.2.3)
Requirement already satisfied: setuptools in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (40.8.0)
Requirement already satisfied: h5py<2.9,>=2.8 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from openquake.engine) (2.8.0)
Requirement already satisfied: pyzmq<18.0 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (17.1.3)
Requirement already satisfied: django<2.1,>=1.10 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (2.0.13)
Requirement already satisfied: psutil<5.5,>=2.0 in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (5.4.3)
Requirement already satisfied: PyYAML in c:\programdata\anaconda3\lib\site-packages (from openquake.engine) (3.12)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\programdata\anaconda3\lib\site-packages (from requests<2.21,>=2.20->openquake.engine) (1.22)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\lib\site-packages (from requests<2.21,>=2.20->openquake.engine) (2018.11.29)
Requirement already satisfied: idna<2.8,>=2.5 in c:\programdata\anaconda3\lib\site-packages (from requests<2.21,>=2.20->openquake.engine) (2.6)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\programdata\anaconda3\lib\site-packages (from requests<2.21,>=2.20->openquake.engine) (3.0.4)
Requirement already satisfied: pbr>=0.11 in c:\users\ameri19\appdata\roaming\python\python36\site-packages (from mock<2.1,>=1.0->openquake.engine) (5.1.3)
Requirement already satisfied: six>=1.9 in c:\programdata\anaconda3\lib\site-packages (from mock<2.1,>=1.0->openquake.engine) (1.11.0)
Requirement already satisfied: python-dateutil>=2.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (2.6.1)
Requirement already satisfied: pytz in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (2017.3)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (1.0.1)
Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (2.2.0)
Requirement already satisfied: cycler>=0.10 in c:\programdata\anaconda3\lib\site-packages (from matplotlib<2.3,>=1.5->openquake.engine) (0.10.0)
Then, when I use pip uninstall openquake.engine, I get the following error:
Exception:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 179, in main
status = self.run(options, args)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\commands\uninstall.py", line 75, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 816, in uninstall
uninstalled_pathset = UninstallPathSet.from_dist(dist)
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 496, in from_dist
for path in uninstallation_paths(dist):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 50, in unique
for item in fn(*args, **kw):
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 67, in uninstallation_paths
r = csv.reader(FakeFile(dist.get_metadata_lines('RECORD')))
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1414, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "C:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 1411, in get_metadata
return value.decode('utf-8') if six.PY3 else value
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 152595: invalid continuation byte
Also, after I run pip install openquake.engine, it seems it automatically uninstalls the latest version of numpy and installs a former version that is compatible to openquake.engine, but then when I run something like from openquake.hazardlib import const I get the following error:
could not find or load spatialindex_c.dll
which is error #3 in the P.S. section below! And after I run conda install -c conda-forge osmnx to solve the issue, I start getting this error:
Something is wrong with the numpy installation. While importing we detected an older version of numpy in ['C:\\ProgramData\\Anaconda3\\lib\\site-packages\\numpy']. One method of fixing this is to repeatedly uninstall numpy until none is found, then reinstall this version.
So it seems like a deadlock! Dose anyone know how I could fix this?
P.S. Errors and Solutions:
error #1: (occurred while using 'pip install openquake.engine' in Anaconda)
Command "python setup.py egg_info" failed with error code 1 in C:\temp\pip-install-mco6__1j\shapely\
Solution to error #1:
conda install -c conda-forge shapely
error #2: (occurred while using 'pip install openquake.engine' in Anaconda, EVEN THOUGH I was running the prompt as administrator!!)
PermissionError: [WinError 5] Access is denied
Solution to error #2:
pip install openquake.engine --user
Here, I got multiple warnings, but they did not seem to be that important! I tried import epenquake.engine in the Spyder and as it worked like a charm I thought it is all good (but it was not; see error #3)!
error #3: (occured while running from openquake.hazardlib import const)
could not find or load spatialindex_c.dll
Solution to error #3:
conda install -c conda-forge osmnx

Categories