0

I am facing an issue which has been discussed at length, and in many many forums, github issues, stack overflow questions, and so on.

To name a few:

Error in anyjson setup command: use_2to3 is invalid error in suds-jurko setup command: use_2to3 is invalid error in ibm_db setup command: use_2to3 is invalid Problem with simpleeval installation:use _2to3 invalid https://github.com/liftoff/pyminifier/issues/132 https://github.com/Thibauth/python-pushover/issues/42 https://github.com/odoo/odoo/issues/76144

For me installing or downgrading setuptools to a version less than setuptools<58.0 does not seem to fix the problem.

In order to test it I am creating a virtual environment using python3.7.9

(venv) ➜  headache git:(superbranch) ✗ python --version
Python 3.7.9

(venv) ➜  headache git:(superversion) ✗ pip --version
pip 23.1.2 from /local/venv/lib/python3.7/site-packages/pip (python 3.7)

The library in question is vatnumber==1.2 and no, I am not able to change that version, so I need to solve the build problem without changing the version of that dependency.

My setup tools are:

(venv) ➜  headache git:(superversion) ✗ pip show setuptools
Name: setuptools
Version: 57.5.0
Summary: Easily download, build, install, upgrade, and uninstall Python packages
Home-page: https://github.com/pypa/setuptools
Author: Python Packaging Authority
Author-email: distutils-sig@python.org
License: UNKNOWN
Location: /local/venv/lib/python3.7/site-packages
Requires: 
Required-by: 

And for completeness, this is the error

  Downloading vatnumber-1.2.tar.gz (19 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in vatnumber setup command: use_2to3 is invalid.
      [end of output]
  

Running the same command using -vvv shows that when in a virtual environment a pip subprocess is initiated and setuptools is being upgraded to a version which does satisfy and internal vatnumber requirement, however it ignores the installed setup tool.

  Running command pip subprocess to install build dependencies
  Using pip 23.1.2 from /local/venv/lib/python3.7/site-packages/pip (python 3.7)
  Collecting setuptools>=40.8.0
    Using cached setuptools-67.7.2-py3-none-any.whl (1.1 MB)
  Collecting wheel
    Using cached wheel-0.40.0-py3-none-any.whl (64 kB)
  Installing collected packages: wheel, setuptools
    Creating /tmp/pip-build-env-bswyzp5y/overlay/bin
    changing mode of /tmp/pip-build-env-bswyzp5y/overlay/bin/wheel to 775
  Successfully installed setuptools-67.7.2 wheel-0.40.0
  Installing build dependencies ... done
  Running command Getting requirements to build wheel
  error in vatnumber setup command: use_2to3 is invalid.```

I would like to ask, if anyone has stumbled upon a similar situation, or if anyone can provide any help in order to dig deeper into the issue and solve the build problem. I have no way of pinning the setuptools version in this instance.

Fotis Paraskevopoulos
  • 1,001
  • 2
  • 12
  • 19

0 Answers0