[TIP] [venv] python2.5 and ssl in virtualenvs: chicken and egg

J. Cliff Dyer jcd at sdf.lonestar.org
Sat Mar 16 08:29:50 PDT 2013


Note:  I sent the original email from a different address than the one I
have registered with [TIP], so the list rejected it. 

List members: Sorry for the confusion.

My reply is below.

Cheers,
Cliff


On Fri, 2013-03-15 at 17:30 -0700, Chris Withers wrote:
> Hmm, maybe I'm missing what you implied...
> 
> I already have ssl in the base python. I can't use site packages from 
> reasons you can guess.
> 
> I also don't have a lot of control (which is a good thing!) as it's 
> inside Tox.
> 
> I did also provide the only hack I think can work, but interested if 
> people can suggest better...
> 
> cheers,
> 
> Chris
> 
> On 15/03/2013 16:59, J. Cliff Dyer wrote:
> > Help me out a little more here.  I just went back and read it, and
> > having done so, I would give you the same advice I just gave.  So be
> > specific: What do you think I'm missing here?
> >
> >
> >
> >
> > On Fri, 2013-03-15 at 16:46 -0700, Chris Withers wrote:
> >> Please read my original post fully and carefully...
> >>
> >> Chris
> >>
> >> On 15/03/2013 16:43, J. Cliff Dyer wrote:
> >>> 1. You could activate your virtual environment with access to the system
> >>> packages.
> >>>
> >>> mkvirtualenv --system-site-packages
> >>>
> >>> But then your virtualenv has ALL the system packages, which might not be
> >>> what you want.
> >>>
> >>>
> >>> 2. You could download the ssl package separately and install it
> >>> manually. Click on the green button on this page:
> >>> https://pypi.python.org/pypi/ssl , then ungzip and find the setup.py
> >>> file and run python setup.py install it.
> >>>
> >>> Good luck!
> >>>
> >>> Cheers,
> >>> Cliff
> >>>
> >>>
> >>> On Fri, 2013-03-15 at 15:35 -0700, Chris Withers wrote:
> >>>> On 15/03/2013 15:30, Chris Withers wrote:
> >>>>> chris at server2:~/virtualenv$ ./test_env/bin/pip install ssl
> >>>>> Downloading/unpacking ssl
> >>>>> Exception:
> >>>>> Traceback (most recent call last):
> >>>>> <snip>
> >>>>> NoSSLError:
> >>>>> <snip>
> >>>>
> >>>> My heinous workaround for this is:
> >>>>
> >>>> server2:~# mv /usr/lib/python2.5/site-packages/ssl /usr/lib/python2.5/ssl
> >>>>
> >>>> I now feel dirty.
> >>>>
> >>>> Is there no better way?
> >>>>
> >>>> Chris
> >>>>
> >>>
> >>>
> >>>
> >>> ______________________________________________________________________
> >>> This email has been scanned by the Symantec Email Security.cloud service.
> >>> For more information please visit http://www.symanteccloud.com
> >>> ______________________________________________________________________
> >>
> >
> >
> >
> > ______________________________________________________________________
> > This email has been scanned by the Symantec Email Security.cloud service.
> > For more information please visit http://www.symanteccloud.com
> > ______________________________________________________________________
> 

Chris,
 
I think my suggestion #2 in the previous email might be good for you.
To expand on it a little bit:


2a. In your installation process, replace "pip install ssl" with
something like:

  $ wget \
  https://pypi.python.org/packages/source/s/ssl/ssl-1.15.tar.gz
  $ tar xzf ssl-1.15.tar.gz
  $ cd ssl-1.15   # or whatever the directory is in the tarball
  $ python setup.py install

Then you aren't relying on pip to navigate the SSL.

Looking more closely at the link you provided there's a suggestion in
there that might also work:

3. Pip install the ssl library using the --insecure flag, bypassing to
bypass the need for ssl in the pip process.

  $ pip install --insecure ssl
  $ pip install -r everything_else.pip # This is secure.


Option 2a is more secure but also more cumbersome.  Option 3 uses plain
http, but might fit into your workflow a little better.

Hope one of them is helpful for you.

Cheers,
Cliff







More information about the testing-in-python mailing list