mikeqfu/pydriosm

pydriosm Import fails due to "ModuleNotFoundError: No module named 'pyhelpers.dir'"

dbaldig opened this issue · 6 comments

As the title says, I tried to install pydriosm via "pip install --upgrade git+https://github.com/mikeqfu/pydriosm.git" without success as it returned an "ModuleNotFoundError: No module named 'pyhelpers.dir'".
Installation via "pip install --upgrade pydriosm" works but I can't import afterwards since it also gives me an "ModuleNotFoundError: No module named 'pyhelpers.dir'".
I uninstalled and reinstalled pyhelpers and pydriosm but it didn't fix the problem.
I'm working with Windows 11 and Python 3.10. Any idea how to fix this?

The reasons for the issues @DBlev886 raised are:

install pydriosm via "pip install --upgrade git+https://github.com/mikeqfu/pydriosm.git" without success

This is due to a major change to pydriosm is in progress. A new version of pydriosm will be released soon. Currently, pip install pydriosm should work.

Installation via "pip install --upgrade pydriosm" works but I can't import afterwards since it also gives me an "ModuleNotFoundError: No module named 'pyhelpers.dir'"

This is due to the recent update in the dependency pyhelpers, in which the module dir has been renamed to dirs.

As pydrioms==2.0.3 has been installed, a temporary solution to the above issues is to downgrade pyhelpers to an earlier version (e.g. pyhelpers==1.3.4). Can you try pip install pyhelpers==1.3.4 first, and then import pydriosm?

Hey Mike,
Thanks for your quick response.
I downgraded pyhelpers but importing pydriosm returns an "ImportError: cannot import name 'validate_input_data_dir' from 'pyhelpers.dir' (c:\Users........\lib\site-packages\pyhelpers\dir.py)" now

Hi @DBlev886, I tried to reproduce the issues. Hopefully the following way could work around the issues with the current version. Can you please try:

  • pip install python-rapidjson pyhelpers==1.2.18

In this way, import pydriosm should work properly. 🙂

You might see a UserWarning about python-Levenshtein when importing pydriosm. It doesn't indicate that there is an error and the warning message will disappear after python-Levenshtein is installed. To remove the warning, you could try pip install python-Levenshtein, or install its .whl file (downloadable from https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-levenshtein) instead.

Hey Mike,
unfortunately, it still shows the same error. I tried to downgrade pyhelpers until 1.2.15, but the problem remains.
Can you reveal when the new pydriosm version will be released? Maybe I can wait and hope that the new version works for me.

Hi @DBlev886,

Was it the "same error" as you mentioned in your previous comment:

"ImportError: cannot import name 'validate_input_data_dir' from 'pyhelpers.dir' ...

That doesn't sound right, because the function validate_input_data_dir() was included in pyhelpers<=1.2.18, but was later renamed to validate_dir() which caused the error.

I have just tried to reproduce the issues again in an empty virtual environment for both Python 3.9 and 3.10. With the installation of both pyhelpers==1.2.18 and pydriosm by running the following command:

  • pip install pyhelpers==1.2.18 python-rapidjson "GDAL-3.4.3-cp310-cp310-win_amd64.whl" pydriosm

I didn't have any issues with import pydriosm.

Maybe I did something wrong. I just tried again and it's working now. Thanks a lot for your help!