Skip to content Skip to sidebar Skip to footer

Python Pycparser Setup Error

I am seeing the following error while setting up pyparser on CentOS 7 via pip /usr/bin/python2 -u -c 'import setuptools, tokenize;__file__='/tmp/pip-build-PMzCYU/pycparser/setup.p

Solution 1:

This appears to be caused by https://github.com/pypa/setuptools/commit/ff371f18f0076bc63da05334f7e551c1cc29e10d which was released in v34.0.0 of setuptools. This commit removed the vendoring of several packages. Also looks like this only affects new setuptools installs. Existing ones are fine on 34.0.2

Work around via hard coding the version:

pip install setuptools==33.1.1

Still working out how to fix pip usage once >= 34.0.0 is installed,

EDIT: this is by design "Setuptools no longer supports self upgrade or installation in the general case." http://setuptools.readthedocs.io/en/latest/history.html#v34-0-0


Solution 2:

Note: Running Python 2.7.10 on Macbook Yosmite, attempting install of TensorFlow, using pip. Any attempt to install or upgrade "numpy", in order to resolve Tensorflow dependency issue on 'numpy' version, generates error as follows:

TypeError: __call__() takes exactly 2 arguments (1 given)

I had installed, via pip, latest Tensorflow, which loaded many packages. This broke pip. All attempts to run pip generated same errors as post above, with final line being:

TypeError: __call__() takes exactly 2 arguments (1 given)

including the pip install setuptools==33.1.1 suggestion provided above. The TensorFlow install pooched my pip version, bad pyparser code, looks like. Remember, I'm running Python 2.7.x..

The resolution suggested to pip install setuptool==33.1.1 generates same error sequence, since the Python 2.7 parser was broken. pip and also easy_install were broken. I could not even update pip using get-pip.py. Running python get-pip.py generates essentially the same error sequence shown above. Really maximal NFG.

[So, the solution...] Found the solution piecing together from other posts: The "requirements.py" (a pyparser prgm?) has an error in it, which can be fixed by finding the code and editing the file. On my Macbook, the file is in: /Library/Python/2.7/site-packages/packaging

Find the python prgm called: requirements.py Change line 59:

MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")

To:

MARKER_EXPR = originalTextFor(MARKER_EXPR(""))("marker")

I've confirmed that this change lets pip and easy_install run again. Also, on Linux, one could also provoke the error by just running, in Python:

    from pkg_resources import load_entry_point 

Confirmed that this now works in Python 2.7.10 on Mac OS 10.10.5, after the fix to requirements.py.


Solution 3:

same solution worked for me

pip install setuptools==33.1.1 and then sudo pip install -r requirements.txt


Post a Comment for "Python Pycparser Setup Error"