[python3] getting an issue trying to install elixir on python3.2

62 views
Skip to first unread message

lex mlist

unread,
Mar 20, 2011, 5:37:42 PM3/20/11
to SQLElixir
Hello there,

I'm trying to get elixir running in my python3.2 environment since I'm
developing for this target.

I've read that there was a patch on the main trunk to support Python3
so I downloaded the source, then the repository's head revision, and
I've also tried using the fork made to support python3.

Anyway after I ran the setup.py it produces the following error:
Traceback (most recent call last):
File "/Users/lexor/Desktop/t/bin/easy_install", line 8, in <module>
load_entry_point('distribute==0.6.4', 'console_scripts',
'easy_install')()
File "/Users/lexor/Desktop/t/lib/python3.2/site-packages/
distribute-0.6.4-py3.2.egg/setuptools/command/easy_install.py", line
1702, in main
with_ei_usage(lambda:
File "/Users/lexor/Desktop/t/lib/python3.2/site-packages/
distribute-0.6.4-py3.2.egg/setuptools/command/easy_install.py", line
1690, in with_ei_usage
return f()
File "/Users/lexor/Desktop/t/lib/python3.2/site-packages/
distribute-0.6.4-py3.2.egg/setuptools/command/easy_install.py", line
1706, in <lambda>
distclass=DistributionWithoutHelpCommands, **kw
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/
python3.2/distutils/core.py", line 123, in setup
dist.parse_config_files()
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/
python3.2/distutils/dist.py", line 365, in parse_config_files
val = parser.get(section,opt)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/
python3.2/configparser.py", line 789, in get
d)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/
python3.2/configparser.py", line 391, in before_get
self._interpolate_some(parser, option, L, value, section,
defaults, 1)
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/
python3.2/configparser.py", line 440, in _interpolate_some
"found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or
'(', found: '%s%s#L%s%s'

Then also easy_install does not work.
I've tried removing from the site-packages the reference to Elixir and
SQLAlchemy, and easy_install works again, but everytime i try to
install it i get always the same error.

What can I do?

Thanks.

Graham Higgins

unread,
Mar 20, 2011, 9:18:03 PM3/20/11
to sqle...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 20 Mar 2011, at 21:37, lex mlist wrote:

> I'm trying to get elixir running in my python3.2 environment since I'm
> developing for this target.


> I've read that there was a patch on the main trunk to support Python3
> so I downloaded the source, then the repository's head revision, and
> I've also tried using the fork made to support python3.

If you're referring to the foogod fork (labelled "elixir3"), that
doesn't seem to have been refactored for Python3 (see below)

> configparser.InterpolationSyntaxError: '%' must be followed by '%' or
> '(', found: '%s%s#L%s%s'
> Then also easy_install does not work.
> I've tried removing from the site-packages the reference to Elixir and
> SQLAlchemy, and easy_install works again, but everytime i try to
> install it i get always the same error.
>
> What can I do?


Comment out the offending "trac_link_format" assignment in setup.cfg:

https://bitbucket.org/foogod/elixir3/src/c69b3eb6ebdd/setup.cfg#cl-12

but that isn't goint to get you very far because, as I mentioned
above, that particular fork doesn't seem to have been refactored for
Python 3, c.f.:

https://bitbucket.org/foogod/elixir3/src/c69b3eb6ebdd/elixir/relationships.py
#cl-1099

I have also been tinkering with elixir under Python 3.2 - the
prognosis looks quite promising but coverage is patchy and a few tests
fail (I've appended the output below, for interest).

The discussion thread here:

http://groups.google.com/group/sqlelixir/browse_frm/thread/57a656966e018391#

makes it unlikely that elixir will be fully ported to Python 3 (unless
the permanent development hiatus is resolved).

(DevPy3)bash-3.2$ nosetests
.......................................................FF....schema
test skipped
...............................................................F
................E....
======================================================================
ERROR: Failure: KeyError ('tests.db1..c')
- ----------------------------------------------------------------------


Traceback (most recent call last):

File "{py3}/nose-1.0.0-py3.2.egg/nose/failure.py", line 37, in
runTest
raise self.exc_class(self.exc_val).with_traceback(self.tb)
File "{py3}/nose-1.0.0-py3.2.egg/nose/loader.py", line 390, in
loadTestsFromName
addr.filename, addr.module)
File "{py3}/nose-1.0.0-py3.2.egg/nose/importer.py", line 39, in
importFromPath
return self.importFromDir(dir_path, fqname)
File "{py3}/nose-1.0.0-py3.2.egg/nose/importer.py", line 86, in
importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "{src}/elixir/tests/test_session_ext.py", line 18, in <module>
setup_all(True)
File "{src}/elixir/elixir/__init__.py", line 89, in setup_all
setup_entities(entities)
File "{src}/elixir/elixir/entity.py", line 820, in setup_entities
method()
File "{src}/elixir/elixir/entity.py", line 308, in setup_reltables
self.call_builders('create_tables')
File "{src}/elixir/elixir/entity.py", line 482, in call_builders
getattr(builder, what)()
File "{src}/elixir/elixir/relationships.py", line 903, in
create_tables
if self.inverse:
File "{src}/elixir/elixir/relationships.py", line 521, in inverse
self, check_reverse=check_reverse)
File "{src}/elixir/elixir/entity.py", line 564, in
get_inverse_relation
if rel.is_inverse(other_rel):
File "{src}/elixir/elixir/relationships.py", line 1147, in is_inverse
return super(ManyToMany, self).is_inverse(other) and \
File "{src}/elixir/elixir/relationships.py", line 540, in is_inverse
self.entity == other.target and \
File "{src}/elixir/elixir/relationships.py", line 495, in target
self._target = collection.resolve(self.of_kind, self.entity)
File "{src}/elixir/elixir/collection.py", line 63, in resolve
return self.resolve_absolute(key, key, entity)
File "{src}/elixir/elixir/collection.py", line 26, in
resolve_absolute
module = sys.modules[module_path]
KeyError: KeyError('tests.db1..c',)

======================================================================
FAIL: tests.test_events.TestEvents.test_events
- ----------------------------------------------------------------------


Traceback (most recent call last):

File "{py3}/nose-1.0.0-py3.2.egg/nose/case.py", line 188, in runTest
self.test(*self.arg)
File "{src}/elixir/tests/test_events.py", line 97, in test_events
checkCount('before_insert_called', 1)
File "{src}/elixir/tests/test_events.py", line 89, in checkCount
(name, value, dictCount)
AssertionError: global var count for before_insert_called should be 1
but is 0
0 = {'before_any_called': 0, 'after_update_called': 0,
'after_delete_called': 0, 'before_delete_called': 0,
'before_insert_called': 0, 'reconstructor_called': 2,
'after_insert_called': 0, 'before_update_called': 0}
['before_insert_called']
>> assert 0 == 1, \
'global var count for %s should be %s but is %s' % \
('before_insert_called', 1, 0)


======================================================================
FAIL: tests.test_events.TestEvents.test_multiple_inheritance
- ----------------------------------------------------------------------


Traceback (most recent call last):

File "{py3}/nose-1.0.0-py3.2.egg/nose/case.py", line 188, in runTest
self.test(*self.arg)
File "{src}/elixir/tests/test_events.py", line 127, in
test_multiple_inheritance
assert a.update_count == 1
AssertionError:
>> assert <tests.test_events.A object at 0x1d74470>.update_count == 1


======================================================================
FAIL: tests.test_packages.TestPackages.test_relative_collection
- ----------------------------------------------------------------------


Traceback (most recent call last):

File "{py3}/nose-1.0.0-py3.2.egg/nose/case.py", line 188, in runTest
self.test(*self.arg)
File "{src}/elixir/tests/test_packages.py", line 96, in
test_relative_collection
assert len(elixir.entities) == 5
AssertionError:
>> assert len(<module 'elixir' from '{src}/elixir/elixir/
__init__.py'>.[]) == 5


Name Stmts Miss Cover Missing
- ------------------------------------------------------
elixir 40 2 95% 20-21
elixir.collection 69 13 81% 11, 14-15, 29-33,
68-72, 76, 111, 120, 124
elixir.entity 517 56 89% 57, 155, 161, 226, 305,
315-328, 338-339, 345-352, 358-361, 387, 412-426, 436, 460, 510, 521,
537, 542, 551-553, 568, 587-590, 603, 625, 687, 784, 888, 893, 928,
958, 967, 970, 976, 980, 983, 986, 993
elixir.events 15 0 100%
elixir.ext 0 0 100%
elixir.ext.associable 60 4 93% 205-209
elixir.ext.perform_ddl 40 2 95% 71, 98
elixir.ext.taggable 43 25 42% 17-28, 33-37, 42-47,
52-58
elixir.ext.versioned 130 12 91% 125-128, 150, 153, 170,
182, 187, 254, 257-258, 285-286
elixir.fields 52 1 98% 166
elixir.options 44 2 95% 243, 258
elixir.properties 66 2 97% 129, 162
elixir.relationships 371 34 91% 455, 507, 531, 575,
593, 650-651, 662, 676, 682, 711, 795, 872, 881-882, 978-983, 995,
1108, 1114, 1133, 1153-1171, 1203, 1223, 1237
elixir.statements 23 0 100%
- ------------------------------------------------------
TOTAL 1470 153 90%
- ----------------------------------------------------------------------
Ran 146 tests in 10.431s

FAILED (errors=1, failures=3)


- --
Cheers,

Graham

http://bel-epa.com/gjh/


-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAk2Gp0sACgkQOsmLt1NhivxsPQCeJZ6zhj6E6vQfcpEdAMg/Qrky
x0sAoLV+VDIBDPGl2tBUFAlr9H+Rk1+9iQCVAgUBTYanS1nrWVZ7aXD1AQLekQP/
VaouW2xy9JWPtFtHo9VYzcCcSbSyHOT5sEMnTtbOrWyI62MMjrF60yUkjjKhBJOa
jrKGx7u2u3DgSeA3m+rECwzpgWWVsUadsYE0xgKLCekRRxqZq7uMN3k++O/dSYfd
D9ATK1F0ol+LIAAPpErdtCrJpWpXDQnkNVj7DoMRK+w=
=0sSP
-----END PGP SIGNATURE-----

Graham Higgins

unread,
Mar 20, 2011, 10:25:24 PM3/20/11
to sqle...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 21 Mar 2011, at 01:18, Graham Higgins wrote:
> If you're referring to the foogod fork (labelled "elixir3"), that
> doesn't seem to have been refactored for Python3 (see below)


I did the foogod fork a disservice, it has been converted, pretty much.

- --
Cheers,

Graham

http://bel-epa.com/gjh/

-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAk2GtxQACgkQOsmLt1NhivyXfACdHun21Ea+fOK0KuOXgzDd0k05
9koAniCJc2BCcdyowC6Mzp8Sk9rNud5riQCVAgUBTYa3FFnrWVZ7aXD1AQJhLAP/
f+zUPlRFpP64GGnmOYjYmdwcuXZDhcx39ypalKFXeEnWt6mLZehCessNvlGFtGJR
GuSK3NV0DjR3aoslsvSU1WYjdO7zDKTT3nEB9eYNI9jba5vQhPAV2hHa0Pqs0hhh
YMUCObMwv/nFvA0Mppqw7H39iWl9/kriCn8M/FXCewI=
=y/AO
-----END PGP SIGNATURE-----

Vinay Sajip

unread,
May 30, 2011, 8:00:03 AM5/30/11
to sqle...@googlegroups.com
Graham Higgins <gjhiggins@...> writes:

> I did the foogod fork a disservice, it has been converted, pretty much.

I don't know about the foogod fork, but I've developed a fork which has a single
code-base for Python 2.x and 3.x (no 2to3).

The code is at

https://bitbucket.org/vinay.sajip/elixir3

All tests pass on Python 2.7, and all tests pass on Python 3.2 other than the
two which rely on pycrypto (not available for Python 3).

On 2.x you can run tests using "python setup.py test", but on Python 3 you have
to run "nosetests3". This is because nose for 3.x doesn't have a test collector
that setup.py can call.

Test results are at http://gist.github.com/998800

All feedback gratefully received!

Regards,

Vinay Sajip

Gaetan de Menten

unread,
May 31, 2011, 3:35:35 AM5/31/11
to sqle...@googlegroups.com

Looks great to me... except for the metaclass trick which is quite
ugly. Is there really no other way?

--
Gaëtan de Menten

Vinay Sajip

unread,
May 31, 2011, 1:35:18 PM5/31/11
to sqle...@googlegroups.com
On May 31, 8:35 am, Gaetan de Menten <gdemen...@gmail.com> wrote:

> Looks great to me... except for the metaclass trick which is quite
> ugly. Is there really no other way?

Hmmm ... Google seems to have swallowed my response, or perhaps I accidentally
clicked "Reply to author" instead of "Reply". Trying again ...

Unfortunately, the metaclass hack is needed because of syntax incompatibilities
in this area between 2.x and 3.x - 2.x raises a SyntaxError when the metaclass=
keyword argument is seen in a class definition, so you can't rely on conditional
execution and have to resort to an exec hack. I "borrowed" ;-) the technique
from Benjamin Peterson's very useful "six" library of helpers for 2.x-3.x
portability:

http://pybites.blogspot.com/2010/06/six-python-23-compatibility-helpers.html

I agree the compatibility syntax is not very pretty, but it's not hideous
either. Hopefully most users won't need to peek under the Entity abstraction
(most of the time, anyway).

Regards,

Vinay Sajip

Vinay Sajip

unread,
May 31, 2011, 12:45:36 PM5/31/11
to SQLElixir
On May 31, 8:35 am, Gaetan de Menten <gdemen...@gmail.com> wrote:

> Looks great to me... except for the metaclass trick which is quite
> ugly. Is there really no other way?

I believe not, because of syntax incompatibilities (the metaclass= in
3.x class declarations gives a SyntaxError on 2.x) - that's why the
exec hack needs to be there. This technique is the one used by "six",
Benjamin Peterson's very useful 2.x-3.x compatibility library, which
is where I "borrowed" it from :-)

http://pybites.blogspot.com/2010/06/six-python-23-compatibility-helpers.html

I agree it's not pretty, but hopefully users won't have to see below
the Entity abstraction, most of the time anyway ...

Regards,

Vinay Sajip
Reply all
Reply to author
Forward
0 new messages