Plotting Cumulative Gains Curve in Python (ModuleNotFoundError: No module named 'scikitplot') - python

I am quite new to data science and python. I am trying to plot the cumulative gains curve of a model I have built in Spyder (Python 3.6) using scikitplot. However, it keeps returning the error: ModuleNotFoundError: No module named 'scikitplot'.
See below:
import scikitplot as skplt
Traceback (most recent call last):
File "<ipython-input-17-1b8f6cd7465e>", line 1, in <module>
import scikitplot as skplt
ModuleNotFoundError: No module named 'scikitplot'
I have tried using the following on anaconda prompt:
pip install -U scikit-learn scipy matplotlib
and
pip3 install -U scikit-learn scipy matplotlib
However, neither of these have worked. Results in anaconda prompt:
(base) C:\Users\johndoe>pip install -U scikit-learn scipy matplotlib
Collecting scikit-learn
Downloadinghttps://files.pythonhosted.org/packages/8f/1c/9c1d550068f015685d0fccb1726ace7163bbfe5b1a16bda1dcd28d99cb65/scikit_learn-0.20.0-cp36-cp36m-win_amd64.whl (4.7MB)
100% |████████████████████████████████| 4.8MB 2.7MB/s
Requirement already up-to-date: scipy in c:\programdata\anaconda3\lib\site-
packages (1.1.0)
Collecting matplotlib
Downloadinghttps://files.pythonhosted.org/packages/b1/56/569c83515c10146fd0aa09e086816b12e301d0811048e3354a6e9b77ba9a/matplotlib-3.0.2-cp36-cp36m-win_amd64.whl (8.9MB)
100% |████████████████████████████████| 8.9MB 3.0MB/s
Requirement not upgraded as not directly required: numpy>=1.8.2 in
c:\programdata\anaconda3\lib\site-packages (from scikit-learn) (1.14.3)
Requirement not upgraded as not directly required:
pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in
c:\programdata\anaconda3\lib\site-packages (from matplotlib) (2.2.0)
Requirement not upgraded as not directly required: python-dateutil>=2.1 in
c:\programdata\anaconda3\lib\site-packages (from matplotlib) (2.7.3)
Requirement not upgraded as not directly required: cycler>=0.10 in
c:\programdata\anaconda3\lib\site-packages (from matplotlib) (0.10.0)
Requirement not upgraded as not directly required: kiwisolver>=1.0.1 in
c:\programdata\anaconda3\lib\site-packages (from matplotlib) (1.0.1)
Requirement not upgraded as not directly required: six>=1.5 in
c:\programdata\anaconda3\lib\site-packages (from python-dateutil>=2.1-
>matplotlib) (1.11.0)
Requirement not upgraded as not directly required: setuptools in
c:\programdata\anaconda3\lib\site-packages (from kiwisolver>=1.0.1-
>matplotlib)
(39.1.0)
distributed 1.21.8 requires msgpack, which is not installed.
Installing collected packages: scikit-learn, matplotlib
Found existing installation: scikit-learn 0.19.1
Uninstalling scikit-learn-0.19.1:
Could not install packages due to an EnvironmentError: [WinError 5] Access
is denied: 'c:\\programdata\\anaconda3\\lib\\site-packages\\scikit_learn-
0.19.1-py3.6.egg-info\\dependency_links.txt'
Consider using the `--user` option or check the permissions.
Thanks to anyone who may know what I'm doing wrong.

use this command:
pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --user Scikit-plot

Did you install Matplotlib.
Scikit-plot depends on Scikit-learn and Matplotlib

Related

'ModuleNotFoundError' after installing the packages

I am using a module for a work called cryptography and tried to install it via:
C:\Users\Administrator\Desktop>python -m pip install cryptography
Here is a copy of the cmd window:
Collecting cryptography
Using cached cryptography-3.2-cp38-cp38-win32.whl (1.3 MB)
Requirement already satisfied: six>=1.4.1 in c:\users\administrator\appdata\roaming\python\python38\site-packages (from cryptography) (1.15.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\program files (x86)\python38\lib\site-packages (from cryptography) (1.14.3)
Requirement already satisfied: pycparser in c:\program files (x86)\python38\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography) (2.20)
Installing collected packages: cryptography
Successfully installed cryptography-3.2
Then when I tried using the program it just did not work:
C:\Users\Administrator\Desktop>main.py
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\ape esse\main.py", line 3, in <module>
from cryptography.fernet import Fernet
ModuleNotFoundError: No module named 'cryptography'
It gives the same error, as if not installed, and I don't know what to do.
One of my friends said it was a problem with my python installation but I've already repaired and reinstalled it and it still gives the same error.
I installed it now using
pip install cryptography --no-cache-dir and it worked perfectly fine on python 3.8.5.
so you might want to try it.

ImportError: No module named folium?

I Tried Installing folium with :
pip install folium
And:
conda install -c conda-forge folium
And I Tried Installing Specific Version too But It Still doesn't work. When I Try The Installing Commands Again I Just Get This:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: folium==0.11.0 in /home/rem/.local/lib/python3.8/site-packages
(0.11.0)
Requirement already satisfied: jinja2>=2.9 in /usr/lib/python3/dist-packages (from
folium==0.11.0) (2.10.1)
Requirement already satisfied: branca>=0.3.0 in /home/rem/.local/lib/python3.8/site-packages
(from folium==0.11.0) (0.4.1)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from folium==0.11.0)
(2.22.0)
Requirement already satisfied: numpy in /home/rem/.local/lib/python3.8/site-packages (from
folium==0.11.0) (1.18.5)
Also I Tried:
conda install branca
Or :
pip install branca
And I Still Get This ERROR:
line 1, in <module>
import folium
ImportError: No module named folium
PLEASE HELP!!!
It is always possible to manually download and instaly any pip package using wheelodex site like this:
Go to https://www.wheelodex.org/projects/folium/.
Follow download link on the page above, you'll get folium-0.11.0-py2.py3-none-any.whl file.
Install file using pip like python -m pip install folium-0.11.0-py2.py3-none-any.whl.
You may install other non-working packages too in similar way.

Import error on Google colab after pip install and restarting runtime

I want to use a package (resreg) on Google Colab. I install it in my first cell
!pip install resreg
I get the following output:
Collecting resreg
Downloading https://files.pythonhosted.org/packages/61/74/0b664a8507e15507da5031fd92877d57551a7d362edc8089aa369c340e84/resreg-0.1-py3-none-any.whl
Collecting scikit-learn==0.21.0
Downloading https://files.pythonhosted.org/packages/b7/6c/ec121123c671d980c6969dfc69d0f09e1d7f88d80d373f511e61d773b85c/scikit_learn-0.21.0-cp36-cp36m-manylinux1_x86_64.whl (6.6MB)
|████████████████████████████████| 6.6MB 3.8MB/s
Requirement already satisfied: scipy>=1.0.0 in /usr/local/lib/python3.6/dist-packages (from resreg) (1.4.1)
Requirement already satisfied: pandas>=0.24.0 in /usr/local/lib/python3.6/dist-packages (from resreg) (1.0.5)
Requirement already satisfied: numpy>=1.14.0 in /usr/local/lib/python3.6/dist-packages (from resreg) (1.18.5)
Requirement already satisfied: joblib>=0.11 in /usr/local/lib/python3.6/dist-packages (from scikit-learn==0.21.0->resreg) (0.15.1)
Requirement already satisfied: python-dateutil>=2.6.1 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.24.0->resreg) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.24.0->resreg) (2018.9)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/dist-packages (from python-dateutil>=2.6.1->pandas>=0.24.0->resreg) (1.12.0)
Installing collected packages: scikit-learn, resreg
Found existing installation: scikit-learn 0.22.2.post1
Uninstalling scikit-learn-0.22.2.post1:
Successfully uninstalled scikit-learn-0.22.2.post1
Successfully installed resreg-0.1 scikit-learn-0.21.0
Then I restart the runtime using
">Runtime >Restart Runtime"
When I try to import the package, I get the following error
from sklearn.linear_models import ElasticNet
import resreg
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-be63596e9fde> in <module>()
1 from sklearn.linear_model import ElasticNet
---> 2 import resreg
ModuleNotFoundError: No module named 'resreg'
What could be wrong?
Try the following in different code cells:
[1]
!git clone https://github.com/jafetgado/resreg.git
!cd resreg
[2]
!pip install -e resreg
[3]
import resreg
# ... Rest of your code goes here.
If it doesn't work on the first time try to restart the kernel (go to Runtime -> Restart runtime) before running [3].
One particular thing that's worth noticing when installing resreg is that as it is noted on the stacktrace it is dependent of scikit-learn-0.21.0, and therefore you won't be able to use the new features available on the newest stable release (currently 23.0) and it's new features.
Installing collected packages: scikit-learn, resreg
Found existing installation: scikit-learn 0.22.2.post1
Uninstalling scikit-learn-0.22.2.post1:
Successfully uninstalled scikit-learn-0.22.2.post1
Running setup.py develop for resreg
Successfully installed resreg scikit-learn-0.21.0

Python with Pushover: No module named pushover

I tested a python script to send anythink with Pushover. But I get the error "ImportError: No module named pushover"
My installed Versions:
# pip install python-pushover
Collecting python-pushover
Using cached https://files.pythonhosted.org/packages/6f/3d/144a0137c749bd152c3ab7f4d3ce8fe1455168dab36c2fcd900d3fab16ad/python-pushover-0.4.tar.gz
Requirement already satisfied: requests>=1.0 in /usr/local/lib/python3.5/dist-packages (from python-pushover) (2.21.0)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (2018.11.29)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.5/dist-packages (from requests>=1.0->python-pushover) (2.8)
Installing collected packages: python-pushover
Running setup.py install for python-pushover ... done
Successfully installed python-pushover-0.4
# python -V
Python 2.7.13
# python3 -V
Python 3.5.3
The scriptheader:
#!/usr/bin/env python
import pushover
I have tried with pip(3) to install python-pushover but with no success.
I faced this exact error today. This is due to co-existing of different versions of python in your system.
Do, /usr/bin/python3 if the module was installed for py3 and just /usr/bin/python for py2 before running the script.
Refer Installed module using pip, not found for more.
In my case, you should :
uninstall that package:
pip uninstall pushover
and install the correct package:
pip install python-pushover
And your code will work fine.

Error while installing package thats need XGBOOST

I am trying to install the "MLBox" python package on anaconda (Python 3.6).
This package needs "xgboost" so I download the wheel file from this link and I did a pip install wheel-file. I had no issue with it. But when I use the pip install for installing "mlbox" I have this error:
Collecting pandas==0.20.3 (from mlbox)
Using cached pandas-0.20.3-cp36-cp36m-win_amd64.whl
Requirement already satisfied: joblib==0.11 in c:\users\amira ayadi\anaconda3\lib\site-packages (from mlbox)
Collecting scikit-learn==0.19.0 (from mlbox)
Using cached scikit_learn-0.19.0-cp36-cp36m-win_amd64.whl
Requirement already satisfied: Theano==0.9.0 in c:\users\amira ayadi\anaconda3\lib\site-packages (from mlbox)
Collecting xgboost==0.6a2 (from mlbox)
Using cached xgboost-0.6a2.tar.gz
No files/directories in C:\Users\AMIRAA~1\AppData\Local\Temp\pip-build-6ytmh20a\xgboost\pip-egg-info (from PKG-INFO)
I also tired to install xgboost with anaconda solution (https://anaconda.org/anaconda/py-xgboost)
But same error.
Do you have some ideas?
I am on Windows 10

Categories