mapado / haversine

Calculate the distance between 2 points on Earth
MIT License
326 stars 62 forks source link

Pycharm report error "Import Unit fails" #33

Closed SumitKrGhosh closed 3 years ago

SumitKrGhosh commented 4 years ago
from haversine import haversine, Unit

I have installed haversine 2.2.0 on python 3.7 I am able to get the haversine function but not the Units.

jdeniau commented 4 years ago

I tried to reproduce but no problem for me:

pipenv --python=3.7
pipenv shell
pip install haversine # install 2.2.0
python --version
# 3.7.3

from haversine import haversine, Unit
print(Unit.KILOMETERS)
<Unit.KILOMETERS: 'km'>

Can you try to reproduce this ? If it does not work, can you produce a reproductible case ?

SumitKrGhosh commented 4 years ago

I see is I installed it as below. Looks like the issue is with the editor PyCharm. this is working fine in the terminal. python3 -m pip install haversine image

jdeniau commented 4 years ago

OK. I don't know pycharm. If you find the solution, feel free to open a PR

voglster commented 4 years ago

I am using haversine 2.2.0 and PyCharm and importing Unit just fine (python 3.8.3). If i had a guess this is an install/setup issue on sumit's side of pycharm/venv etc.

@SumitKrGhosh do you have PyCharm pointing at the same virtual env you are pip installing to?

CrapsJeroen commented 3 years ago

I think the PyCharm Documentation is clear enough @jdeniau and this issue can be closed.