Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'pip' has no attribute 'main' #5493

Closed
egregius313 opened this issue Jun 11, 2018 · 5 comments
Closed

module 'pip' has no attribute 'main' #5493

egregius313 opened this issue Jun 11, 2018 · 5 comments
Labels
auto-locked Outdated issues that have been locked by automation resolution: duplicate Duplicate of an existing issue/PR

Comments

@egregius313
Copy link

Environment

  • pip version: 10.0.1
  • Python version: 2.7, 3.5, 3.6
  • OS: all

Description

When trying to use pip from within Python scripts, I tended to use pip.main frequently (I also used it in the repl whenever I needed to install something). However, with the pip 10 release, pip.main was removed with no deprecation period.

I could understand removing the main function, but why was it removed without a deprecation period?

Expected behavior

pip.main should return a function which accepts the arguments in the way subprocess.run would expect.

How to Reproduce

$ pip install --upgrade pip
$ python
>>> from pip import main
...
AttributeError: module 'pip' has no attribute 'main'
@pfmoore
Copy link
Member

pfmoore commented Jun 11, 2018

There's no need for a deprecation period for something that was never documented or supported.

Sorry you were hit by this unexpectedly, but we publicised the change for a long time (6 months or more) before the release. We did our best to let everyone know - sorry that you slipped through the cracks.

As you say, pip.main doesn't offer anything that subprocess.run doesn't, and subprocess.run is supported, as well as being more robust. (I imagine you never tried to use pip.main alongside threads, or your own custom loggers...)

Closing this as we're not going to reverse this decision. See #5080 for further discussion (this issue is essentially a duplicate of that one).

@mungojam
Copy link

mungojam commented Aug 9, 2018

@pfmoore

The documentation still lists pip install as the method for installing things in most places. There's only one place I could see that it listed python -m pip install

I know have found the other issue. I hadn't realised that was a general guide and that pip install should actually still work.

@pfmoore
Copy link
Member

pfmoore commented Aug 9, 2018

@mungojam I'm not sure what you're trying to say here. Do you feel that the documentation could be improved? If so how? You're always welcome to raise a PR with suggested improvements in the wording.

@mungojam
Copy link

mungojam commented Aug 9, 2018

Sorry, no. I had got the impression from lots of googling that pip install was no longer supported as the way to install packages. But now that I've read #5080, I see that it is still supported and the problem is mostly due to the prompt to upgrade which was what got me into the broken state.

I don't have the option to change my PATH at work, so I've just uninstalled my user version of pip and will stick with v9 for now.

Nothing further needed

@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation resolution: duplicate Duplicate of an existing issue/PR
Projects
None yet
Development

No branches or pull requests

4 participants