0

I'm using a Python library (pyPyrTools), which is giving me an import error.


    ../../../venv/lib/python3.8/site-packages/pyPyrTools/__init__.py:1: in <module>
        from binomialFilter import binomialFilter
    E   ModuleNotFoundError: No module named 'binomialFilter'

Inspecting the module in venv/lib/site-packages, I find the following structure:

-pyPyrTools
---__init__.py
---binomialFilter.py

And inspecting __init__.py, it's a pretty standard fare import:

from binomialFilter import binomialFilter

binomialFilter.py does include a function called binomialFilter.

Any idea why I'm getting this error from this library? There aren't any relative imports or anything funky, and the files all exist on the right level. It all looks correct to me.

The module looks like it was written for 2.7, and I'm using 3.8 if that is relevant.

Jordan Sim
  • 67
  • 9

1 Answers1

0

If you are using a Jupyter notebook, when you first launch it, it is running in some location. Even if your.ipynb is located in another folder, imported functions and exported files will be from the location where the notebook is running.

Since binomimialFilter is not a package but a file, it will be searching in the running folder.

One way to rapidly fix this is to manually put the binomialFilter.py file in the running folder.