How to install and use scikit-learn in Python
up vote
1
down vote
favorite
Note upfront: I tried following suggestions in other threads, but so far, haven't found anything that helps (1, 2)
I received a pandas file that I would like to run on my machine. In the beginning, the code references the sklearn package.
import re
from sklearn.decomposition import FactorAnalysis
from sklearn import svm
I do, however, get the following error when running this cell:
ModuleNotFoundError: No module named 'sklearn.decomposition'
I do have the scikit_learn-0.19.0-py3.6.egg-info and sklearn packages in my Python directory, so I'm not sure why it doesn't work. I tried reinstalling it, but both...
conda install scikit-learn
...and...
pip install scikit-learn
...don't work. The former crashes my Python (pop-up window telling my it has crashed), the latter produces a bunch of error messages:
>pip install scikit-learn
Requirement already satisfied: scikit-learn in c:programdata...libsite-packages
Exception:
Traceback (most recent call last):
File "C:ProgramData...libsite-packagespipbasecommand.py", line 215, in main
status = self.run(options, args)
File "C:ProgramData...libsite-packagespipcommandsinstall.py", line 335, in run
wb.build(autobuilding=True)
File "C:ProgramData...libsite-packagespipwheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:ProgramData...libsite-packagespipreqreq_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:ProgramData...libsite-packagespipreqreq_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:ProgramData...libsite-packagespiputilspackaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:ProgramData...libemailfeedparser.py", line 175, in feed
self._input.push(data)
File "C:ProgramData...libemailfeedparser.py", line 103, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Any idea how I can get it to work? Thanks
python pandas scikit-learn pip miniconda
add a comment |
up vote
1
down vote
favorite
Note upfront: I tried following suggestions in other threads, but so far, haven't found anything that helps (1, 2)
I received a pandas file that I would like to run on my machine. In the beginning, the code references the sklearn package.
import re
from sklearn.decomposition import FactorAnalysis
from sklearn import svm
I do, however, get the following error when running this cell:
ModuleNotFoundError: No module named 'sklearn.decomposition'
I do have the scikit_learn-0.19.0-py3.6.egg-info and sklearn packages in my Python directory, so I'm not sure why it doesn't work. I tried reinstalling it, but both...
conda install scikit-learn
...and...
pip install scikit-learn
...don't work. The former crashes my Python (pop-up window telling my it has crashed), the latter produces a bunch of error messages:
>pip install scikit-learn
Requirement already satisfied: scikit-learn in c:programdata...libsite-packages
Exception:
Traceback (most recent call last):
File "C:ProgramData...libsite-packagespipbasecommand.py", line 215, in main
status = self.run(options, args)
File "C:ProgramData...libsite-packagespipcommandsinstall.py", line 335, in run
wb.build(autobuilding=True)
File "C:ProgramData...libsite-packagespipwheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:ProgramData...libsite-packagespipreqreq_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:ProgramData...libsite-packagespipreqreq_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:ProgramData...libsite-packagespiputilspackaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:ProgramData...libemailfeedparser.py", line 175, in feed
self._input.push(data)
File "C:ProgramData...libemailfeedparser.py", line 103, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Any idea how I can get it to work? Thanks
python pandas scikit-learn pip miniconda
1
Have you tried to pip unistall it and reinstall it ?
– nsaura
Nov 7 at 21:38
Uninstalling doesn't seem to work, I get multiple error messages. I first have to confirm, that I want to proceed with the de-installation, but then I receive this: PermissionError: [WinError 5] Access is denied: 'c:\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info' -> 'C:\Users\...\pip-0k0t65vd-uninstall\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info'
– Berbatov
Nov 7 at 21:39
How aboutpip install --user scikit-learn
– Paulo Scardine
Nov 7 at 21:44
This tells me the requirement is already satisfied in [path to directory]
– Berbatov
Nov 7 at 21:50
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Note upfront: I tried following suggestions in other threads, but so far, haven't found anything that helps (1, 2)
I received a pandas file that I would like to run on my machine. In the beginning, the code references the sklearn package.
import re
from sklearn.decomposition import FactorAnalysis
from sklearn import svm
I do, however, get the following error when running this cell:
ModuleNotFoundError: No module named 'sklearn.decomposition'
I do have the scikit_learn-0.19.0-py3.6.egg-info and sklearn packages in my Python directory, so I'm not sure why it doesn't work. I tried reinstalling it, but both...
conda install scikit-learn
...and...
pip install scikit-learn
...don't work. The former crashes my Python (pop-up window telling my it has crashed), the latter produces a bunch of error messages:
>pip install scikit-learn
Requirement already satisfied: scikit-learn in c:programdata...libsite-packages
Exception:
Traceback (most recent call last):
File "C:ProgramData...libsite-packagespipbasecommand.py", line 215, in main
status = self.run(options, args)
File "C:ProgramData...libsite-packagespipcommandsinstall.py", line 335, in run
wb.build(autobuilding=True)
File "C:ProgramData...libsite-packagespipwheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:ProgramData...libsite-packagespipreqreq_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:ProgramData...libsite-packagespipreqreq_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:ProgramData...libsite-packagespiputilspackaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:ProgramData...libemailfeedparser.py", line 175, in feed
self._input.push(data)
File "C:ProgramData...libemailfeedparser.py", line 103, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Any idea how I can get it to work? Thanks
python pandas scikit-learn pip miniconda
Note upfront: I tried following suggestions in other threads, but so far, haven't found anything that helps (1, 2)
I received a pandas file that I would like to run on my machine. In the beginning, the code references the sklearn package.
import re
from sklearn.decomposition import FactorAnalysis
from sklearn import svm
I do, however, get the following error when running this cell:
ModuleNotFoundError: No module named 'sklearn.decomposition'
I do have the scikit_learn-0.19.0-py3.6.egg-info and sklearn packages in my Python directory, so I'm not sure why it doesn't work. I tried reinstalling it, but both...
conda install scikit-learn
...and...
pip install scikit-learn
...don't work. The former crashes my Python (pop-up window telling my it has crashed), the latter produces a bunch of error messages:
>pip install scikit-learn
Requirement already satisfied: scikit-learn in c:programdata...libsite-packages
Exception:
Traceback (most recent call last):
File "C:ProgramData...libsite-packagespipbasecommand.py", line 215, in main
status = self.run(options, args)
File "C:ProgramData...libsite-packagespipcommandsinstall.py", line 335, in run
wb.build(autobuilding=True)
File "C:ProgramData...libsite-packagespipwheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:ProgramData...libsite-packagespipreqreq_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:ProgramData...libsite-packagespipreqreq_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:ProgramData...libsite-packagespiputilspackaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:ProgramData...libemailfeedparser.py", line 175, in feed
self._input.push(data)
File "C:ProgramData...libemailfeedparser.py", line 103, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Any idea how I can get it to work? Thanks
python pandas scikit-learn pip miniconda
python pandas scikit-learn pip miniconda
asked Nov 7 at 21:35
Berbatov
1221110
1221110
1
Have you tried to pip unistall it and reinstall it ?
– nsaura
Nov 7 at 21:38
Uninstalling doesn't seem to work, I get multiple error messages. I first have to confirm, that I want to proceed with the de-installation, but then I receive this: PermissionError: [WinError 5] Access is denied: 'c:\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info' -> 'C:\Users\...\pip-0k0t65vd-uninstall\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info'
– Berbatov
Nov 7 at 21:39
How aboutpip install --user scikit-learn
– Paulo Scardine
Nov 7 at 21:44
This tells me the requirement is already satisfied in [path to directory]
– Berbatov
Nov 7 at 21:50
add a comment |
1
Have you tried to pip unistall it and reinstall it ?
– nsaura
Nov 7 at 21:38
Uninstalling doesn't seem to work, I get multiple error messages. I first have to confirm, that I want to proceed with the de-installation, but then I receive this: PermissionError: [WinError 5] Access is denied: 'c:\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info' -> 'C:\Users\...\pip-0k0t65vd-uninstall\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info'
– Berbatov
Nov 7 at 21:39
How aboutpip install --user scikit-learn
– Paulo Scardine
Nov 7 at 21:44
This tells me the requirement is already satisfied in [path to directory]
– Berbatov
Nov 7 at 21:50
1
1
Have you tried to pip unistall it and reinstall it ?
– nsaura
Nov 7 at 21:38
Have you tried to pip unistall it and reinstall it ?
– nsaura
Nov 7 at 21:38
Uninstalling doesn't seem to work, I get multiple error messages. I first have to confirm, that I want to proceed with the de-installation, but then I receive this: PermissionError: [WinError 5] Access is denied: 'c:\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info' -> 'C:\Users\...\pip-0k0t65vd-uninstall\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info'
– Berbatov
Nov 7 at 21:39
Uninstalling doesn't seem to work, I get multiple error messages. I first have to confirm, that I want to proceed with the de-installation, but then I receive this: PermissionError: [WinError 5] Access is denied: 'c:\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info' -> 'C:\Users\...\pip-0k0t65vd-uninstall\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info'
– Berbatov
Nov 7 at 21:39
How about
pip install --user scikit-learn
– Paulo Scardine
Nov 7 at 21:44
How about
pip install --user scikit-learn
– Paulo Scardine
Nov 7 at 21:44
This tells me the requirement is already satisfied in [path to directory]
– Berbatov
Nov 7 at 21:50
This tells me the requirement is already satisfied in [path to directory]
– Berbatov
Nov 7 at 21:50
add a comment |
3 Answers
3
active
oldest
votes
up vote
2
down vote
Try running that last command to upgrade pip first?
pip install --upgrade pip
And then install scikitlearn afterwards. And possibly try this depending on what version of python you're using in your environment:
pip3 install scikit-learn
And if you getPermissionError: [WinError 5] Access is denied:
try to add the--user
flag
– Paulo Scardine
Nov 7 at 21:51
Upgrading to the new pip worked. Even though it still gave me the old message that I was using the old version: "Successfully installed pip-18.1. You are using pip version 9.0.1...". However, when I try to install scikit-learn now, it tells me "AttributeError: module 'pip' has not attribute 'main'
– Berbatov
Nov 7 at 21:55
Try with sudo before pip install --upgrade pip
– nsaura
Nov 7 at 21:57
You mean typing sudo in front of it? Doesn't seem to work
– Berbatov
Nov 7 at 22:15
Try iterations ofsudo python3 -m pip install sklearn
What doespip --version
output?
– leeym
Nov 7 at 22:38
add a comment |
up vote
1
down vote
accepted
Solved it.
- Managed to roll-back to pip v9 using this thread.
- Uninstalled scikit-learn (which was v0.19). Had to use Admin mode to avoid the PermissionError mentioned before
- Installed it again (which was v0.2)
Code works now, thanks all who contributed.
add a comment |
up vote
0
down vote
If you are on linux...
1). download anaconda https://www.anaconda.com/download/#download
2). go to where the file is downloaded and type bash Anaconda-latest-Linux-x86_64.sh
The new anaconda already comes with scikit-learn installed.
If you need an older version of python like I did you can install that version by typing
conda install python=3.6
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Try running that last command to upgrade pip first?
pip install --upgrade pip
And then install scikitlearn afterwards. And possibly try this depending on what version of python you're using in your environment:
pip3 install scikit-learn
And if you getPermissionError: [WinError 5] Access is denied:
try to add the--user
flag
– Paulo Scardine
Nov 7 at 21:51
Upgrading to the new pip worked. Even though it still gave me the old message that I was using the old version: "Successfully installed pip-18.1. You are using pip version 9.0.1...". However, when I try to install scikit-learn now, it tells me "AttributeError: module 'pip' has not attribute 'main'
– Berbatov
Nov 7 at 21:55
Try with sudo before pip install --upgrade pip
– nsaura
Nov 7 at 21:57
You mean typing sudo in front of it? Doesn't seem to work
– Berbatov
Nov 7 at 22:15
Try iterations ofsudo python3 -m pip install sklearn
What doespip --version
output?
– leeym
Nov 7 at 22:38
add a comment |
up vote
2
down vote
Try running that last command to upgrade pip first?
pip install --upgrade pip
And then install scikitlearn afterwards. And possibly try this depending on what version of python you're using in your environment:
pip3 install scikit-learn
And if you getPermissionError: [WinError 5] Access is denied:
try to add the--user
flag
– Paulo Scardine
Nov 7 at 21:51
Upgrading to the new pip worked. Even though it still gave me the old message that I was using the old version: "Successfully installed pip-18.1. You are using pip version 9.0.1...". However, when I try to install scikit-learn now, it tells me "AttributeError: module 'pip' has not attribute 'main'
– Berbatov
Nov 7 at 21:55
Try with sudo before pip install --upgrade pip
– nsaura
Nov 7 at 21:57
You mean typing sudo in front of it? Doesn't seem to work
– Berbatov
Nov 7 at 22:15
Try iterations ofsudo python3 -m pip install sklearn
What doespip --version
output?
– leeym
Nov 7 at 22:38
add a comment |
up vote
2
down vote
up vote
2
down vote
Try running that last command to upgrade pip first?
pip install --upgrade pip
And then install scikitlearn afterwards. And possibly try this depending on what version of python you're using in your environment:
pip3 install scikit-learn
Try running that last command to upgrade pip first?
pip install --upgrade pip
And then install scikitlearn afterwards. And possibly try this depending on what version of python you're using in your environment:
pip3 install scikit-learn
answered Nov 7 at 21:47
leeym
312213
312213
And if you getPermissionError: [WinError 5] Access is denied:
try to add the--user
flag
– Paulo Scardine
Nov 7 at 21:51
Upgrading to the new pip worked. Even though it still gave me the old message that I was using the old version: "Successfully installed pip-18.1. You are using pip version 9.0.1...". However, when I try to install scikit-learn now, it tells me "AttributeError: module 'pip' has not attribute 'main'
– Berbatov
Nov 7 at 21:55
Try with sudo before pip install --upgrade pip
– nsaura
Nov 7 at 21:57
You mean typing sudo in front of it? Doesn't seem to work
– Berbatov
Nov 7 at 22:15
Try iterations ofsudo python3 -m pip install sklearn
What doespip --version
output?
– leeym
Nov 7 at 22:38
add a comment |
And if you getPermissionError: [WinError 5] Access is denied:
try to add the--user
flag
– Paulo Scardine
Nov 7 at 21:51
Upgrading to the new pip worked. Even though it still gave me the old message that I was using the old version: "Successfully installed pip-18.1. You are using pip version 9.0.1...". However, when I try to install scikit-learn now, it tells me "AttributeError: module 'pip' has not attribute 'main'
– Berbatov
Nov 7 at 21:55
Try with sudo before pip install --upgrade pip
– nsaura
Nov 7 at 21:57
You mean typing sudo in front of it? Doesn't seem to work
– Berbatov
Nov 7 at 22:15
Try iterations ofsudo python3 -m pip install sklearn
What doespip --version
output?
– leeym
Nov 7 at 22:38
And if you get
PermissionError: [WinError 5] Access is denied:
try to add the --user
flag– Paulo Scardine
Nov 7 at 21:51
And if you get
PermissionError: [WinError 5] Access is denied:
try to add the --user
flag– Paulo Scardine
Nov 7 at 21:51
Upgrading to the new pip worked. Even though it still gave me the old message that I was using the old version: "Successfully installed pip-18.1. You are using pip version 9.0.1...". However, when I try to install scikit-learn now, it tells me "AttributeError: module 'pip' has not attribute 'main'
– Berbatov
Nov 7 at 21:55
Upgrading to the new pip worked. Even though it still gave me the old message that I was using the old version: "Successfully installed pip-18.1. You are using pip version 9.0.1...". However, when I try to install scikit-learn now, it tells me "AttributeError: module 'pip' has not attribute 'main'
– Berbatov
Nov 7 at 21:55
Try with sudo before pip install --upgrade pip
– nsaura
Nov 7 at 21:57
Try with sudo before pip install --upgrade pip
– nsaura
Nov 7 at 21:57
You mean typing sudo in front of it? Doesn't seem to work
– Berbatov
Nov 7 at 22:15
You mean typing sudo in front of it? Doesn't seem to work
– Berbatov
Nov 7 at 22:15
Try iterations of
sudo python3 -m pip install sklearn
What does pip --version
output?– leeym
Nov 7 at 22:38
Try iterations of
sudo python3 -m pip install sklearn
What does pip --version
output?– leeym
Nov 7 at 22:38
add a comment |
up vote
1
down vote
accepted
Solved it.
- Managed to roll-back to pip v9 using this thread.
- Uninstalled scikit-learn (which was v0.19). Had to use Admin mode to avoid the PermissionError mentioned before
- Installed it again (which was v0.2)
Code works now, thanks all who contributed.
add a comment |
up vote
1
down vote
accepted
Solved it.
- Managed to roll-back to pip v9 using this thread.
- Uninstalled scikit-learn (which was v0.19). Had to use Admin mode to avoid the PermissionError mentioned before
- Installed it again (which was v0.2)
Code works now, thanks all who contributed.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Solved it.
- Managed to roll-back to pip v9 using this thread.
- Uninstalled scikit-learn (which was v0.19). Had to use Admin mode to avoid the PermissionError mentioned before
- Installed it again (which was v0.2)
Code works now, thanks all who contributed.
Solved it.
- Managed to roll-back to pip v9 using this thread.
- Uninstalled scikit-learn (which was v0.19). Had to use Admin mode to avoid the PermissionError mentioned before
- Installed it again (which was v0.2)
Code works now, thanks all who contributed.
answered Nov 7 at 22:47
Berbatov
1221110
1221110
add a comment |
add a comment |
up vote
0
down vote
If you are on linux...
1). download anaconda https://www.anaconda.com/download/#download
2). go to where the file is downloaded and type bash Anaconda-latest-Linux-x86_64.sh
The new anaconda already comes with scikit-learn installed.
If you need an older version of python like I did you can install that version by typing
conda install python=3.6
add a comment |
up vote
0
down vote
If you are on linux...
1). download anaconda https://www.anaconda.com/download/#download
2). go to where the file is downloaded and type bash Anaconda-latest-Linux-x86_64.sh
The new anaconda already comes with scikit-learn installed.
If you need an older version of python like I did you can install that version by typing
conda install python=3.6
add a comment |
up vote
0
down vote
up vote
0
down vote
If you are on linux...
1). download anaconda https://www.anaconda.com/download/#download
2). go to where the file is downloaded and type bash Anaconda-latest-Linux-x86_64.sh
The new anaconda already comes with scikit-learn installed.
If you need an older version of python like I did you can install that version by typing
conda install python=3.6
If you are on linux...
1). download anaconda https://www.anaconda.com/download/#download
2). go to where the file is downloaded and type bash Anaconda-latest-Linux-x86_64.sh
The new anaconda already comes with scikit-learn installed.
If you need an older version of python like I did you can install that version by typing
conda install python=3.6
answered Nov 10 at 16:52
Matt Elgazar
309
309
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53198192%2fhow-to-install-and-use-scikit-learn-in-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Have you tried to pip unistall it and reinstall it ?
– nsaura
Nov 7 at 21:38
Uninstalling doesn't seem to work, I get multiple error messages. I first have to confirm, that I want to proceed with the de-installation, but then I receive this: PermissionError: [WinError 5] Access is denied: 'c:\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info' -> 'C:\Users\...\pip-0k0t65vd-uninstall\programdata\...\lib\site-packages\scikit_learn-0.19.0-py3.6.egg-info'
– Berbatov
Nov 7 at 21:39
How about
pip install --user scikit-learn
– Paulo Scardine
Nov 7 at 21:44
This tells me the requirement is already satisfied in [path to directory]
– Berbatov
Nov 7 at 21:50