Skip to content

problem of running in jupyter notebook #18

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
kkhuang1990 opened this issue Jun 21, 2017 · 8 comments
Closed

problem of running in jupyter notebook #18

kkhuang1990 opened this issue Jun 21, 2017 · 8 comments

Comments

@kkhuang1990
Copy link

I followed the instructions as you wrote on the github and can successfully run the test codes.
however, I met the following error when running in my jupyter notebook


OSError Traceback (most recent call last)
in ()
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/python2.7/dist-packages/pywFM/init.pyc in init(self, task, num_iter, init_stdev, k0, k1, k2, learning_method, learn_rate, r0_regularization, r1_regularization, r2_regularization, rlog, verbose, seed, silent, temp_path)

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

actually I have already set the LIBFM_PATH in my ~/.bashrc file as this:
export LIBFM_PATH=$HOME/local/libfm/bin
I don't know why the jupyter notebook cannot find this path

@jfloff
Copy link
Owner

jfloff commented Jun 21, 2017

Hello,

I had a previous issue regarding this (#11), and it seems Jupyter-specific problem: jupyterhub/jupyterhub#330

As some hints, you can either try exporting into .profile, or you could also set it directly using Jupyter instructions: http://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-env

When you find a solution, please report back! 👍

@kkhuang1990
Copy link
Author

kkhuang1990 commented Jun 22, 2017 via email

@jfloff
Copy link
Owner

jfloff commented Jun 22, 2017

Did you change anything? Or just a simple reload of jupyter worked? I'm assuming with the reload it started loading the new set of env variables that were on the bashrc (similar to when it happens to consoles that are open while you change .bashrc). Was that it?

@kkhuang1990
Copy link
Author

kkhuang1990 commented Jun 24, 2017 via email

@jfloff
Copy link
Owner

jfloff commented Jun 25, 2017

Thank you for the feedback! Soon I'll update the README with a link to this issue for future reference. :)

@jfloff jfloff closed this as completed Jun 25, 2017
@zhenv5
Copy link

zhenv5 commented Jul 5, 2017

Traceback (most recent call last):
File "factorization_machine.py", line 18, in
fm = pywFM.FM(task='regression', num_iter=5)
File "/anaconda2/lib/python2.7/site-packages/pywFM/init.py", line 122, in init
raise OSError("libFM is not checked out to the correct commit."
OSError: libFM is not checked out to the correct commit.(https://github.com/jfloff/pywFM#installing).

When I tried to run the demo code, I met above errors.

@jfloff
Copy link
Owner

jfloff commented Jul 5, 2017

Did you follow all the steps from https://github.com/jfloff/pywFM#installing ?

@LLLLucensus
Copy link

LLLLucensus commented Mar 1, 2020

Actually I have made two modifications. (1) add this line to ~/.bash_profile.(the path should he the directory where you installed your libfm into) export LIBFM_PATH=$HOME/local/libfm/bin (2) add the following settings to ~/.jupyter/jupyter_notebook_config.py for var in os.environ: c.Spawner.env_keep.append(var) It may also work if you only append the LIBFM_PATH to env_keep. I am not sure. For completeness, I add all path variables Then I restart the jupyter, It works

I didn't find jupyter_notebook_config.py but found a empty file named jupyter_notebook_config.json. Is it a file created by yourself?

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

4 participants