Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #89892 > unrolled thread

Cannot update OpenSSL for Python3

Started byCecil Westerhof <Cecil@decebal.nl>
First post2015-05-04 10:58 +0200
Last post2015-05-04 21:38 +0100
Articles 16 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Cannot update OpenSSL for Python3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-04 10:58 +0200
    Re: Cannot update OpenSSL for Python3 Chris Angelico <rosuav@gmail.com> - 2015-05-04 20:10 +1000
      Re: Cannot update OpenSSL for Python3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-04 13:32 +0200
        Re: Cannot update OpenSSL for Python3 Chris Angelico <rosuav@gmail.com> - 2015-05-04 22:14 +1000
          Re: Cannot update OpenSSL for Python3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-04 15:13 +0200
            Re: Cannot update OpenSSL for Python3 Chris Angelico <rosuav@gmail.com> - 2015-05-05 00:18 +1000
              Re: Cannot update OpenSSL for Python3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-04 17:11 +0200
                Re: Cannot update OpenSSL for Python3 Chris Angelico <rosuav@gmail.com> - 2015-05-05 02:03 +1000
                  Re: Cannot update OpenSSL for Python3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-04 19:19 +0200
                    Re: Cannot update OpenSSL for Python3 Chris Angelico <rosuav@gmail.com> - 2015-05-05 03:49 +1000
                    Re: Cannot update OpenSSL for Python3 Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-05-04 21:02 +0200
                      Re: Cannot update OpenSSL for Python3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-04 21:52 +0200
                        Re: Cannot update OpenSSL for Python3 Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-05-04 23:59 +0200
                Re: Cannot update OpenSSL for Python3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-04 19:04 +0100
                  Re: Cannot update OpenSSL for Python3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-04 21:54 +0200
    Re: Cannot update OpenSSL for Python3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-04 21:38 +0100

#89892 — Cannot update OpenSSL for Python3

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-04 10:58 +0200
SubjectCannot update OpenSSL for Python3
Message-ID<87k2wok9bz.fsf@Equus.decebal.nl>
But when I do:
    import urllib3.contrib.pyopenssl
I get:
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 55, in <module>
        import OpenSSL.SSL
      File "/usr/lib64/python3.4/site-packages/OpenSSL/__init__.py", line 8, in <module>
        from OpenSSL import rand, crypto, SSL
      File "/usr/lib64/python3.4/site-packages/OpenSSL/rand.py", line 9, in <module>
        from six import integer_types as _integer_types
    ImportError: No module named 'six'

When I then give:
    pip3 install -U OpenSSL
It goes wrong:
    Could not fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client Error: Not Found

I checked and even
    https://pypi.python.org/simple/
does not exist. Anyone an idea what is happening here?

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [next] | [standalone]


#89894

FromChris Angelico <rosuav@gmail.com>
Date2015-05-04 20:10 +1000
Message-ID<mailman.80.1430734238.12865.python-list@python.org>
In reply to#89892
On Mon, May 4, 2015 at 6:58 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
> When I then give:
>     pip3 install -U OpenSSL
> It goes wrong:
>     Could not fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client Error: Not Found
>
> I checked and even
>     https://pypi.python.org/simple/
> does not exist. Anyone an idea what is happening here?

I think what you want is called pyOpenSSL, not just OpenSSL:

https://pypi.python.org/pypi/pyOpenSSL
https://pypi.python.org/simple/pyopenssl/

Not sure why /simple/ doesn't work, but you're not normally meant to
grab that page manually - it's for script work. You could raise a
tracker issue about that if you like, but it may not be considered
important.

Does 'pip3 install -U pyOpenSSL' work?

ChrisA

[toc] | [prev] | [next] | [standalone]


#89896

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-04 13:32 +0200
Message-ID<878ud4k270.fsf@Equus.decebal.nl>
In reply to#89894
Op Monday 4 May 2015 12:10 CEST schreef Chris Angelico:

> On Mon, May 4, 2015 at 6:58 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
>> When I then give: pip3 install -U OpenSSL It goes wrong: Could not
>> fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client
>> Error: Not Found
>>
>> I checked and even
>> https://pypi.python.org/simple/
>> does not exist. Anyone an idea what is happening here?
>
> I think what you want is called pyOpenSSL, not just OpenSSL:
>
> https://pypi.python.org/pypi/pyOpenSSL
> https://pypi.python.org/simple/pyopenssl/
>
> Not sure why /simple/ doesn't work, but you're not normally meant to
> grab that page manually - it's for script work. You could raise a
> tracker issue about that if you like, but it may not be considered
> important.
>
> Does 'pip3 install -U pyOpenSSL' work?
Not really, because that gives:
    Requirement already up-to-date: pyOpenSSL in /usr/lib64/python3.4/site-packages
    Cleaning up...

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#89900

FromChris Angelico <rosuav@gmail.com>
Date2015-05-04 22:14 +1000
Message-ID<mailman.84.1430741703.12865.python-list@python.org>
In reply to#89896
On Mon, May 4, 2015 at 9:32 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
>> Does 'pip3 install -U pyOpenSSL' work?
> Not really, because that gives:
>     Requirement already up-to-date: pyOpenSSL in /usr/lib64/python3.4/site-packages
>     Cleaning up...

I don't know why it wasn't automatically installed, but 'six' is a
listed dependency of pyOpenSSL. What happens if you try to install
six?

ChrisA

[toc] | [prev] | [next] | [standalone]


#89903

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-04 15:13 +0200
Message-ID<874mnsjxju.fsf@Equus.decebal.nl>
In reply to#89900
Op Monday 4 May 2015 14:14 CEST schreef Chris Angelico:

> On Mon, May 4, 2015 at 9:32 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
>>> Does 'pip3 install -U pyOpenSSL' work?
>> Not really, because that gives: Requirement already up-to-date:
>> pyOpenSSL in /usr/lib64/python3.4/site-packages Cleaning up...
>
> I don't know why it wasn't automatically installed, but 'six' is a
> listed dependency of pyOpenSSL. What happens if you try to install
> six?

That gets installed. And then I get:
    ImportError: No module named 'cryptography'

So I try to install that. This gives:
    Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_7jexj87-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cryptography
Storing debug log for failure in /root/.pip/pip.log

In the log I see:
    c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
     #include <Python.h>
                        ^

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#89905

FromChris Angelico <rosuav@gmail.com>
Date2015-05-05 00:18 +1000
Message-ID<mailman.89.1430749136.12865.python-list@python.org>
In reply to#89903
On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
> That gets installed. And then I get:
>     ImportError: No module named 'cryptography'
>
> So I try to install that. This gives:
>     Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_7jexj87-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cryptography
> Storing debug log for failure in /root/.pip/pip.log
>
> In the log I see:
>     c/_cffi_backend.c:2:20: fatal error: Python.h: No such file or directory
>      #include <Python.h>

Okay, that one's easy enough to deal with!

You have something that needs to build a C extension. To do that, you
need to have the Python headers installed. How did you install Python?
On Debian/Ubuntu family Linuxes, that's probably "apt-get install
python3" - so getting the headers would be "apt-get install
python3-dev". Give that a try, and then retry the pip install.

ChrisA

[toc] | [prev] | [next] | [standalone]


#89913

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-04 17:11 +0200
Message-ID<87vbg8idhk.fsf@Equus.decebal.nl>
In reply to#89905
Op Monday 4 May 2015 16:18 CEST schreef Chris Angelico:

> On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
>> That gets installed. And then I get:
>> ImportError: No module named 'cryptography'
>>
>> So I try to install that. This gives: Command /usr/bin/python3 -c
>> "import setuptools,
>> tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize,
>> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
>> 'exec'))" install --record
>> /tmp/pip-_7jexj87-record/install-record.txt
>> --single-version-externally-managed --compile failed with error
>> code 1 in /tmp/pip_build_root/cryptography Storing debug log for
>> failure in /root/.pip/pip.log
>>
>> In the log I see: c/_cffi_backend.c:2:20: fatal error: Python.h: No
>> such file or directory #include <Python.h>
>
> Okay, that one's easy enough to deal with!
>
> You have something that needs to build a C extension. To do that,
> you need to have the Python headers installed. How did you install
> Python? On Debian/Ubuntu family Linuxes, that's probably "apt-get
> install python3" - so getting the headers would be "apt-get install
> python3-dev". Give that a try, and then retry the pip install.

I should have thought about that myself. :-(

Now I get:
    c/../_cffi1/ffi_obj.c:489:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
         PyObject *u = PyUnicode_DecodeLatin1(PyBytes_AS_STRING(res),
         ^
    cc1: some warnings being treated as errors

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#89914

FromChris Angelico <rosuav@gmail.com>
Date2015-05-05 02:03 +1000
Message-ID<mailman.94.1430755420.12865.python-list@python.org>
In reply to#89913
On Tue, May 5, 2015 at 1:11 AM, Cecil Westerhof <Cecil@decebal.nl> wrote:
> Now I get:
>     c/../_cffi1/ffi_obj.c:489:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
>          PyObject *u = PyUnicode_DecodeLatin1(PyBytes_AS_STRING(res),
>          ^
>     cc1: some warnings being treated as errors

Interesting. I'm not sure why yours is complaining about that; mine
doesn't. (Possibly because I'm running Python 3.5, and stuff may have
been changed.) In any case, this would be a reasonable thing to make a
bug report about. In the meantime, you can simply override that
warning-equals-error parameter:

http://stackoverflow.com/questions/25587039/error-compiling-rpy2-on-python3-4-due-to-werror-declaration-after-statement

ChrisA

[toc] | [prev] | [next] | [standalone]


#89919

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-04 19:19 +0200
Message-ID<87mw1ki7ln.fsf@Equus.decebal.nl>
In reply to#89914
Op Monday 4 May 2015 18:03 CEST schreef Chris Angelico:

> On Tue, May 5, 2015 at 1:11 AM, Cecil Westerhof <Cecil@decebal.nl> wrote:
>> Now I get: c/../_cffi1/ffi_obj.c:489:5: error: ISO C90 forbids
>> mixed declarations and code [-Werror=declaration-after-statement]
>> PyObject *u = PyUnicode_DecodeLatin1(PyBytes_AS_STRING(res), ^ cc1:
>> some warnings being treated as errors
>
> Interesting. I'm not sure why yours is complaining about that; mine
> doesn't. (Possibly because I'm running Python 3.5, and stuff may
> have been changed.) In any case, this would be a reasonable thing to
> make a bug report about. In the meantime, you can simply override
> that warning-equals-error parameter:
>
> http://stackoverflow.com/questions/25587039/error-compiling-rpy2-on-python3-4-due-to-werror-declaration-after-statement

It looks like I am encircled by Gremlins:
    >>> import urllib3.contrib.pyopenssl
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 58, in <module>
        from socket import _fileobject, timeout
    ImportError: cannot import name '_fileobject'

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#89921

FromChris Angelico <rosuav@gmail.com>
Date2015-05-05 03:49 +1000
Message-ID<mailman.98.1430761780.12865.python-list@python.org>
In reply to#89919
On Tue, May 5, 2015 at 3:19 AM, Cecil Westerhof <Cecil@decebal.nl> wrote:
> It looks like I am encircled by Gremlins:
>     >>> import urllib3.contrib.pyopenssl
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in <module>
>       File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 58, in <module>
>         from socket import _fileobject, timeout
>     ImportError: cannot import name '_fileobject'

This is looking like a pyopenssl bug - I can't import that name
either, and given that it has the leading underscore, it's probably
not an official part of the socket module's API.

ChrisA

[toc] | [prev] | [next] | [standalone]


#89925

FromIrmen de Jong <irmen.NOSPAM@xs4all.nl>
Date2015-05-04 21:02 +0200
Message-ID<5547c244$0$2913$e4fe514c@news.xs4all.nl>
In reply to#89919
On 4-5-2015 19:19, Cecil Westerhof wrote:

> It looks like I am encircled by Gremlins:
>     >>> import urllib3.contrib.pyopenssl
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in <module>
>       File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 58, in <module>
>         from socket import _fileobject, timeout
>     ImportError: cannot import name '_fileobject'
> 

Looks to me as if you have installed a Python 2 version of urllib3? pyopenssl? and are
trying to run that under python 3.

(socket module in python 2 does have a _fileobject, whereas in python 3 it no longer has
it.  Checked in CPython on Windows.)


Irmen

[toc] | [prev] | [next] | [standalone]


#89931

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-04 21:52 +0200
Message-ID<87bni0i0hd.fsf@Equus.decebal.nl>
In reply to#89925
Op Monday 4 May 2015 21:02 CEST schreef Irmen de Jong:

> On 4-5-2015 19:19, Cecil Westerhof wrote:
>
>> It looks like I am encircled by Gremlins:
>>>>> import urllib3.contrib.pyopenssl
>> Traceback (most recent call last): File "<stdin>", line 1, in
>> <module> File
>> "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py",
>> line 58, in <module> from socket import _fileobject, timeout
>> ImportError: cannot import name '_fileobject'
>>
>
> Looks to me as if you have installed a Python 2 version of urllib3?
> pyopenssl? and are trying to run that under python 3.
>
> (socket module in python 2 does have a _fileobject, whereas in
> python 3 it no longer has it. Checked in CPython on Windows.)

I did an uninstall and installed it again:
    pip3 install urllib3
    Downloading/unpacking urllib3
      Downloading urllib3-1.10.4.tar.gz (138kB): 138kB downloaded
      Running setup.py (path:/tmp/pip_build_root/urllib3/setup.py) egg_info for package urllib3

        warning: no previously-included files matching '*' found under directory 'docs/_build'
    Installing collected packages: urllib3
      Running setup.py install for urllib3

        warning: no previously-included files matching '*' found under directory 'docs/_build'
    Successfully installed urllib3
    Cleaning up...

But I keep getting the error. Only 2 lines earlier:
    >>> import urllib3.contrib.pyopenssl
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 56, in <module>
        from socket import _fileobject, timeout
    ImportError: cannot import name '_fileobject'

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#89938

FromIrmen de Jong <irmen.NOSPAM@xs4all.nl>
Date2015-05-04 23:59 +0200
Message-ID<5547ebab$0$2827$e4fe514c@news2.news.xs4all.nl>
In reply to#89931
On 4-5-2015 21:52, Cecil Westerhof wrote:

> But I keep getting the error. Only 2 lines earlier:
>     >>> import urllib3.contrib.pyopenssl
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in <module>
>       File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 56, in <module>
>         from socket import _fileobject, timeout
>     ImportError: cannot import name '_fileobject'
> 

Right. This seems to be an issue with the "contrib" module pyopenssl that is provided as
a courtesy with urllib3. The latter is 100% python 3 compatible from what I read in
their docs.

Looking at that contrib module however:
https://github.com/shazow/urllib3/blob/master/urllib3/contrib/pyopenssl.py

In the first few lines in the module docstring it states it is for Python 2.
I guess you won't be able to use this urllib3 contrib module with python 3. Maybe you
can contact its author to ask for a fix?


Irmen

[toc] | [prev] | [next] | [standalone]


#89923

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-05-04 19:04 +0100
Message-ID<mailman.100.1430762705.12865.python-list@python.org>
In reply to#89913
On 04/05/2015 16:11, Cecil Westerhof wrote:
> Op Monday 4 May 2015 16:18 CEST schreef Chris Angelico:
>
>> On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof <Cecil@decebal.nl> wrote:
>>> That gets installed. And then I get:
>>> ImportError: No module named 'cryptography'
>>>
>>> So I try to install that. This gives: Command /usr/bin/python3 -c
>>> "import setuptools,
>>> tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize,
>>> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
>>> 'exec'))" install --record
>>> /tmp/pip-_7jexj87-record/install-record.txt
>>> --single-version-externally-managed --compile failed with error
>>> code 1 in /tmp/pip_build_root/cryptography Storing debug log for
>>> failure in /root/.pip/pip.log
>>>
>>> In the log I see: c/_cffi_backend.c:2:20: fatal error: Python.h: No
>>> such file or directory #include <Python.h>
>>
>> Okay, that one's easy enough to deal with!
>>
>> You have something that needs to build a C extension. To do that,
>> you need to have the Python headers installed. How did you install
>> Python? On Debian/Ubuntu family Linuxes, that's probably "apt-get
>> install python3" - so getting the headers would be "apt-get install
>> python3-dev". Give that a try, and then retry the pip install.
>
> I should have thought about that myself. :-(
>

An alternative is to switch to Windows and do away with this archaic 
concept of users having to build code :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#89930

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-04 21:54 +0200
Message-ID<877fsoi0eg.fsf@Equus.decebal.nl>
In reply to#89923
Op Monday 4 May 2015 20:04 CEST schreef Mark Lawrence:

> An alternative is to switch to Windows and do away with this archaic
> concept of users having to build code :)

Well, maybe I get rid of some problems. But the ones I get back …

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#89933

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-05-04 21:38 +0100
Message-ID<mailman.105.1430771922.12865.python-list@python.org>
In reply to#89892
On 04/05/2015 09:58, Cecil Westerhof wrote:
> But when I do:
>      import urllib3.contrib.pyopenssl
> I get:
>      Traceback (most recent call last):
>        File "<stdin>", line 1, in <module>
>        File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 55, in <module>
>          import OpenSSL.SSL
>        File "/usr/lib64/python3.4/site-packages/OpenSSL/__init__.py", line 8, in <module>
>          from OpenSSL import rand, crypto, SSL
>        File "/usr/lib64/python3.4/site-packages/OpenSSL/rand.py", line 9, in <module>
>          from six import integer_types as _integer_types
>      ImportError: No module named 'six'
>
> When I then give:
>      pip3 install -U OpenSSL
> It goes wrong:
>      Could not fetch URL https://pypi.python.org/simple/OpenSSL/: 404 Client Error: Not Found
>
> I checked and even
>      https://pypi.python.org/simple/
> does not exist. Anyone an idea what is happening here?
>

Showing my complete ignorance of *nix, what is the difference betweeen 
"/usr/lib/python3.4/..." and "/usr/lib64/python3.4/..."?  Simply 32 
versus 64 bit, which can or can't be mixed, or what?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web