Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Errors installing and ImportError while initializing on Python 3 #125

Closed
GoogleCodeExporter opened this issue Mar 7, 2015 · 28 comments
Closed

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Install the package on Python 3. It will install, but with errors.
2. Attempt to import 'keyczar.keyczar'. This also raises an error.

What is the expected output? What do you see instead?

The package should install nicely and run on Python 3. These errors are seen 
during install:

Running python-keyczar-0.71b\setup.py -q bdist_egg --dist-dir 
c:\users\jaraco\appdata\local\temp\easy_install-moe2i9\python-keyczar-0.71b\egg-
dist-tmp-2lfd9s
  File "build\bdist.win-amd64\egg\keyczar\keyczart.py", line 169
    print "Generating private key sets..."
                                         ^
SyntaxError: invalid syntax

  File "build\bdist.win-amd64\egg\keyczar\util.py", line 800
    except UnicodeDecodeError, exc:
                             ^
SyntaxError: invalid syntax

zip_safe flag not set; analyzing archive contents...
  File "c:\users\jaraco\projects\public\keyring\env\python33\site-packages\python_keyczar-0.71b-py3.3.egg\keyczar\keyczart.py", line 169
    print "Generating private key sets..."
                                         ^
SyntaxError: invalid syntax

  File "c:\users\jaraco\projects\public\keyring\env\python33\site-packages\python_keyczar-0.71b-py3.3.egg\keyczar\util.py", line 800
    except UnicodeDecodeError, exc:
                             ^
SyntaxError: invalid syntax

Adding python-keyczar 0.71b to easy-install.pth file
Installing keyczart-script.py script to 
C:\Users\jaraco\projects\public\keyring\env/Scripts
Installing keyczart.exe script to 
C:\Users\jaraco\projects\public\keyring\env/Scripts


And this is the error occurs during initial import:

>>> import keyczar.keyczar
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\jaraco\projects\public\keyring\env\Python33\site-packages\python_keyczar-0.71b-py3.3.egg\keyczar\keyczar.py", line 27, in <module>
    import errors
ImportError: No module named 'errors'


What version of the product are you using? On what operating system?

0.71b on Python 3.3 64-bit on Windows 8.


Original issue reported on code.google.com by jaraco@jaraco.com on 7 Feb 2013 at 10:47

@GoogleCodeExporter
Copy link
Author

I'm reclassifying this as an enhancement request. While Python 3 support would 
be nice to have and will probably be necessary eventually, the vast majority of 
users will be on Python 2.x for the foreseeable future. In many cases, I 
believe it's not possible for a single codebase to execute with both Python 2.x 
and Python 3, so Python 3 support will likely require creating and maintaining 
a separate Keyczar implementation, and I don't think there's enough value in a 
Python 3 implementation right now to be worth the effort -- at least not unless 
someone is volunteering to step up and be the maintainer for it.

Original comment by swillden@google.com on 7 Feb 2013 at 2:19

  • Added labels: Type-Enhancement, Priority-Low
  • Removed labels: Type-Defect, Priority-Medium

@GoogleCodeExporter
Copy link
Author

I must politely disagree. Python 3 support must come from the libraries first, 
then from the users. It can't happen the other way around.

It is possible to have a code base run on both Python 2 and Python 3 (see 
CherryPy for an example of a non-trivial library that runs on Python 2.3 
through 3.3 on the same code base).

I'm not saying keyczar needs to run on Python 3, but it surely could attempt to 
support it. If you're willing to provide repo access (or commit to accept some 
pull requests), I can work on some changes to help support Python 3 from the 
same codebase (even if it just invokes 2to3 during install) without creating a 
new maintenance domain.

Supporting Python 3 and Python 2.6+ is much easier than also supporting earlier 
versions of Python (2.5 and earlier). What is the likelihood that keyczar could 
discontinue support for Python 2.5?

Original comment by jaraco@jaraco.com on 7 Feb 2013 at 8:17

@GoogleCodeExporter
Copy link
Author

If you're volunteering to do the work, we'd be very happy to accept your 
patches.

The recommended way of contributing to Keyczar is to clone the repository into 
your own Google Code repo, make your changes there, then send a request to the 
mailing list for code reviews. Once the code has passed review, we'll pull it 
into the main rep.

Thanks!

Original comment by swillden@google.com on 7 Feb 2013 at 8:45

@GoogleCodeExporter
Copy link
Author

The nice thing is, I've verified that python 2.5 support was broken in 2011, 
don't see any complaints, so i don't think we need to add it back. The bad news 
is, while 2.6-3.X support is easier, it's still a lot of work getting the 
python 3 port working, mainly because of the differentiating of  bytes and 
strings in python3. This will take some time, but i've started some work on it:

https://github.com/jbtule/keyczar-python2to3

Original comment by jtu...@gmail.com on 2 Mar 2013 at 8:46

  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

Original comment by jtu...@gmail.com on 2 Mar 2013 at 9:07

  • Added labels: Implementation-Python

@GoogleCodeExporter
Copy link
Author

okay, so I actually now have all 233 unit tests passing for both Python 2 and 
3, to do this I 

 - moved unit tests to package keyczar.tests
 - moved keyczart to package keyczar.tool
 - Added binary-only api for en/decrypt, attachedverify
 - refactored backend to use streams for all en/decrypt
 - refactored most of the char manipulation to bytes & bytearray
 - removed cut/paste python source code
 - removed circular references

Moving of keyczart to a separate package  is a potential compatibility issue, 
but since python has an api for modifying keysets (unlike java,c++) I don't 
think that's should be an issue.

The new binary api I added, I used the io package BufferedReader and 
BufferedWriter, the public apis I created are `def EncryptIO(self, reader, 
writer)`, `def DecryptIO(self, reader, writer)` and `def AttachedVerifyIO(self, 
signed_data_reader, data_writer, nonce = b"")` If this seems the right way to 
go, this api should be extended to other operations, I implemented these 
specifically as I needed a byte representation only api for 
SignedSessionEncryption in python 3.

Any feedback and help from actual python developers welcome.

Original comment by jtu...@gmail.com on 6 Mar 2013 at 4:42

@GoogleCodeExporter
Copy link
Author

Original comment by jtu...@gmail.com on 4 Jul 2013 at 4:24

@dylansturg
Copy link

Are there any updates regarding supporting Python 3.0+? I'd like to use Keyczar in a Python 3 project. Thanks for any information.

@devinlundberg
Copy link
Contributor

Unfortunately there are no updates. Jay did a lot of work here https://github.com/jbtule/keyczar-python2to3

Its a gigantic PR that was difficult to break down so we weren't able to finish reviewing it at the time. All of the changes he made make sense from a high level.

@jbtule if you can submit it through a github PR I could start working on the code review.

@jbtule
Copy link
Contributor

jbtule commented Apr 16, 2015

added the pull request, #164 it's two years old, don't have time to make a better one.

@jamiegau
Copy link

Its nearly december. We are 99% there.. Please roll out into global release..
Python 3 has been around for decades in computer time... And I keep bumping into lack of 2 to 3 upgrades..

With security being an ever more important issues on the internet.. I find the complacency here astounding.

@dmyerscough
Copy link

Any updates on when keyczar will be GA for Python 3?

@rsyring
Copy link

rsyring commented Feb 17, 2016

Python 3 adoption is really taking off. Maybe Priority-Low isn't so true anymore?

@nickbaum
Copy link

For what it's worth, Keyczar is the only Python library we use that still isn't compatible with Python 3.

This seems like it would be a great 20% project for someone on the Google Security team :)

@jbtule
Copy link
Contributor

jbtule commented Mar 30, 2016

Less than 20% when all is needed is just auditing and merging a 3 year old pull request.

Sent from my iPhone

On Mar 30, 2016, at 12:45 PM, Nick Baum notifications@github.com wrote:

For what it's worth, Keyczar is the only Python library we use that still isn't compatible with Python 3.

This seems like it would be a great 20% project for someone on the Google Security team :)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub

@nickbaum
Copy link

I suspect a 3 year old pull request would be non-trivial to review, but I'm in no position to judge.

@hsdhillon
Copy link

+1 for this request. Any ETA as when Python 3 support will be available??

@questin
Copy link

questin commented May 6, 2016

+1 for this request also. Latest Ubuntu LTS ships with Python 3 now as default. This is the last library our platform need to run on 3. Thanks.

@soferio
Copy link

soferio commented May 20, 2016

+1.

@soferio
Copy link

soferio commented May 20, 2016

Is this the answer? : https://pypi.python.org/pypi/python3-keyczar/0.71rc0

@pembo13
Copy link

pembo13 commented Feb 9, 2018

It's 2018... is there a solution to this?

@nickbaum
Copy link

@edknapp posted some updates in this issue.

#213

TL;DR is that work is happening but don't expect something soon

@dennismwagiru
Copy link

Yes soferio, use https://pypi.python.org/pypi/python3-keyczar/0.71rc0
pip install python3-keyczar

@pembo13
Copy link

pembo13 commented Apr 29, 2018

@dennismwagiru as of right now python3-keyczar depends on pycrypto, which I can't get to build on Centos7 with Python36. Pycrpto itself is dead.

@dennismwagiru
Copy link

@pembo13, first install pycryptodome and the rename the pycrptodome folder to pycrypto before installing python3-keyczar

@dennismwagiru
Copy link

@frispete
Copy link

@dennismwagiru

first install pycryptodome and the rename the pycrptodome folder to pycrypto

Please note, PyCryptodome is meant as a drop-in replacement of PyCrypto (with absolutely inevitable incompatibilities only). If a rename is necessary, that would be a bug in one of the involved packages.

@jonathan-chao-artivest
Copy link

what is the correct import?

from keyczar import keyczar

returns import error still, even for python3-keyzcar

Is it a different import package?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests