Closed jeiglsperger closed 2 years ago
Dear @Zepp3 ,
I'm not really sure what this bug is related to but you should always be using the newest pip as pip itself is advertising when running an out-of-date version of pip.
Furthermore could you provide is with the exact code block that leverages the wetterdienst
package?
Hi @gutzbenj,
thanks for your answer.
I updated pip to pip-20.3.4
. The problem still occurs.
The code block that leverages wetterdienst
is:
import pandas as pd
from datetime import datetime
from geopy.location import Location
from wetterdienst.provider.dwd.observation import DwdObservationRequest, DwdObservationPeriod, DwdObservationResolution, DwdObservationParameter, DwdObservationDataset
from dwdweather import DwdWeather
def calc_daily_mean_weather_values(location: Location) -> pd.Series:
weather_df = pd.DataFrame()
stations = DwdObservationRequest(DwdObservationDataset.TEMPERATURE_AIR, resolution=DwdObservationResolution.HOURLY,
period=DwdObservationPeriod.RECENT, start_date=datetime(2001, 1, 11),
end_date=datetime(2020, 10, 28), tidy=True, humanize=True,
si_units=True)
print(stations.filter_by_distance(latitude=53.0, longitude=8.0, distance=100, unit="km"))
return weather_df
Do you have further information about your running system, python, etc as asked for in the template issue?
Oh sorry. Here you go:
OS: Ubuntu 18.04.4 LTS (GNU/Linux 4.15.0-111-generic x86_64) Python 3.6.9
Dear @Zepp3,
thanks for writing in. Without being able to bring anything sensible to the discussion yet, I can confirm Wetterdienst croaks like you described on the type of system you are using.
docker run --rm -it ubuntu:18.04 bash
apt-get update
apt-get install --yes python3 python3-pip nano
pip3 install wetterdienst geopy
root@220b568a874e:/# python3 test.py
Traceback (most recent call last):
File "test.py", line 4, in <module>
from wetterdienst.provider.dwd.observation import DwdObservationRequest, DwdObservationPeriod, DwdObservationResolution, DwdObservationParameter, DwdObservationDataset
ModuleNotFoundError: No module named 'wetterdienst.provider'
With kind regards, Andreas.
Indeed, this module seems to be missing from the installation.
$ python3
>>> import wetterdienst
>>> wetterdienst.__file__
'/usr/local/lib/python3.6/dist-packages/wetterdienst/__init__.py'
root@220b568a874e:/# ls -1 /usr/local/lib/python3.6/dist-packages/wetterdienst/
__init__.py
__pycache__
api.py
cli.py
core
dwd
exceptions.py
metadata
service.py
util
Got it. Wetterdienst dropped support for Python 3.6 a while ago. So, when installing it on your system, you will get the most recent version available for Python 3.6, which happens to be 0.15.0.
root@220b568a874e:/# wetterdienst --version
wetterdienst 0.15.0
This is a perfect installation of Wetterdienst. However, you will not be able to use most recent code snippets as outlined in the documentation, matching version 0.21.0.
Keep your current environment and consult the documentation corresponding to version 0.15.0 [1]. We don't recommend this, because Wetterdienst received many valuable improvements in the meanwhile.
Use pyenv
[2] for installing arbitrary versions of Python on your system without too much effort. This is what we usually do when being in similar situations.
[1] https://github.com/earthobservations/wetterdienst/tree/v0.15.0/docs [2] https://github.com/pyenv/pyenv
Apparently, Ubuntu 18.04 LTS already ships a minimal variant of Python 3.7. That is, the interpreter is there, but no package ecosystem.
# Install Python 3.7
apt-get install --yes python3.7 python3.7-dev wget
# Need to install some Python packages upfront. Don't know why.
python3.7 -m pip install numpy cython
wget https://files.pythonhosted.org/packages/33/ae/01f7faa8f58d7be568457deef657695877dfe02530923b6ee8f6c30e8b3b/rapidfuzz-1.4.1-cp37-cp37m-manylinux1_x86_64.whl
python3.7 -m pip install rapidfuzz-1.4.1-cp37-cp37m-manylinux1_x86_64.whl
wget https://files.pythonhosted.org/packages/e6/0a/90da8840e044c329a0271fb0244ff40a68a2615bc360c296a3dc5e326ab6/pandas-1.2.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
python3.7 -m pip install pandas-1.2.5-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
python3.7 -m pip install wetterdienst geopy
I believe this output shows that the test program you shared at https://github.com/earthobservations/wetterdienst/issues/530#issuecomment-950571109 can run beyond where it previously croaked.
root@220b568a874e:/# python3.7 test.py
INFO: Wetterdienst cache directory is /root/.cache/wetterdienst
Traceback (most recent call last):
File "test.py", line 5, in <module>
from dwdweather import DwdWeather
ModuleNotFoundError: No module named 'dwdweather'
Please note this is just a workaround for installation and has not been confirmed for validity or correctness in any way. Please let us know if this works for you and good luck!
Dear @Zepp3 @amotl ,
I think we can close this at this moment . Do you agree?
Closing it. Please feel free to reopen if you see fit.
Hi @amotl and @gutzbenj,
thanks for your big help. Something went wrong with the notifications and therefore didn't receive your answers in this thread but I could resolve the problem with your suggestions.
Kind regards!
After installing wetterdienst via
pip3 install wetterdienst
and start running my algo, I received this error:By installing wetterdienst via
pip install wetterdienst
I received the error:So my question would be which version of pip should be used for installing the library or if somebody knows another way of solving this issue?