ephem does not work

105 views
Skip to first unread message

Astrid

unread,
Mar 27, 2020, 10:03:41 AM3/27/20
to weewx-user
Hello!

I have weewx 3.9.2 installed.
PyEphem is installed via pip.

pip list | grep ephem
ephem               3.7.7.0 
pyephem             3.7.7.0 

I put
import ephem
to local weewx-installation into
extensions.py

but if I restart weewx, it said that it
ephem not found

If I ommit this line in extensions.py and
and restart weewx and
print $almanac.hasExtra to a report, it
said: false.

I want to add moonrise and moonset to my
almanach.

How I can get ephem for this getting work?

Regards, Astrid

Thomas Keffer

unread,
Mar 27, 2020, 10:56:38 AM3/27/20
to weewx-user
You're not giving a lot of information, but it's possible that pip installed pyephem a different version of python that the version you are using to run weewxd. Try this:

pip show pyephem

It will show you where pip installed pyephem. Then try this:

python -c "import sys; print(sys.path)"

There must be a match between them. 

Also, how are you running weewxd? We need to know what version of Python it is using. Try this:

head /usr/bin/weewxd

or

head /home/weewx/bin/weewxd

depending on how you installed WeeWX.

Finally, what is your PATH?

env echo $PATH

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/cc3e7973-99cd-4bfd-b7d1-e58c6463873f%40googlegroups.com.

Astrid

unread,
Mar 27, 2020, 1:37:04 PM3/27/20
to weewx-user
Hello!

Thanx for your hints.

I installed weewx with downloading the rpm and
do it with rpm --install.

Here are the requested results:

pip show pyephem
Name: pyephem
Version: 3.7.7.0
Summary: Empty package that depends on "ephem"
Home-page: http://rhodesmill.org/pyephem/
Author: Brandon Rhodes
Author-email: brandon rhodesmill.org
License: LGPL
Location: /usr/lib/python3.6/site-packages
Requires: ephem
Required-by:

python -c "import sys; print(sys.path)"
['', '/usr/lib/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/PIL', '/usr/local/lib64/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages']

head /usr/bin/weewxd
#!/usr/bin/env python
#
#    Copyright (c) 2009-2015 Tom Keffer <tkeffer gmail.com>
#
#    See the file LICENSE.txt for your rights.
#
"""Entry point to the weewx weather system."""
import sys
from optparse import OptionParser

So will it be enough to change the first line of weewxd to
#!/usr/bin/env python3.6

This is installed too on my computer.

Regards, Astrid

Astrid

unread,
Mar 27, 2020, 2:22:18 PM3/27/20
to weewx-user
Hello!

I got it. :)
I found that there is a pip2.7.
I am a little bit confused with the version...
If I say pyton it calls pyton2.7, but if I say pip, it calls pip3.6...
It is suse Leap 15.1.

But now with the command
pip2.7 install ephem

I got it. :)

Thank you very much for your hints in the
right direction.
I am a newbee on here...

Regards, Astrid

Thomas Keffer

unread,
Mar 27, 2020, 4:27:03 PM3/27/20
to weewx-user
Are you saying that "pip" installed pyephem in a Python 3.x location, but the command "python" invokes Python 2.x? 

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Astrid

unread,
Mar 27, 2020, 11:21:45 PM3/27/20
to weewx-user
Hello!

Yes, I think so...?
But I dont understand, why this is so...?? :(

But I am happy, that ephem is working now. :)

Thanx a lot. :)

Regards, Astrid

Thomas Keffer

unread,
Mar 28, 2020, 7:48:36 AM3/28/20
to weewx-user
Thanks, Astrid. I was able to replicated this on my Leap 15.1 machine. 

It comes with Python 3, which sets "pip" to point to the Python 3 version of pip. If you then install Python 2, the command "python" now points to the Python 2 version. So, you end up with one pointing one way, the other the other way. Poor choice on the part of the OpenSUSE designers!

Suggestion: always be explicit about which version of pip you want. Instead of 

pip pyephem

use

python2 -m pip pyephem

-tk


--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Astrid

unread,
Mar 28, 2020, 8:18:08 AM3/28/20
to weewx-user
Hello!

Thank you very much for your hints. :)
I want to deinstall in yast2 all python2, because it
is outdated and not longer supported.
But then the system told me, that it will deinstall
weewx too...
Is weewx is running with python3 too?

I try to switch manually to python3 is python, but
it dont work... :(

Regards, Astrid

Thomas Keffer

unread,
Mar 28, 2020, 8:54:50 AM3/28/20
to weewx-user
WeeWX V4, which will support Python 3, has not been released yet. While a beta version is available, it can only be installed using the setup.py method. 

You should wait.

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Astrid

unread,
Mar 28, 2020, 10:27:15 AM3/28/20
to weewx-user
Hello!

Ok, thanx.
I will wait then for official release of v4.

Regards, Astrid
Reply all
Reply to author
Forward
0 new messages