I cannot install the pyephem module to my Pi. When I do sudo pip3 install pyephem

I get the following error message:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pyephem
  Could not fetch URL https://pypi.python.org/simple/pyephem/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
  Could not find a version that satisfies the requirement pyephem (from versions: )
No matching distribution found for pyephem

So I guess the real question is how to get the SSL module on the Pi


The first problem is that you have the wrong package name, it should be ephem not pyephem. You need to make sure the python3-dev package is installed first. You can do this with the following command:

sudo apt-get install python3-dev

Then install pyephem for Python 3 with the following command:

pip3 install ephem

If you also want to install the version for Python 2.x the required commands are:

sudo apt-get install python-dev
pip3 install ephem

Alternatively you can download and install from a source file:

wget https://pypi.python.org/packages/c3/2c/9e1a815add6c222a0d4bf7c644e095471a934a39bc90c201f9550a8f7f14/ephem-

Unpack the archive:

tar -zxvf ephem-

enter the ephem- directory:

cd ephem-

and run:

python3 setup.py install

Note: You may need to run the last command as root.

  • Thanks, but I get the same error message. Funny though, since the Python 2 method works
    – dbosk
    Jun 22 '17 at 18:55
  • It works here are you sure you used the python 3 version of the 2 commands? Jun 22 '17 at 18:57
  • Try this first sudo apt-get install build-essential libssl-dev libffi-dev python-dev Are you using a virtual environment? Jun 22 '17 at 19:02
  • I'm not using a virtual environment. Should I?
    – dbosk
    Jun 22 '17 at 19:13
  • Can I manually install if I downloaded the package via browser from the website?
    – dbosk
    Jun 22 '17 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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