0

I installed apache 2.4 on ubuntu 14.04 with mod_wsgi 4.4 from source and pyenv to use python 2.7.9. I set up the apache configuration to work with pyenv. I'm getting the following error when I run my web2py app:

File "/home/ubuntu/.pyenv/versions/w-2.7.9/lib/python2.7/site-packages/boto/https_connection.py", line 131, in connect ca_certs=self.ca_certs) File "/usr/local/lib/python2.7/ssl.py", line 387, in wrap_socket ciphers=ciphers) File "/usr/local/lib/python2.7/ssl.py", line 138, in __init__ self._sslobj = _ssl.sslwrap(self._sock, server_side, AttributeError: 'module' object has no attribute 'sslwrap' 

I'm not sure why, but suddenly as you see it stops using pyenv python and jumps to /usr/local/lib/python2.7/ssl.py and uses it.

The problem is not with ssl sslwreap function, it's that mod_wsgi switch to system python (/usr/local/lib/python2.7/ssl.py), not pyenv

What's going wrong?

2
  • How did you import it? Commented Aug 24, 2015 at 23:53
  • import what ? ssl ? it's not me, it's web2py framework and i checked that it's just import ssl Commented Aug 25, 2015 at 9:27

1 Answer 1

1

Am surprised you even got pyenv to work in any way as it doesn't install Python with a shared library making it next to useless where Python is being embedded such as with mod_wsgi.

As the author of mod_wsgi I would recommend not using pyvenv.

What is possibly happening is that because of the issues with pyvenv, the linker when building mod_wsgi picked up a different shared library for Python and used that. Alternatively, at runtime it is picking up a Python installation from a different location because you didn't configure mod_wsgi to tell it what installation to use.

I would suggest you work through:

and check what Python library mod_wsgi is linking to and what Python installation it is using at run time. This will at least confirm whether things haven't been compiled/set up right.

3
  • First thank you so much for your interest in my question. 1. i'm not really sure what to use rather than pyenv for production server, using system python might conflict with the version i'm running, if i want to update my webserver to python 3 or something i want to update the server OS to work with that also, right ? so i'm really open for any suggestions that way. 2. running ldd /usr/lib/apache2/modules/mod_wsgi.so gives : see next comment .. Commented Aug 28, 2015 at 12:25
  • linux-vdso.so.1 => (0x00007fff4336f000) libpython2.7.so.1.0 => /home/ubuntu/.pyenv/versions/2.7.9/lib/libpython2.7.so.1.0 (0x00007f0e6ac69000) libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0e6aa4b000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0e6a685000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0e6a481000) libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f0e6a27e000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0e69f77000) It's linked to pyenv python BUT .. running ldconfig -p | grep python: next comment plz Commented Aug 28, 2015 at 12:30
  • libpython2.7.so.1.0 (libc6,x86-64) => /home/ubuntu/.pyenv/versions/2.7.9/lib/libpython2.7.so.1.0 libpython2.7.so.1.0 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0 libpython2.7.so (libc6,x86-64) => /home/ubuntu/.pyenv/versions/2.7.9/lib/libpython2.7.so libpython2.7.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libpython2.7.so so it says that python is linked into two installations. i guess that is the problem ! any thoughts ? Thank you so much Commented Aug 28, 2015 at 12:31

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.