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

Answered

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 setup.py 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...

 

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000168364-Pycharm-Virenv-AttributeError-module-pip-has-no-attribute-main-occured- 

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?

2
7 comments

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 Python.org  to once again support main in their PIP

 

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

0

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

https://github.com/nficano/python-lambda/pull/110/commits/12fd4d2caa628e0182f81a8570a51661e1c4e165 

and the solution is to use


from pip._internal import main

and there after use

main(["install", PackageToInstall])
1
Avatar
Permanently deleted user

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

 Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\powerkei\AppData\Local\Temp\pip-install-n650w9pd\svmlight\setup.py", 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.

0

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.

0
Avatar
Permanently deleted user

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

0

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 packaging_tool.py helper. We don't access "main" function directly there anymore.

0
Avatar
Permanently deleted user

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

0

Please sign in to leave a comment.