Environment
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
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?)
thanks @pfmoore. Using python -m pip seems to have fixed it.
OS: Windows 10 Build 18362
hi,
i uninstalled it (via : python -m pip uninstall pip) and
reinstalled , and it works.
Same here in docker image, switching from pip install --upgrade pip to python -m pip install --upgrade pip worked
Try with
python -m pip install --upgrade --user [name_of_your_package]
It worked for me in pip 19.3.1 (November 2019)
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())
python -m pip install --user -U pip
Most helpful comment
The
--userupgrade 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 pipor use the wrapper script installed by the--userinstall (not sure where that gets installed,~/.local/binmaybe?)