Scikit-learn tutorial documentation location - python

I have scikit-learn 0.16.1 installed on Ubuntu 14.04 and am working through the tutorial. SKL was installed with all default configuration. The tutorial states
The source of this tutorial can be found within your scikit-learn folder:
scikit-learn/doc/tutorial/text_analytics/
I've used find on my entire drive and there is no "tutorial" folder. Not anywhere. Anybody know where these files are really installed?

Finding the package contents
Where the packages are installed depends on how you installed scikit-learn
If you used Ubuntu's package system via
sudo apt-get install python-sklearn python-sklearn-doc
(you often need the doc package to get the accompanying documentation), then the tutorial is simply missing. The doc/-folder it is not contained in the python-sklearn-doc-package. See the bug report.
You can find out the contents of the package via
dpkg-query --listfiles python-sklearn-doc
If you used the Python Package Index to install it via
pip install --user --install-option="--prefix=" -U scikit-learn
, then the installation should be at $HOME/.local/lib/python2.7/site-packages/sklearn. (as also of pip show -f scikit-learn) But a
find . | grep -i tutorial
did not find any tutorial/-folder.
If you installed it from source, consider reinstalling via pip, as the warning states that
Warning
Packages installed with the python setup.py install command cannot be
uninstalled nor upgraded by pip later. To properly uninstall
scikit-learn in that case it is necessary to delete the sklearn folder
from your Python site-packages directory.
Solution
A solution would be to use the source. Either download the master file or do it via git:
git clone https://github.com/scikit-learn/scikit-learn.git
The git archive is more than 60 MiB, so you might want to prefer the master zip.

Related

A question about pip install vs python setup.py install

What is the main difference in installing a python package by pip install and python setup.py install using the file from GitHub repository?
From what I understand right now, I kinda have the feeling that using the second option you will install the repo in some sort of developer mode where you can do changes by directly operating in the files cloned by git repo. Is this correct? I would like to find out a proper explanation of this.

Download Python library from Github with Anaconda

I am looking to download a Python library (specifically this one) from GitHub.
I had already downloaded it using pip install espnff but it appears changes have been made to it and the only way to get the updated version is through GitHub. I should also mention that I use Python with the Anaconda distribution, if that affects anything.
How do I download and update what I already have?
First, you should make sure that pip actually uses you anaconda python distribution, and not e.g. the one that comes as default on your OS. You can use which pip to do that.
After that, it is as easy as
pip install espnff --upgrade
If the latest changes have not yet been made available on pip, you could also try to install it manually from source. Taken from the repository you linked:
git clone https://github.com/rbarton65/espnff
cd espnff
python setup.py install
To make sure that you're installing the latest version available, you should use git pull to fetch and merge the latest changes before installing.
On some occasions, you might also have to delete the existing build directory first, or use
python setup.py build --force
python setup.py install

Tensorflow: Installing from source - ImportError: No module named pywrap_tensorflow_internal

Using machine Ubuntu 16.04.3 LTS and followed the steps defined in the documentation here. I'm only building for CPU.
I've managed to follow all the steps successfully until I reach the sectionInstall the pip package which states that:
Invoke pip install to install that pip package. The filename of the .whl file depends on your platform. For example, the following command will install the pip package
for TensorFlow 1.2.1 on Linux:
$ sudo pip install /tmp/tensorflow_pkg/tensorflow-1.2.1-py2-none-any.whl
Problem 1: However, I've not been able to find any .whl file. Where can I find this file?
Problem 2: When I try to import tensorflow, I get the following error:
ImportError: No module named pywrap_tensorflow_internal
Problem 3: If I try to import tensorflow from any other directory, I receive the error
ImportError: No module named tensorflow
It seems it can find the path to the tensorflow. How do i change that?
It seems that some issues has happened in your pip that sometimes they are hard to find, because original pip is system-wide, which can cause some unexpected such as dependency issues, etc.
It is good idea to use Anaconda. It is a python data science platform. It can be deemed as a large py package extendable bundle with a python virtual environment tool called conda. You can create many isolated python environments with installing and updating py packages you need. Almost packages which can be found in PyPI using pip can also be found in Anaconda.
You can also use pip to install packages that anaconda do not contains for even pip is one package in it. All environments and packages are in your /home/(..user..)directory if you install without sudo as default.
For example (no worry about package dependancy):
[chain#ChainFedora Project]$ conda install tensorflow
Fetching package metadata .........
Solving package specifications: .
Package plan for installation in environment /home/chain/anaconda3:
The following NEW packages will be INSTALLED:
backports.weakref: 1.0rc1-py36_0
libprotobuf: 3.2.0-0
markdown: 2.6.8-py36_0
protobuf: 3.2.0-py36_0
tensorflow: 1.2.1-py36_0
Proceed ([y]/n)?
Very easy to get started with conda cheat sheet

Installing scikit-learn 0.15 (Python)

I'm currently using scikit-learn 0.14.1, which I installed using pip. I'm running Python version 2.7.6 (64 bit), using Canopy Enthought as my IDE. My operating system is OSX 10.9.2
Currently, I am trying to install scikit-learn 0.15. I cloned the repository into my home directory, cd'ed into it, and typed 'python setup.py install' into the command line.
I got an error saying:
error: could not delete '/Users/*****/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/sklearn/__check_build/__init__.py': Permission denied
Anyone have any advice on how I should go about installing scikit-learn 0.15? Should I have cloned the directory into /Users/*****/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/ ?
Thanks so much!
A way of installing many python packages, amongst which scikit-learn, without needing root priviledges is to install it locally
python setup.py install --user
which will write information to ~/.local.
A second option is
python setup.py develop
which will compile in place and place a symbolic link in /Users/*****/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/. You may have to sudo and you may have to delete the old sklearn.
A third, more explicit way of doing this is to place the symbolic link yourself, which will require surgical, but very localized use of sudo for placing the link and removing the old scikit learn.
Assuming you cloned into ~/scikit-learn/
cd ~/scikit-learn
make in
cd /Users/*****/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/
sudo mv sklearn sklearn_
sudo ln -s ~/scikit-learn/sklearn sklearn
More detailed information on the website about installing in general and installing the bleeding edge

How to use Python Pip install software, to pull packages from Github?

I'm trying to install a package from Github, using Pip, using the following syntax
pip install -e git+https://github.com/facebook/python-sdk.git#egg=FacebookSDK
and getting the error "cannot find command git". This Question has (unchecked) answers saying that Git needs to be installed on the system. However, this Answer states that "Git, Subversion, Bazaar and Mercurial are all supported" by Pip.
The Pip documentation also says it has "Native support for other version control systems (Git, Mercurial and Bazaar)".
So how do I install this package with Pip? I really don't want to install Git on my VPS. Or are there any non-Pip tools, for just pulling files from repositories (without doing a full Git install)?
Update - so I bit the bullet, and installed Git on my VPS. Pip still wasn't able to grab the package, but it was giving a different set of errors, so - progress. :) I finally did
git clone http://github.com/facebook/python-sdk.git
(note the http, not https), and manage to download the package, then just installed it manually.
If I'm not mistaken, you would need the git client to be install on your machine. In the event that you don't have git installed, try this:
pip install https://github.com/facebook/python-sdk/zipball/master
or
pip install https://github.com/facebook/python-sdk/tarball/master
You need to install the git-core, since the git:// protocol isn't associated with anything.
sudo apt-get install git-core
For Windows or none git users:
I first download and unpack the file.
Then in the python directory going to \Scripts
Starting here the command prompt (shift + rigth-click)
pip install C:\Theano-master
*# replace Theano-master with the path to your directory of your package
This morning, when I run python pip to install a pcakge from git has problems.
pip install git+https://github.com/gumblex/zhconv.git#egg=zhconv
Firstly get error msg:
ERROR: Cannot find command 'git' - do you have 'git' installed and in your PATH?
Try pip install git
ERROR: Could not find a version that satisfies the requirement git
ERROR: No matching distribution found for git
When I find this question,tried answers from #Mridang Agarwalla not work for first one; for second cmd, there was "time out" to git site.
But when trying answer from #Martijn van Wezel, it is very successfully. Thanks! #Martijn van Wezel
My trying is:
download the Zip file i need from Git page and extract it to a folder.
https://github.com/gumblex/zhconv
extract the ZIP to my local folder: D:\gitPackageforinstall\zhconv
Then success by below cmd.
pip install D:\gitPackageforinstall\zhconv
Hope this could be a reference to others as an update for 20210419
I'm learning about PostgreSQL and had to install the windows version. It was suggested to use git+, and I was running to the same issues that John C was experiencing.
Martijn above recommended unpacking and downloading. That is also what the creators of win-psycopg suggested. So I thought I'd share their method for installing into a Virtual Environment.
Thank you stickpeople:
http://www.stickpeople.com/projects/python/win-psycopg/
To install into a virtual env:

Categories