In Mac OSX, I installed Anaconda3 to be the default python interpreter. When I run Weka, the following messages appear in the log:
19:56:28: Started on Friday, 4 May 2018
19:56:29: Python is not available!!
19:56:29: Library "sklearn" is not available
Library "pandas" is not available, minimum version = 0.7.0
It seems there is a conflict here because whereis python
gives me /usr/bin/python
while which python
gives me /anaconda3/bin/python
. If I want o keep Anaconda3
as the default Python interpreter, how can allow Weka to find sklearn exists in Anaconda3
, or at least how can I install sklearn in /usr/bin/python
?
PS: When I try to install sklearn
using pip install -U scikit-learn
hoping that it gets installed in /usr/bin/python
I get Requirement already up-to-date: scikit-learn in /anaconda3/lib/python3.6/site-packages (0.19.1)
Thank you
PRE-REQUISITES
So the first thing you may want to do is figure out which default python you have by typing /usr/bin/python -V
By default Mac OS X has python 2.7 installed and so I will continue the tutorial with that in mind. If you want to install python 3, you may do so first and then follow the rest of the tutorial making changes for python2 with python3
INTRO
Ok so there is a small problem that I found. Apparently, I could not find a way to configure weka with Anaconda, however there is an easy way to configure Python with Weka. The only issue would be to setting up your python instance.
Step 1: Installing PIP
The first thing you need to do is install python's officially-sanctioned package manager called PIP. Installing it on Mac OS X is different from Linux distributions like Ubuntu and can be followed here (Remember when you typed /usr/bin/python pip freeze
? It complained that you don't have pip and you need it).
Pip will be used to install libraries such as pandas, sklearn and the python weka wrapper.
STEP 2
This next step is usually optional, but since you have anaconda installed, this would be mandatory for you.
You want to install a virtual environment where python2.7 is your default python interpreter.
you would want to run:
/usr/bin/python -m pip install virtualenv virtualenvwrapper --user
mkdir <new_work_directory>
cd <new_work_directory>
/usr/bin/python -m mkvirtualenv <environment name>
/usr/bin/python -m workon <environment name>
STEP 4
Check and make sure your default python is correctly configured:
which python
pip install pandas sklearn python-weka-wrapper3 --user
And voila you should be good!
To exit your virtual env type: deactivate
. Let me know if you have questions