Trying to get pip working on my Ubuntu pc. pip seems to be working for python2.7, but not for others.
Here's the problem:
$ pip Traceback (most recent call last): File "/usr/local/bin/pip", line 9, in <module> load_entry_point('pip==1.4.1', 'console_scripts', 'pip')() File "/usr/local/lib/python3.4/dist-packages/setuptools-1.1.5-py3.4.egg /pkg_resources.py", line 357, in load_entry_point def get_entry_info(dist, group, name): File "/usr/local/lib/python3.4/dist-packages/setuptools-1.1.5-py3.4.egg/pkg_resources.py", line 2394, in load_entry_point break File "/usr/local/lib/python3.4/dist-packages/setuptools-1.1.5-py3.4.egg/pkg_resources.py", line 2108, in load name = some.module:some.attr [extra1,extra2] ImportError: No module named 'pip' $ which pip /usr/local/bin/pip $ python2.7 -m pip //here can be just python, btw Usage: /usr/bin/python2.7 -m pip <command> [options] //and so on... $ python3.4 -m pip /usr/bin/python3.4: No module named pip
From the home/user/.pip/pip.log :
Exception: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run requirement_set.install(install_options, global_options, root=options.root_path) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1431, in install requirement.uninstall(auto_confirm=True) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 598, in uninstall paths_to_remove.remove(auto_confirm) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1836, in remove renames(path, new_path) File "/usr/lib/python2.7/dist-packages/pip/util.py", line 295, in renames shutil.move(old, new) File "/usr/lib/python2.7/shutil.py", line 303, in move os.unlink(src) OSError: [Errno 13] Permission denied: '/usr/bin/pip'
There's no /usr/bin/pip btw.
How can I fix this issue to work with pip and python 3.4 normally? I am trying to use pycharm, but it's package manager also stucks in this problem.
Thanks for attention!
The current version of pip works on: Windows, Linux and MacOS. CPython 3.7, 3.8, 3.9, 3.10 and latest PyPy3.
One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.
PIP is automatically installed with Python 2.7.9+ and Python 3.4+ and it comes with the virtualenv and pyvenv virtual environments.
You have pip installed for python 2, but not python 3.
Ubuntu distributes python-pip
, python3-pip
, python-setuptools
and python3-setuptools
packages, which you can install (apt-get install
etc) as necessary. Thereafter, note that pip
installs for python 2, and pip3
installs for python 3 (similar to python
, and python3
).
Setuptools could be said to provide python's "build" process for packages, and Pip provides its "install" process. Usually you want both present.
If you want the very latest pip / setuptools, you could always get it from PyPA's bootstrap site:
$ curl https://bootstrap.pypa.io/get-pip.py | python3.4
Afterwards you can install the latest setuptools for the appropriate python, e.g
$ python{2.7,3.4} -m pip install -U setuptools
If you try to install these for the system python, you might need root / sudo
.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py sudo python3 get-pip.py
confirm its installation:
pip3 --version
or
python3 -m pip --version
now go ahead and install your desired packages (for example numpy
) using:
pip3 install numpy
or
python3 -m pip install numpy
Here is the reference: https://pip.pypa.io/en/stable/installing/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With