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

pip 19.3 breaking on CircleCI sys.exit(main()) TypeError: 'module' object is not callable #7205

Closed
drammock opened this issue Oct 14, 2019 · 7 comments
Labels
auto-locked Outdated issues that have been locked by automation

Comments

@drammock
Copy link

Environment

  • pip version: 19.2.3
  • Python version: 3.7
  • OS: Debian

More env details can be seen on CircleCI: https://circleci.com/gh/mne-tools/mne-python/16276?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link under the heading spin up environment, and the traceback of the fail under the heading get python running

Description

our CircleCI testing environment started failing today when running pip install --user --upgrade, presumably because of a not-clean upgrade from 19.2.3 (which comes in the docker image) to 19.3.

Expected behavior
pip install --user --upgrade should work cleanly and not yield TypeError

Output

#!/bin/bash -eo pipefail
pip install --user --upgrade --progress-bar off pip numpy vtk
pip install --user --upgrade --progress-bar off -r requirements.txt
pip install --user --upgrade --progress-bar off ipython sphinx_fontawesome sphinx_bootstrap_theme "https://api.github.com/repos/sphinx-gallery/sphinx-gallery/zipball/master" memory_profiler "https://api.github.com/repos/nipy/PySurfer/zipball/master"

Collecting pip
  Downloading https://files.pythonhosted.org/packages/4a/08/6ca123073af4ebc4c5488a5bc8a010ac57aa39ce4d3c8a931ad504de4185/pip-19.3-py2.py3-none-any.whl (1.4MB)

Collecting numpy
  Downloading https://files.pythonhosted.org/packages/ba/e0/46e2f0540370f2661b044647fa447fef2ecbcc8f7cdb4329ca2feb03fb23/numpy-1.17.2-cp37-cp37m-manylinux1_x86_64.whl (20.3MB)

Collecting vtk
  Downloading https://files.pythonhosted.org/packages/51/d3/48eb121c4375f7cb15f309a597cd1355198900cb9945dfaf593fca06173a/vtk-8.1.2-cp37-cp37m-manylinux1_x86_64.whl (48.9MB)

Installing collected packages: pip, numpy, vtk
Successfully installed numpy-1.17.2 pip-19.3 vtk-8.1.2
WARNING: You are using pip version 19.2.3, however version 19.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 10, in <module>
    sys.exit(main())
TypeError: 'module' object is not callable
Exited with code 1
@pfmoore
Copy link
Member

pfmoore commented Oct 14, 2019

The --user upgrade won't have updated /usr/local/bin/pip, which will still expect to see the old version of pip. But the user install takes precedence, so what it sees is the new version.

You should either use python -m pip or use the wrapper script installed by the --user install (not sure where that gets installed, ~/.local/bin maybe?)

@drammock
Copy link
Author

thanks @pfmoore. Using python -m pip seems to have fixed it.

@F-29
Copy link

F-29 commented Oct 15, 2019

Environment

OS: Windows 10 Build 18362

hi,
i uninstalled it (via : python -m pip uninstall pip) and
reinstalled , and it works.

@qmeeus
Copy link

qmeeus commented Oct 17, 2019

Same here in docker image, switching from pip install --upgrade pip to python -m pip install --upgrade pip worked

qmeeus added a commit to qmeeus/balanced-view that referenced this issue Oct 17, 2019
@Ozer0
Copy link

Ozer0 commented Nov 7, 2019

Try with

python -m pip install --upgrade --user [name_of_your_package]

It worked for me in pip 19.3.1 (November 2019)

@been-there-done-that
Copy link

The solution which worked for my situation is simply editing the pip3.8 file in the ubuntu environment.

Method1:

#!/path/to/.venv/bin/python3
# -*- coding: utf-8 -*-
import re
import sys

from pip._internal.main import main  # <--- look at this import statement! 

if __name__ == '__main__':
     sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
     sys.exit(main())

method2:

The main function has to be imported or we can simply replace line

sys.exit(main())

As

sys.exit(main.main())

@Danielmrg
Copy link

python -m pip install --user -U pip

c0state added a commit to c0state/dotfiles that referenced this issue Dec 28, 2019
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jan 12, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 12, 2020
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jan 12, 2020
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
Projects
None yet
Development

No branches or pull requests

7 participants