Hello team ; I have installed my module (within `...
# questions
v
Hello team ; I have installed my module (within
src/my_module
) with
pip install -e src
; now
kedro
is looking for data within the
my_module
folder from root for some reason. Any clue whats going on here and how I can solve this ? Happy to provide more details if required πŸ™‚
d
can you provide a stack trace?
v
Copy code
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ Traceback (most recent call last) ────────────────────────────────┐
β”‚ C:\Users\Vincent Liagre\Anaconda3\envs\my_env\lib\site-packages\kedro\io\core.py:210 in   β”‚
β”‚ load                                                                                             β”‚
β”‚                                                                                                  β”‚
β”‚ C:\Users\Vincent                                                                                 β”‚
β”‚ Liagre\Anaconda3\envs\my_env\lib\site-packages\kedro_datasets\pandas\excel_dataset.py:223 β”‚
β”‚ in _load                                                                                         β”‚
β”‚                                                                                                  β”‚
β”‚ C:\Users\Vincent                                                                                 β”‚
β”‚ Liagre\Anaconda3\envs\my_env\lib\site-packages\pandas\util\_decorators.py:211 in wrapper  β”‚
β”‚                                                                                                  β”‚
β”‚ C:\Users\Vincent                                                                                 β”‚
β”‚ Liagre\Anaconda3\envs\my_env\lib\site-packages\pandas\util\_decorators.py:331 in wrapper  β”‚
β”‚                                                                                                  β”‚
β”‚ C:\Users\Vincent                                                                                 β”‚
β”‚ Liagre\Anaconda3\envs\my_env\lib\site-packages\pandas\io\excel\_base.py:482 in read_excel β”‚
β”‚                                                                                                  β”‚
β”‚ C:\Users\Vincent                                                                                 β”‚
β”‚ Liagre\Anaconda3\envs\my_env\lib\site-packages\pandas\io\excel\_base.py:1695 in __init__  β”‚
β”‚                                                                                                  β”‚
β”‚ C:\Users\Vincent                                                                                 β”‚
β”‚ Liagre\Anaconda3\envs\my_env\lib\site-packages\pandas\io\excel\_openpyxl.py:557 in        β”‚
β”‚ __init__                                                                                         β”‚
β”‚                                                                                                  β”‚
β”‚ C:\Users\Vincent                                                                                 β”‚
β”‚ Liagre\Anaconda3\envs\my_env\lib\site-packages\pandas\io\excel\_base.py:535 in __init__   β”‚
β”‚                                                                                                  β”‚
β”‚ C:\Users\Vincent Liagre\Anaconda3\envs\my_env\lib\site-packages\pandas\io\common.py:865   β”‚
β”‚ in get_handle                                                                                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Projects/my_env/my_module/<path_to_my_data.xlsx>
d
and can you show the catalog entry?
v
I guess for some reason
kedro
thinks I am within
my_module
d
I’m not sure that should matter, the dataset handles this
v
Copy code
my_dataset:
  type: pandas.ExcelDataSet
  filepath: path_to_my_data
d
and that path, does it live locally
or s3 etc
v
locally πŸ™‚
d
and do you have any custom hooks or decorators here?
v
and the issue is fixed when I
pip uninstall my_module
I have just onboarded on the existing project, let me check hooks / decorators
d
is the
my_module
name the same as the main Kedro package
v
yes precisely
d
okay
that may be causing some issues if it has exactly the same name
Python is just overwriting the namespace
v
but it is not only "the same", it is the main Kedro package
point is to be able to easily use nodes in notebooks
d
why does having the same name make that easier?
v
so you think I should just change the name in the
setup.py
?
it's not that I intentionally put the same name, its really the main kedro project package so by default its the same name
d
yes I think the setup.py name before you install will be the easiest option
my_module_nodes
etc should fix it
v
@datajoely this seems to resolve the issue ; thanks
Now I am wondering : how do other people do ?
d
Python has no protection against this, the trick is to keep your import namespace mutually exclusive
v
I just changed the name in the
setup
function, which I think just changes the name in the
pip list
but not the names I need to use in imports
d
the two are interlinked in funny ways, especially when you’re doing an
pip install -e
editable install
v
ok lets say at least it works πŸͺ„