Skip to content

Path not set #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JoshuaC3 opened this issue Oct 1, 2016 · 6 comments
Closed

Path not set #11

JoshuaC3 opened this issue Oct 1, 2016 · 6 comments

Comments

@JoshuaC3
Copy link

JoshuaC3 commented Oct 1, 2016

Hi, trying the use this wrapper and I am getting the error

OSError                                   Traceback (most recent call last)
<ipython-input-1-6bd4815fa3b6> in <module>()
     16 target = [5, 3, 1, 4, 5, 1, 5]
     17 
---> 18 fm = pywFM.FM(task='regression', num_iter=5)
     19 
     20 # split features and target for train/test

/usr/local/lib/python3.5/dist-packages/pywFM/__init__.py in __init__(self, task, num_iter, init_stdev, k0, k1, k2, learning_method, learn_rate, r0_regularization, r1_regularization, r2_regularization, rlog, verbose, silent, temp_path)
    103         self.__libfm_path = os.environ.get('LIBFM_PATH')
    104         if self.__libfm_path is None:
--> 105             raise OSError("`LIBFM_PATH` is not set. Please install libFM and set the path variable (https://github.com/jfloff/pywFM#installing).")
    106 
    107     def run(self, x_train, y_train, x_test, y_test, x_validation_set=None, y_validation_set=None):

OSError: `LIBFM_PATH` is not set. Please install libFM and set the path variable (https://github.com/jfloff/pywFM#installing).

I followed the install instructions exactly, specifically making sure I did the export path part correctly. What might be going wrong here?

@jfloff
Copy link
Owner

jfloff commented Oct 1, 2016

Just like its written in the Installing section, you need to set LIBFM_PATH with the path for your libfm binaries, eg:

export LIBFM_PATH=/home/libfm/bin/

@jfloff jfloff closed this as completed Oct 1, 2016
@JoshuaC3
Copy link
Author

JoshuaC3 commented Oct 5, 2016

I did this. I ran specifically
export LIBFM_PATH=/home/libfm/bin/
as you had said in the Installing section.

I then ran
pip install pywFM

I then opened up a Jupyter Notebook from a separate terminal. The code failed to run with the above error. This was my issue. I would have needed to set LIBFM_PATH again in any new terminal before running python or an IPython or Jupyter notebook. Maybe you could add this to the Install/Useage Instructions.

Many thanks.

@jfloff
Copy link
Owner

jfloff commented Oct 5, 2016

According to a quick google that seems to be a Jupyter Problem. It seems that env variables are not sourced in Jupyter. Take a look at the following link for more information: jupyterhub/jupyterhub#330

Feel free to also post other links for future reference!

@JoshuaC3
Copy link
Author

JoshuaC3 commented Oct 5, 2016

I tested this in the python terminal and it also did not work without having done export LIBFM_PATH=/home/libfm/bin/. I seems that LIBFM_PATH is not permanently saved. This is fine though now that I am aware of this :)

@jfloff
Copy link
Owner

jfloff commented Oct 5, 2016

Well, that's environment vars 101: if you want to set you variables permanently you have to set them in the appropriate .profile file

Cheers!

@anuragsoni9
Copy link

environmental varibales can be setup from Jupyter via following

import sys,os,os.path

os.environ['LIBFM_PATH']=os.path.expanduser('your bin path')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants