RagingTiger / Omega-Notebook

The Jupyter Docker Image for all your ML/AI/DS needs.
0 stars 0 forks source link

Error in pipreqsnb: % and ! Characters #5

Open RagingTiger opened 1 year ago

RagingTiger commented 1 year ago

The built-in magic commands seem to be throwing the string cleaning step in pipreqsnb:

Exception occurred while working on file /home/hckr/ianozsvald/kaggle_optiver_volatility/notebooks/20210825_light.ipynb, cell 1/36
Traceback (most recent call last):
  File "/usr/bin/pipreqsnb", line 11, in <module>
    load_entry_point('pipreqsnb==0.2.4', 'console_scripts', 'pipreqsnb')()
  File "/usr/lib/python3.7/site-packages/pipreqsnb/pipreqsnb.py", line 130, in main
    raise e
  File "/usr/lib/python3.7/site-packages/pipreqsnb/pipreqsnb.py", line 126, in main
    imports += get_import_string_from_source(source)
  File "/usr/lib/python3.7/site-packages/pipreqsnb/pipreqsnb.py", line 26, in get_import_string_from_source
    tree = ast.parse(source)
  File "/usr/lib/python3.7/ast.py", line 35, in parse
    return compile(source, filename, mode, PyCF_ONLY_AST)
  File "<unknown>", line 39
    %ipython_memory_usage_start
    ^
SyntaxError: invalid syntax

The error seems to come from these lines in pipreqsnb's source. I suspect it has to do with the way the lines are being sanitized by this function. The offending Jupyter Notebook can be found here and the offending cell is the 1st one.

This should be an easy fix ... requiring only a few steps:

Unfortunately the maintenance seems to have died off ... so the main repo won't be reliable for using this tool moving forward.

RagingTiger commented 1 year ago

Useful references on pip install for GitHub repos:

RagingTiger commented 1 year ago

Fork now available here: https://github.com/RagingTiger/pipreqsnb