2

For a current project, I am planning to merge two very large CSV files with Dask as an alternative to Pandas. I have installed Dask thorough pip install "dask[dataframe]".

When running import dask.dataframe as dd, I am however receiving the feedback ModuleNotFoundError: No module named 'dask.dataframe'; 'dask' is not a package.

Several users seem to have had the same problem and were recommneded to install the module via Conda, which has not helped either in my case.

What is the reason for the module not being found?

4
  • 5
    Do you have a local file named dask.py? Show us the output of this code: import dask; print(dask.__file__) Aug 17, 2020 at 14:33
  • Thanks for the great input - that solved it. Yes one of the files was called dask.py. Aug 17, 2020 at 14:35
  • 1
    :). This being a general kind of problem, I'm not sure it's worth it, but you may want to give your situation and solution as an answer for others.
    – mdurant
    Aug 17, 2020 at 18:11
  • Good point, let me summarise something as an answer Aug 17, 2020 at 18:13

1 Answer 1

6

As user John Gordon mentioned, the reason for the error notification is that a file within the same folder was named dask.py. Renaming the file solved the situation within seconds.

As a general rule/conclusion: is as advisable to not use .py file names that directly relate to Python modules.

1
  • lol. I'm a pretty experienced SDE at FANG company. Still got this wrong. Named my file dask.py to study dask. Seems to to happen to the best of us. Thx for answer. Jan 11, 2021 at 4:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.