I am trying to build the python api for an open source project called Zulip and I keep running into the same issue as indicated by the screenshot below.
I am running python3 and my pip version is 10.0.0. The file in question is setup.py
and the code that is messing up is when the pip.main()
attribute is accessed to install a package.
Now, I know this build should succeed because its an open source project, but I have been trying for hours to fix the dependency issue regarding pip.main()
.
Any help would be greatly appreciated.
It works well:
To verify whether is your
pip
installation problem, try usingeasy_install
to install an earlier version of pip:If this succeed,
pip
should be working now. Then you can go ahead to install any other version ofpip
you want with:Or you can just stay with
version 9.0.1
, as your project requires version >= 9.0.Try building your project again.
Pip 10.0.* doesn't support main.
You have to downgrade to pip 9.0.3.
First run
If the result is '10.0.0', then it means that you installed pip successfully
since pip 10.0.0 doesn't support pip.main() any more, you may find this helpful
https://pip.pypa.io/en/latest/user_guide/#using-pip-from-your-program
Use something like
import subprocess subprocess.check_call(["python", '-m', 'pip', 'install', 'pkg']) # install pkg subprocess.check_call(["python", '-m', 'pip', 'install',"--upgrade", 'pkg']) # upgrade pkg
Edit: pip 10.0.1 still doesn't support main
You can choose to DOWNGRADE your pip version via following command:
python -m pip install --upgrade pip==9.0.3
Not sure about Windows. But for mac users, use this:
I fixed this problem upgrading to latest version
My version: pip 18.1 from /Library/Python/2.7/site-packages/pip (python 2.7)