Since I am on a server and do not have admin privilege, I need to install my own version of python and pip locally. After installed python, I used the code python get-pip.py --user which is on the official site. I get the following return and seems pip is successfully installed. But I do not know where is the pip executable so that I cannot add it to the system environment. So where is it installed?
Collecting pip
Using cached pip-8.1.2-py2.py3-none-any.whl
Collecting setuptools
Using cached setuptools-27.2.0-py2.py3-none-any.whl
Collecting wheel
Using cached wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
Successfully installed pip setuptools wheel
On Unix, pip install --user ... drops scripts into ~/.local/bin
pip sould be somewhere around ~/.local
Related
my pip info
pip3 --version
pip 22.0.3 from /myPath/Python/3.8/lib/python/site-packages/pip (python 3.8)
while i install "ibm-db" for the lastest version, it shows
Defaulting to user installation because normal site-packages is not writeable
Collecting ibm-db
Using cached ibm_db-3.1.1.tar.gz (1.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... -
and nothing happened anymore.
what shoule I do?
thanks
Check that you have gcc and python-devel installed. If not (Assuming a Redhat derivative, something similar for others)
sudo dnf install gcc
sudo dnf install python3-devel
The pip installation seems to access some system files, despite being installed with --user, so you may have to:
sudo pip3 install --user ibm_db
You can find more info at: pypi
Successfully installed pip-21.0.1
WARNING: You are using pip version 20.2.1; however, version 21.0.1 is available.
Full trace
$ /usr/bin/python3 -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
Downloading pip-21.0.1-py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 19.7 MB/s
Installing collected packages: pip
WARNING: The scripts pip, pip3 and pip3.6 are installed in '/home/ubuntu/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-21.0.1
WARNING: You are using pip version 20.2.1; however, version 21.0.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
Despite upgrading why does it give the warning?
You don't have write permission to do the site-package upgrade re site-packages is not writeable. You can run it with sudo if you wish, although for a Debian based distribution it would be more appropriate to leave package managed files alone.
And you are not using the local version you installed re `'/home/ubuntu/.local/bin' which is not on PATH`.
To do this,
export PATH=$PATH:/home/ubuntu/.local/bin
Use sudo /usr/bin/python3 -m pip install --upgrade pip
To the best of my knowledge pip install .[extras_require here] has always worked. I can't find in any documentation when that feature was added, but I've never had any problem even on very old machines.
Is pip definitely the problem here. I could add 'pip install --upgrade pip', but I don't have merge rights to the repo that is currently having the problem.
From setup.py
extras_require={
'test': ['flake8', 'pytest>=2.9.0'],
},
In python 2.7.9
$ python --version
Python 2.7.9
$ pip --version
pip 6.0.7 from /home/travis/virtualenv/python2.7.9/lib/python2.7/site-packages (python 2.7)
$ pip install .[test]
Collecting .[test]
Could not find any downloads that satisfy the requirement .[test]
No distributions at all found for .[test]
The command "pip install .[test]" failed and exited with 1 during .
From 3.5.2:
$ python --version
Python 3.5.2
$ pip --version
pip 9.0.1 from /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (python 3.5)
$ pip install .[test]
Processing /home/travis/build/Brian-Williams/repo_python
Collecting flake8 (from refactor-me==0.1.0)
Downloading flake8-3.3.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 71kB 6.1MB/s
Requirement already satisfied: pytest>=2.9.0 in /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (from refactor-me==0.1.0)
Collecting pycodestyle<2.4.0,>=2.0.0 (from flake8->refactor-me==0.1.0)
Downloading pycodestyle-2.3.1-py2.py3-none-any.whl (45kB)
100% |███████████████���████████████████| 51kB 10.6MB/s
Collecting mccabe<0.7.0,>=0.6.0 (from flake8->refactor-me==0.1.0)
Downloading mccabe-0.6.1-py2.py3-none-any.whl
Collecting pyflakes<1.6.0,>=1.5.0 (from flake8->refactor-me==0.1.0)
Downloading pyflakes-1.5.0-py2.py3-none-any.whl (225kB)
100% |████████████████████████████████| 225kB 7.1MB/s
Requirement already satisfied: py>=1.4.29 in /home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages (from pytest>=2.9.0->refactor-me==0.1.0)
Installing collected packages: pycodestyle, mccabe, pyflakes, flake8, refactor-me
Running setup.py install for refactor-me ... - done
Successfully installed flake8-3.3.0 mccabe-0.6.1 pycodestyle-2.3.1 pyflakes-1.5.0 refactor-me-0.1.0
For your version of pip you need to run
pip install -e .[test]
to be able to install extras from a directory
I got merge access. Adding upgrade pip to the install stage of .travis.yml fixed it:
install:
# update pip to ensure extras_require format is supported
- 'pip install --upgrade pip'
- 'pip install ".[test]"'
From the successful run replacing 6.0.7 with pip-9.0.1 was the delta.
here's what I am trying to do on Coding Ground
sh-4.3$ pip install --target=. virtualenv
You are using pip version 7.1.0, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting virtualenv
Downloading virtualenv-15.0.2-py2.py3-none-any.whl (1.8MB)
100% |################################| 1.8MB 204kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv
sh-4.3$ python virtualenv.py mine
New python executable in /home/cg/root/mine/bin/python
Installing setuptools, pip, wheel...done.
sh-4.3$ . mine/bin/activate
(mine) sh-4.3$ pip install numpy
Collecting numpy
Downloading numpy-1.11.0-cp27-cp27mu-manylinux1_x86_64.whl (15.3MB)
99% |############################### | 15.3MB 43.1MB/s eta 0:00:01Killed
(mine) sh-4.3$
Why does my trying of installation of numpy keep being killed?
And how do i solve this problem?
A quick fix for this would be to add swap memory. Here's an Ubuntu example:
sudo mkdir /media/fasthdd
dd if=/dev/zero of=/media/fasthdd/swapfile.img bs=1024 count=1M
sudo mkswap /media/fasthdd/swapfile.img
sudo swapon /media/fasthdd/swapfile.img
Don't forget to turn it off if you don't need it.
Somehow pip --upgrade doesn't upgrade any packages.
I'm on OSX El Capitan (10.11.3) and installed python using brew install python
Python: /usr/local/bin/python# -> ../Cellar/python/2.7.11/bin/python
Pip: /usr/local/bin/pip# -> ../Cellar/python/2.7.11/bin/pip
After successful install I run pip install --upgrade pip.
Full output:
$ pip install --upgrade pip
Collecting pip
Using cached pip-8.1.0-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-8.0.2
You are using pip version 8.0.2, however version 8.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Why doesn't pip install the new version?
Update
I think it has something to do with my ~/.pydistutils.cfg file which fixes the DistutilsOptionError: must supply either home or prefix/exec-prefix -- not both error when running pip. I followed these instructions
Related SO question
$ sudo pip install -U pip
Collecting pip
Downloading pip-9.0.3-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 335kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-9.0.3
Getting annoyed by things not working I created a new OSX profile. In the new profile everything was working fine so after investigating further I found a file ~/Library/Application\ Support/pip/pip.conf in my main profile containing:
[global]
target=/usr/local/lib/python2.7/site-packages
I don't know how it got there but removing it resolved the issue.
This also resolved the need for the ~/.pydistutils.cfg file.