Search code examples
pythonjupytersys.path

Error in sys.path.insert to reference a github module


I am trying to use a module from github called ffn and have downloaded it to my desktop. I am using Jupyter notebook for Python and was told i need to insert this code:

import sys
sys.path.insert(0, r"C:\Users\...\Desktop\ffn-master\ffn\_core_.py")
import ffn

..in order to use this code. However when i run the subsequent lines of code that call functions from here I still get the error:

C:\ProgramData\Anaconda3\lib\site-packages\ffn\core.py:2054: RuntimeWarning: invalid value encountered in minimum
negative_returns = np.minimum(returns, 0.)

I restarted the kernel and everything but still get the same error. Can anyone help?


Solution

  • "The desktop module has the fixes that the installed module in the anaconda path does not." - It seems like you still have the original module installed in the anaconda library.

    try running

    conda uninstall ffn
    

    and then include the entire library in the path in you notebook with

    sys.path.append(os.path.abspath(r"C:\Users\...\Desktop\ffn-master\ffn\")