SSL module not available

8,507 views
Skip to first unread message

Jeroen Sijsling

unread,
Oct 28, 2016, 11:07:03 AM10/28/16
to sage-support
Hello,

Recently I got an actual desktop for use in my office. I installed a Linux distribution on it (elementary 0.4, based on Ubuntu). One of the first things I did was to try and install Sage after installing all needed dependencies. To my amazement, that actually worked without any hitch whatsoever. The problems arose when I tried to go further so as to be able to work on the LMFDB.

Developing the LMFDB has a number of prerequisites. Among them is extending Sage by

sage -pip install --upgrade pip
sage -pip install --upgrade pymongo

This fails. I get

jrsijsling@JRS-ThinkCentre-M800z:~/Programs/sage-7.4$ ./sage -pip install --upgrade pip
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Requirement already up-to-date: pip in ./local/lib/python2.7/site-packages
jrsijsling@JRS-ThinkCentre-M800z:~/Programs/sage-7.4$ ./sage -pip install --upgrade pymongo
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting pymongo
Could not fetch URL https://pypi.python.org/simple/pymongo/: 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 pymongo (from versions: )
No matching distribution found for pymongo

I do have OpenSSL, and the notebook version of Sage works for me. And my version of Python 2.7 did in fact have the ssl module. So I do not know what causes this. The following attempts at a solution have failed:

Fully upgrading Python (pip, pymongo, setuptools) and rebuilding Sage;
Using Sage 7.3 instead;
Running ./sage -i openssl and trying again;
Using the Sage shell.
Running Python (2.7.10, which should have ssl installed internally) inside the Sage shell gives

(sage-sh) jrsijsling@JRS-ThinkCentre-M800z:sage-7.4$ python
Python 2.7.10 (default, Oct 28 2016, 09:09:23) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import ssl
Traceback (most recent call last):
File "", line 1, in 
File "/home/jrsijsling/Programs/sage-7.4/local/lib/python/ssl.py", line 97, in 
import _ssl # if we can't import it, let the error propagate
ImportError: No module named _ssl
Any ideas?

Thanks in advance,
Jeroen

Jeroen Sijsling

unread,
Oct 28, 2016, 11:39:31 AM10/28/16
to sage-support
In fact a solution seems to be to use pyopenssl instead:

./sage -i pyopenssl
./sage -f python2
make ssl

Hope this is canonical.

Best,
Jeroen

Eden Harder

unread,
Nov 7, 2016, 8:10:56 AM11/7/16
to sage-support
There is some errors when I install pyopenssl

eden:~ Eden$ sage -i pyopenssl

/Library/Developer/CommandLineTools/usr/bin/make build/make/Makefile

make[1]: `build/make/Makefile' is up to date.

build/bin/sage-logger \

"cd build/make && ./install 'all-toolchain'" logs/install.log

*** ALL ENVIRONMENT VARIABLES BEFORE BUILD: ***

Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.sSTWvhcHlD/Render

HOME=/Users/Eden

LANG=en_US.UTF-8

LOGNAME=Eden

MAKE=make

MAKEFLAGS=

MAKELEVEL=1

MANPATH=/Users/Eden/.nvm/versions/node/v4.1.1/share/man:/Users/Eden/.cabal/share/man:/usr/share/man:/usr/local/share/man:/Library/Developer/CommandLineTools/usr/share/man

MFLAGS=

NVM_BIN=/Users/Eden/.nvm/versions/node/v4.1.1/bin

NVM_CD_FLAGS=

NVM_DIR=/Users/Eden/.nvm

NVM_IOJS_ORG_MIRROR=https://iojs.org/dist

NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist

NVM_PATH=/Users/Eden/.nvm/versions/node/v4.1.1/lib/node

PATH=/Applications/SageMath-7.4.app/Contents/Resources/sage/build/bin:/Applications/SageMath-7.4.app/Contents/Resources/sage/src/bin:/Applications/SageMath-7.4.app/Contents/Resources/sage/local/bin:/Users/Eden/.nvm/versions/node/v4.1.1/bin:/Users/Eden/.cabal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin

PWD=/Applications/SageMath-7.4.app/Contents/Resources/sage/build/make

PYTHONPATH=/Applications/SageMath-7.4.app/Contents/Resources/sage/local

SAGE_EXTCODE=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/share/sage/ext

SAGE_LOCAL=/Applications/SageMath-7.4.app/Contents/Resources/sage/local

SAGE_LOGS=/Applications/SageMath-7.4.app/Contents/Resources/sage/logs/pkgs

SAGE_ORIG_PATH=/Users/Eden/.nvm/versions/node/v4.1.1/bin:/Users/Eden/.cabal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin

SAGE_ORIG_PATH_SET=True

SAGE_ROOT=/Applications/SageMath-7.4.app/Contents/Resources/sage

SAGE_SHARE=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/share

SAGE_SPKG_INST=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed

SAGE_SRC=/Applications/SageMath-7.4.app/Contents/Resources/sage/src

SAGE_VERSION=7.4

SHELL=/bin/bash

SHLVL=5

SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.8KPRZOK9hq/Listeners

TERM=xterm-256color

TERM_PROGRAM=Apple_Terminal

TERM_PROGRAM_VERSION=361.1

TERM_SESSION_ID=76996F3D-68D2-4974-80A9-0D671234B318

TMPDIR=/var/folders/1n/kzz_j7g519d482trw8xfx4xh0000gn/T/

USER=Eden

XPC_FLAGS=0x0

XPC_SERVICE_NAME=0

_=/usr/bin/env

__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0

***********************************************

make base

make[2]: Nothing to be done for `base'.

env SAGE_BUILD_TOOLCHAIN=yes make toolchain

make[2]: Nothing to be done for `toolchain'.

make toolchain-deps

make /Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/zlib-1.2.8.p0

make[3]: `/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/zlib-1.2.8.p0' is up to date.

make /Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpir-2.7.2

make[3]: `/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpir-2.7.2' is up to date.

make /Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpfr-3.1.4

make[3]: `/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpfr-3.1.4' is up to date.

make /Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpc-1.0.3.p0

make[3]: `/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed/mpc-1.0.3.p0' is up to date.


real 0m0.128s

user 0m0.092s

sys 0m0.028s

Sage build/upgrade complete!


/Library/Developer/CommandLineTools/usr/bin/make build/make/Makefile

make[1]: `build/make/Makefile' is up to date.

build/bin/sage-logger \

"cd build/make && ./install 'pyopenssl'" logs/install.log

*** ALL ENVIRONMENT VARIABLES BEFORE BUILD: ***

Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.sSTWvhcHlD/Render

HOME=/Users/Eden

LANG=en_US.UTF-8

LOGNAME=Eden

MAKE=make

MAKEFLAGS=SAGE_SPKG=sage-spkg\ 

MAKELEVEL=1

MAKEOVERRIDES=${-*-command-variables-*-}

MANPATH=/Users/Eden/.nvm/versions/node/v4.1.1/share/man:/Users/Eden/.cabal/share/man:/usr/share/man:/usr/local/share/man:/Library/Developer/CommandLineTools/usr/share/man

MFLAGS=

NVM_BIN=/Users/Eden/.nvm/versions/node/v4.1.1/bin

NVM_CD_FLAGS=

NVM_DIR=/Users/Eden/.nvm

NVM_IOJS_ORG_MIRROR=https://iojs.org/dist

NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist

NVM_PATH=/Users/Eden/.nvm/versions/node/v4.1.1/lib/node

PATH=/Applications/SageMath-7.4.app/Contents/Resources/sage/build/bin:/Applications/SageMath-7.4.app/Contents/Resources/sage/src/bin:/Applications/SageMath-7.4.app/Contents/Resources/sage/local/bin:/Users/Eden/.nvm/versions/node/v4.1.1/bin:/Users/Eden/.cabal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin

PWD=/Applications/SageMath-7.4.app/Contents/Resources/sage/build/make

PYTHONPATH=/Applications/SageMath-7.4.app/Contents/Resources/sage/local

SAGE_EXTCODE=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/share/sage/ext

SAGE_LOCAL=/Applications/SageMath-7.4.app/Contents/Resources/sage/local

SAGE_LOGS=/Applications/SageMath-7.4.app/Contents/Resources/sage/logs/pkgs

SAGE_ORIG_PATH=/Users/Eden/.nvm/versions/node/v4.1.1/bin:/Users/Eden/.cabal/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin

SAGE_ORIG_PATH_SET=True

SAGE_ROOT=/Applications/SageMath-7.4.app/Contents/Resources/sage

SAGE_SHARE=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/share

SAGE_SPKG=sage-spkg 

SAGE_SPKG_INST=/Applications/SageMath-7.4.app/Contents/Resources/sage/local/var/lib/sage/installed

SAGE_SRC=/Applications/SageMath-7.4.app/Contents/Resources/sage/src

SAGE_VERSION=7.4

SHELL=/bin/bash

SHLVL=5

SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.8KPRZOK9hq/Listeners

TERM=xterm-256color

TERM_PROGRAM=Apple_Terminal

TERM_PROGRAM_VERSION=361.1

TERM_SESSION_ID=76996F3D-68D2-4974-80A9-0D671234B318

TMPDIR=/var/folders/1n/kzz_j7g519d482trw8xfx4xh0000gn/T/

USER=Eden

XPC_FLAGS=0x0

XPC_SERVICE_NAME=0

_=/usr/bin/env

__CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0

***********************************************

sage-logger -p 'sage --pip install pyopenssl' /Applications/SageMath-7.4.app/Contents/Resources/sage/logs/pkgs/pyopenssl.log

[pyopenssl] pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

[pyopenssl] Collecting pyopenssl

[pyopenssl]   Could not fetch URL https://pypi.python.org/simple/pyopenssl/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping

[pyopenssl]   Could not find a version that satisfies the requirement pyopenssl (from versions: )

[pyopenssl] No matching distribution found for pyopenssl

make[1]: *** [pyopenssl] Error 1


real 0m0.656s

user 0m0.458s

sys 0m0.185s

***************************************************************

Error building Sage.


The following package(s) may have failed to build (not necessarily

during this run of 'make pyopenssl'):


The build directory may contain configuration files and other potentially

helpful information. WARNING: if you now run 'make' again, the build

directory will, by default, be deleted. Set the environment variable

SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.


make: *** [pyopenssl] Error 1

eden:~ Eden$ 


在 2016年10月28日星期五 UTC+2下午5:07:03,Jeroen Sijsling写道:

Dima Pasechnik

unread,
Nov 11, 2016, 5:31:38 AM11/11/16
to sage-support
Could you try first

sage -i openssl

and only then

sage -i pyopenssl

Eden Harder

unread,
Nov 11, 2016, 7:04:22 AM11/11/16
to sage-support

`sage -i openssl` done,

`sage -i pyopenssl` gives the following errors:


Error building Sage.


The following package(s) may have failed to build (not necessarily

during this run of 'make pyopenssl'):


The build directory may contain configuration files and other potentially

helpful information. WARNING: if you now run 'make' again, the build

directory will, by default, be deleted. Set the environment variable

SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.


make: *** [pyopenssl] Error 1


在 2016年11月11日星期五 UTC+1上午11:31:38,Dima Pasechnik写道:

John H Palmieri

unread,
Nov 11, 2016, 11:32:05 AM11/11/16
to sage-support


On Friday, November 11, 2016 at 2:31:38 AM UTC-8, Dima Pasechnik wrote:
Could you try first

sage -i openssl

and only then

sage -i pyopenssl


Do you need to run "sage -f python2" in between these, to make sure Python builds its ssl module?
 

Dima Pasechnik

unread,
Nov 11, 2016, 1:01:55 PM11/11/16
to sage-support
right, installing openssl still needs python2 rebuild. Sorry, I forgot about this.
thus, the order of packages to be rebuilt:
1) openssl
2) python2
3) pyopenssl

Eden Harder

unread,
Nov 11, 2016, 5:30:14 PM11/11/16
to sage-support
Thank you all! It works!

在 2016年11月11日星期五 UTC+1下午7:01:55,Dima Pasechnik写道:

Armin Rosic

unread,
Jan 30, 2018, 4:45:54 AM1/30/18
to sage-support
This helped me after hours and hours of other attempts. Thank you !

Albert Zeyer

unread,
Feb 1, 2020, 9:25:43 AM2/1/20
to sage-support
I get the same error with the latest Sage, downloaded for MacOSX from the website.

Is this still the way to go? I really want to use Python 3 though. How can I enable that?

Best,
Albert

Jianping Pan

unread,
Jul 6, 2020, 6:45:43 PM7/6/20
to sage-support
I just replace the second one with sage -f python3 and it worked for me!
Reply all
Reply to author
Forward
0 new messages