Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Irmen de Jong
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 "", line 1, in 
>   File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", 
> line 56, in 
> 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

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Mark Lawrence

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 "", line 1, in 
   File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", line 55, 
in 
 import OpenSSL.SSL
   File "/usr/lib64/python3.4/site-packages/OpenSSL/__init__.py", line 8, in 

 from OpenSSL import rand, crypto, SSL
   File "/usr/lib64/python3.4/site-packages/OpenSSL/rand.py", line 9, in 

 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

--
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
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 "", line 1, in
>>  File
>> "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py",
>> line 58, in  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 "", line 1, in 
  File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", 
line 56, in 
from socket import _fileobject, timeout
ImportError: cannot import name '_fileobject'

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread 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 "", line 1, in 
>   File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", 
> line 58, in 
> 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

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Mark Lawrence

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  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 


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

--
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 3:19 AM, Cecil Westerhof  wrote:
> It looks like I am encircled by Gremlins:
> >>> import urllib3.contrib.pyopenssl
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", 
> line 58, in 
> 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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 18:03 CEST schreef Chris Angelico:

> On Tue, May 5, 2015 at 1:11 AM, Cecil Westerhof  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 "", line 1, in 
  File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", 
line 58, in 
from socket import _fileobject, timeout
ImportError: cannot import name '_fileobject'

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Tue, May 5, 2015 at 1:11 AM, Cecil Westerhof  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 16:18 CEST schreef Chris Angelico:

> On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof  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 
>
> 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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 11:13 PM, Cecil Westerhof  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 

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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 14:14 CEST schreef Chris Angelico:

> On Mon, May 4, 2015 at 9:32 PM, Cecil Westerhof  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 
^

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 9:32 PM, Cecil Westerhof  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
Op Monday 4 May 2015 12:10 CEST schreef Chris Angelico:

> On Mon, May 4, 2015 at 6:58 PM, Cecil Westerhof  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Cannot update OpenSSL for Python3

2015-05-04 Thread Chris Angelico
On Mon, May 4, 2015 at 6:58 PM, Cecil Westerhof  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
-- 
https://mail.python.org/mailman/listinfo/python-list


Cannot update OpenSSL for Python3

2015-05-04 Thread Cecil Westerhof
But when I do:
import urllib3.contrib.pyopenssl
I get:
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.4/site-packages/urllib3/contrib/pyopenssl.py", 
line 55, in 
import OpenSSL.SSL
  File "/usr/lib64/python3.4/site-packages/OpenSSL/__init__.py", line 8, in 

from OpenSSL import rand, crypto, SSL
  File "/usr/lib64/python3.4/site-packages/OpenSSL/rand.py", line 9, in 

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
-- 
https://mail.python.org/mailman/listinfo/python-list