Issue 10763

NameError: name 'unicode' is not defined
Nosy list
ced, hodeinavarro, pokoli, reviewbot, roundup-bot
Assigned to

Created on 2021-09-17.11:55:52 by hodeinavarro, last changed 1 month ago by roundup-bot.


File name Uploaded Type Details
case_no_forced_deps.txt hodeinavarro, 2021-09-17.12:48:05 text/plain view
case_simpleeval_greater_0.8.1.txt hodeinavarro, 2021-09-17.12:47:59 text/plain view
case_virtualenv_not_20.8.0.txt hodeinavarro, 2021-09-17.12:47:53 text/plain view


New changeset d6c855a22eeb by Cédric Krier in branch 'default':
Remove temporary fork for simpleeval-0.9.10
New changeset 07a4faa64a15 by Cédric Krier in branch 'default':
Use temporary fork for simpleeval-0.9.10
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-10-02.10:39:36

When testing manually to install simpleeval from a virtualenv created by virtualenv 20.8.0, here is the result:

Collecting simpleeval
  Using cached simpleeval-0.9.10.tar.gz (26 kB)
    ERROR: Command errored out with exit [status 1](status1):
     command: /tmp/test/vtest/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vbc7ggk4/simpleeval_2daa9f08c71b461487aff36b06a2c6dc/'"'"'; __file__='"'"'/tmp/pip-install-vbc7ggk4/simpleeval_2daa9f08c71b461487aff36b06a2c6dc/'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code ='"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-prl70zwy
         cwd: /tmp/pip-install-vbc7ggk4/simpleeval_2daa9f08c71b461487aff36b06a2c6dc/
    Complete output (1 lines):
    error in simpleeval setup command: use_2to3 is invalid.
WARNING: Discarding <> (from <> Command errored out with exit [status 1](status1): python egg_info Check the logs for full command output.
  Downloading simpleeval-0.8.1.tar.gz (7.6 kB)
Building wheels for collected packages: simpleeval
  Building wheel for simpleeval ( ... done
  Created wheel for simpleeval: filename=simpleeval-0.8.1-py3-none-any.whl size=7772 sha256=e1e7512ac0bbbc726213ec37646e5597ae433f7f0f7530ebd4c21f0a57e946f2
  Stored in directory: /tmp/ced/.cache/pip/wheels/13/ab/c5/bf031b20b20522e1ea9d5a4b23f1458262d83795d9b8f8f4e3
Successfully built simpleeval
Installing collected packages: simpleeval
Successfully installed simpleeval-0.8.1

So the problem is linked to the setuptools release v58.0.0 which drop support for 2to3 that simpleeval uses for all the version which support Python3. So pip pick an very old one for which setuptools does not fail but that is not Python 3 compatible.

I'm wondering if a temporary solution (until is published) would not be to add an entry in trydevpi to point to a "Tryton" fork of simpleeval that remove the 2to3 keyword like that our CI will pick this one.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-10-02.10:21:43
Author: [hidden] (hodeinavarro)
Date: 2021-09-17.14:26:46

The python version was not changed anywhere between yesterday Sep 16, 2021 1:42pm GMT+0200 and Sep 16, 2021 6:37pm GMT+0200 which is when I first noticed the problem.

My .gitlab-ci.yml is set to use the python:3.7 images, which last update was 9 days ago and tox.ini is the default from Tryton cookiecutter

I've opened a discuss to track this since the bug post is invalid.

Thank you.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-09-17.13:29:15

You must install a version of simpleeval that is compatible with your Python version.

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-09-17.13:00:08

El 17/9/21 a les 12:47, Hodei Navarro Peon ha escrit:

It seems that the problem relies more on the simpleeval version than the virtualenv version.

The problem is that a wrong simpleeval version is installed (0.8.1) while a newer one exists.
Installing the right version fixes the problem.

So for me is a packaging issue.

Author: [hidden] (hodeinavarro)
Date: 2021-09-17.12:47:44

It seems that the problem relies more on the simpleeval version than the virtualenv version.

Indeed changing virtualenv to != 20.8.0 fixed my problem, since it installs the simpleeval 0.9.10 version, but having a look at a recent drone test made by @Pokoli, it seems that even though it installed virtualenv 20.8.0, simpleeval 0.9.10 got installed, so I can not fill an issue at virtualenv repository.

I will upload three files with the dependencies of 3 cases, maybe you can help me to locate the problematic one.

Case 1: No forced deps (Test failed)
Case 2: Forced virtualenv != 20.8.0
Case 3: Forced simpleeval > 0.8.1

Author: [hidden] (pokoli) Tryton committer Tryton translator
Date: 2021-09-17.12:03:58

If this is related to virtualenv it should be related there.

Could you please do so and add the link back here?

Author: [hidden] (hodeinavarro)
Date: 2021-09-17.11:55:52

Since yesterday after virtualenv updated to 20.8.0 I'm having trouble with some of my modules tests.

Test installation dependencies from pip install tox psycopg2:

Successfully installed backports.entry-points-selectable-1.1.0 distlib-0.3.2 filelock-3.0.12 importlib-metadata-4.8.1 packaging-21.0 platformdirs-2.3.0 pluggy-1.0.0 psycopg2-2.9.1 py-1.10.0 pyparsing-2.4.7 six-1.16.0 toml-0.10.2 tox-3.24.4 typing-extensions- virtualenv-20.8.0 zipp-3.5.0

Test installation dependencies from my module, command tox -e py37-postgresql + 3-4 custom modules from our repository:

py37-postgresql installed: Babel==2.9.1,click==7.1.2,Flask==1.1.4,Flask-Babel==2.0.0,flask-tryton==0.10.0,Flask-WTF==0.15.1,Genshi==0.7.5,itsdangerous==1.1.0,Jinja2==2.11.3,lxml==4.6.3,MarkupSafe==2.0.1,passlib==1.7.4,Pillow==8.3.2,polib==1.1.1,psycopg2==2.9.1,python-barcode==0.13.1,python-dateutil==2.8.2,python-magic==0.4.24,python-sql==1.3.0,python-stdnum==1.16,pytz==2021.1,relatorio==0.10.0,simpleeval==0.8.1,six==1.16.0,trytond==6.0.7,trytond-account==6.0.3,trytond-account-invoice==6.0.3,trytond-account-invoice-stock==6.0.0,trytond-account-product==6.0.2,trytond-company==6.0.4,trytond-country==6.0.1,trytond-currency==6.0.1,trytond-party==6.0.2,trytond-product==6.0.2,trytond-purchase==6.0.3,trytond-sale==6.0.2,trytond-stock==6.0.7,trytond-stock-lot==6.0.0,trytond-stock-lot-sled==6.0.0,trytond-stock-package==6.0.1,trytond-stock-secondary-unit==6.0.0,trytond-web-user==6.0.0,Werkzeug==1.0.1,wrapt==1.13.0rc3,WTForms==3.0.0a1

Full traceback:

Traceback (most recent call last):
  File "", line 168, in <module>
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/setuptools/", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.7/distutils/", line 148, in setup
  File "/usr/local/lib/python3.7/distutils/", line 966, in run_commands
  File "/usr/local/lib/python3.7/distutils/", line 985, in run_command
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/setuptools/command/", line 223, in run
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/setuptools/command/", line 232, in run_tests
  File "/usr/local/lib/python3.7/unittest/", line 100, in __init__
  File "/usr/local/lib/python3.7/unittest/", line 147, in parseArgs
  File "/usr/local/lib/python3.7/unittest/", line 159, in createTests
  File "/usr/local/lib/python3.7/unittest/", line 220, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/local/lib/python3.7/unittest/", line 220, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/local/lib/python3.7/unittest/", line 154, in loadTestsFromName
    module = __import__(module_name)
  File "/builds/ingsys/sga/tests/", line 2, in <module>
    from trytond.modules.sga.tests.test_sga import suite
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/trytond/modules/sga/", line 4, in <module>
    from . import sale
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/trytond/modules/sga/", line 21, in <module>
    from import SaleValidationError
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/trytond/modules/sale/", line 5, in <module>
    from . import sale
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/trytond/modules/sale/", line 22, in <module>
    from import TaxableMixin
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/trytond/modules/account/", line 11, in <module>
    from . import move_template
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/trytond/modules/account/", line 6, in <module>
    from simpleeval import simple_eval
  File "/builds/ingsys/sga/.tox/py37-postgresql/lib/python3.7/site-packages/", line 168, in <module>
    "int": int, "float": float, "str": unicode}
NameError: name 'unicode' is not defined
ERROR: InvocationError for command /builds/ingsys/sga/.tox/py37-postgresql/bin/python test (exited with code 1)

I solved this using pip install "virtualenv!=20.8.0" --upgrade before pip install tox pyscopg2 and just in case I added RUN pip3 install "virtualenv!=20.8.0" --upgrade in my Dockerfile.

Date User Action Args
2021-10-23 13:15:11roundup-botsetmessages: + msg71260
2021-10-08 19:15:05roundup-botsetmessages: + msg70787
nosy: + roundup-bot
status: testing -> resolved
2021-10-02 11:41:37reviewbotsetmessages: + msg70553
nosy: + reviewbot
2021-10-02 11:16:44cedsetassignedto: ced
keyword: + review
reviews: 383171002
status: chatting -> testing
2021-10-02 10:39:36cedsetmessages: + msg70552
2021-10-02 10:21:43cedsetmessages: + msg70551
status: invalid -> chatting
2021-09-17 14:26:46hodeinavarrosetmessages: + msg70184
2021-09-17 13:29:15cedsetcomponent: - account
messages: + msg70181
nosy: + ced
status: chatting -> invalid
2021-09-17 13:00:08pokolisetmessages: + msg70179
2021-09-17 12:48:05hodeinavarrosetfiles: + case_no_forced_deps.txt

Showing 10 items. Show all history (warning: this could be VERY long)