pycharm pip error - AttributeError: module 'pip' has no attribute 'main'


Hi. I have a problem with pycharm's PIP

I want to install SVMlight to pycharm. 

When I was using PIP version 9.0.x, pycharm said to me 


Command "python egg_info" failed with error code 1 in C:\Users\powerkei\AppData\Local\Temp\pycharm-packaging\svmlight\
You are using pip version 9.0.1 however, version 10.0.1 is available.

You should consider upgrading via the 'python -m pip install --upgrade pip' command.

 So I upgraded pip to 10.0.1, then it said to me


AttributeError: module 'pip' has no attribute 'main'


This error confuses me... 

this post said that pip 10.0.1 doesn't support 'main'. but if I use pip 9.0.1, I can't install SVMlight...


How can I solve this problem?


I only see one short-term solution: JetBrains send out an update in which pip is called via mechanism like (non-pythonic way) 

        os.system("pip install {:s}".format(package_to_install))

The long term solution is ask  to once again support main in their PIP


Untill the update of PyCharm, you have to issue a command line request   >pip install .... 


Let me update after some further searching I found a post: 

and the solution is to use

from pip._internal import main

and there after use

main(["install", PackageToInstall])

I applied your solution, but it makes another problem...

 Complete output from command python egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\powerkei\AppData\Local\Temp\pip-install-n650w9pd\svmlight\", line 7, in <module>
lib_sources.remove('lib/svm_loqo.c') # this is an alternate backend for SVM-Light; only
ValueError: list.remove(x): x not in list

I don't know what to do. So maybe I should wait for the new pycharm version.


Thank you for your help.


Support of pip 10 was added in PyCharm 2018.1.2 (we now use runpy to launch the tool). Please update.

The last problem is unrelated to the IDE. There is an issue about Windows support on pysvmlight tracker.


This problem still persists with the latest Pycharm release. Downgrading to pip 9.0.3 solved the problem.


Which version of PyCharm do you use? Also, how did you upgrade it? It can be that for some reason you still have the old version of helper. We don't access "main" function directly there anymore.


Sorry, pip 18 does work with the latest PyCharm version:

PyCharm 2018.2.4 (Professional Edition)
Build #PY-182.4505.26, built on September 19, 2018
Windows 10 10.0


Please sign in to leave a comment.