Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip is error,TypeError: __call__() takes exactly 2 arguments (1 given)

Tags:

pip

python-2.7

system

  • centos 7.2
  • Python 2.7.5

install

I install webhook

pip install webhook ### but hava error,then yum install python-devel -y ## go on,pip doesn't workding pip 

error

Enter the command contain pip.Then

[root@location src]# pip Traceback (most recent call last): File "/usr/bin/pip", line 5, in <module> from pkg_resources import load_entry_point File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 72, in <module> import packaging.requirements File "/usr/lib/python2.7/site-packages/packaging/requirements.py", line 59, in <module> MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker") TypeError: __call__() takes exactly 2 arguments (1 given) 

So,what should I do?!

like image 507
hysg Avatar asked Feb 03 '17 17:02

hysg


2 Answers

I had the same problem on a fresh virtualenv and apparently this is a conflict between the version requirements for packaging, pip and pyparsing with the new setuptools. What worked for me was to pin down the old one.

pip install setuptools==33.1.1 

Update:

As another answer pointed out, pip has already fixed the bug, so you should try upgrading it instead of using the workaround above.

python -m pip install --upgrade --force pip  
like image 146
Pedro Werneck Avatar answered Sep 28 '22 09:09

Pedro Werneck


UPDATE:

Please see the solution lower in this thread by Pedro Werneck instead of this one. It's the correct way to solve the problem.


Preface: I do not recommend this!

This seems to work, but I have no idea what the consequences could be. This is cargo cult programming at its best! I'm only adding it here in case it can help someone in a bind.

I made changes to the file requirements.py where the error occurred. For @hysg, that would be this file:

/usr/lib/python2.7/site-packages/packaging/requirements.py 

On me on OS X, it's here:

/Library/Python/2.7/site-packages/packaging/requirements.py 

I modified the the offending line by removing the parentheses for the call to MARKER_EXPR, as demonstrated below:

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

And that worked.

Again, please be careful! I don't know what I'm doing and this could potentially cause more harm than good.

like image 27
RobotNerd Avatar answered Sep 28 '22 09:09

RobotNerd