Python Version 2.7
On windows 10 64bits
pip install <whatever>
command not working.
C:\new_software\Python27\Scripts>python -m ensurepip
Requirement already satisfied: setuptools in c:\new_software\python27\lib\site-packages\setuptools-28.8.0-py2.7.egg
Requirement already satisfied: pip in c:\new_software\python27\lib\site-packages\pip-9.0.1-py2.7.egg
C:\new_software\Python27\Scripts>python -m ensurepip --upgrade
Requirement already up-to-date: setuptools in c:\new_software\python27\lib\site-packages\setuptools-28.8.0-py2.7.egg
Requirement already up-to-date: pip in c:\new_software\python27\lib\site-packages\pip-9.0.1-py2.7.egg
C:\new_software\Python27\Scripts>pip install wheel
failed to create process.
C:\new_software\Python27\Scripts>python -m install pip install pip
C:\new_software\Python27\python.exe: No module named install
I have python 3.x and 2.7; in 3.x pip works fine; only in 2.7 it aint.
Based on reading articles online: I have completed:
1.environment variable set up.
2.python VC++ installed
Thank you all for your response. I read the link shared by #cricket_007.
Solution:
Update all .py files [firstline] inside /Scripts folder with current path of Python Home. You will notice it will be pointing to an older location.
Then try running pip command from new CMD prompt, should work fine.
Related
I'm not sure I understand what's going on here, since I create a virtual environment and it seems to be using the "all users" installation, but whenever I update pip, it does so in a user-specific folder?
I've just installed the latest Python version (using the Windows installer from python.org). I carefully selected the custom installation option and selected to add Python to environment variables and "install for all users", so I saw how the default user folder changed to C:\Program Files\Python39, as seen here:
Then I tried to update pip (from version 21.1.1 to 21.1.2) so I ran python -m pip install --upgrade pip and got this message:
Defaulting to user installation because normal site-packages is not
writeable Requirement already satisfied: pip in c:\program
files\python39\lib\site-packages (21.1.1) Collecting pip Using
cached pip-21.1.2-py3-none-any.whl (1.5 MB) Installing collected
packages: pip WARNING: The scripts pip.exe, pip3.9.exe and pip3.exe
are installed in
'C:\Users\Currentuser\AppData\Roaming\Python\Python39\Scripts' 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.1.2 WARNING: You are using pip version
21.1.1; however, version 21.1.2 is available. You should consider upgrading via the 'C:\Program Files\Python39\python.exe -m pip install
--upgrade pip' command.
So what's with this C:\Users\Currentuser\AppData\Roaming\Python\Python39 folder?
If I run pip --version` I get:
pip 21.1.2 from
C:\Users\Currentuser\AppData\Roaming\Python\Python39\site-packages\pip
(python 3.9)
So it looks like it has created a user-only installation in C:\Users\Currentuser\AppData\Roaming\Python\Python39?
The problem is that now I have 2 versions, and venv uses the old one. I created a C:\Users\Currentuser\Desktop\test folder and then created a virtual environment within it. In this environment, pip list shows me it uses the old pip version:
Package Version
---------- -------
pip 21.1.1
setuptools 56.0.0
WARNING: You are using pip version 21.1.1; however, version 21.1.2 is available.
You should consider upgrading via the 'c:\users\currentuser\desktop\test\my-venv\scripts\python.exe -m pip install --upgrade pip' command.
So how do I prevent Python from using this C:\Users\Currentuser\AppData\Roaming\Python\Python39 folder and force it to use the C:\Program Files\Python39\ I installed to?
I am trying to install ansible on CentOS 8 but no success, After searching google i did following steps
yum install python3-pip
pip3 install ansible
but it shows following output and no ansible avaiable
[root#okd1 ~]# pip3 install ansible
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Requirement already satisfied: ansible in ./.local/lib/python3.6/site-packages
Requirement already satisfied: jinja2 in ./.local/lib/python3.6/site-packages (from ansible)
Requirement already satisfied: PyYAML in /usr/lib64/python3.6/site-packages (from ansible)
Requirement already satisfied: cryptography in /usr/lib64/python3.6/site-packages (from ansible)
Requirement already satisfied: MarkupSafe>=0.23 in ./.local/lib/python3.6/site-packages (from jinja2->ansible)
Requirement already satisfied: idna>=2.1 in /usr/lib/python3.6/site-packages (from cryptography->ansible)
Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python3.6/site-packages (from cryptography->ansible)
Requirement already satisfied: six>=1.4.1 in /usr/lib/python3.6/site-packages (from cryptography->ansible)
Requirement already satisfied: cffi!=1.11.3,>=1.7 in /usr/lib64/python3.6/site-packages (from cryptography->ansible)
Requirement already satisfied: pycparser in /usr/lib/python3.6/site-packages (from cffi!=1.11.3,>=1.7->cryptography->ansible)
i tried to manually download and install but still no success
curl -o ansible.rpm https://releases.ansible.com/ansible/rpm/release/epel-7-x86_64/ansible-2.8.5-1.el7.ans.noarch.rpm
[root#okd1 ~]# yum install ansible.rpm
Last metadata expiration check: 0:09:14 ago on Wed 25 Sep 2019 05:39:22 PM EDT.
Error:
Problem: conflicting requests
- nothing provides python-setuptools needed by ansible-2.8.5-1.el7.ans.noarch
- nothing provides python-six needed by ansible-2.8.5-1.el7.ans.noarch
- nothing provides PyYAML needed by ansible-2.8.5-1.el7.ans.noarch
- nothing provides python-jinja2 needed by ansible-2.8.5-1.el7.ans.noarch
- nothing provides python-paramiko needed by ansible-2.8.5-1.el7.ans.noarch
- nothing provides python2-cryptography needed by ansible-2.8.5-1.el7.ans.noarch
- nothing provides sshpass needed by ansible-2.8.5-1.el7.ans.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
then tried to deploy these packages but no success
[root#okd1 ~]# pip3 install python-setuptools
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting python-setuptools
Could not find a version that satisfies the requirement python-setuptools (from versions: )
No matching distribution found for python-setuptools
[root#okd1 ~]#
[root#okd1 ~]# pip2 install python-setuptools
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip2 install --user` instead.
Collecting python-setuptools
Could not find a version that satisfies the requirement python-setuptools (from versions: )
No matching distribution found for python-setuptools
You see one warning, which you should take very seriously if you don't want to destroy files, that were installed via yum packages. which is
Running pip install with root privileges is generally not a good idea.
Try pip3 install --user instead.
I suggest to try using a virtualenv. Using a virtualenv reduces the probability to destroy an existing setup and allows you to have different package versions per virtualenv. Just do not forget to activate your virtualenv before pip installing into it.
Unfortunately Ansible has (had at least when I used it last time) a small issue, that it will not be able to install packages if you use a virtualenv which does not include system site packages, so I'm not 100% sure, you will be successful.
I try to walk you through following:
1.) install virtualenv (either with yum or with pip install, but in order to not destroy anything in your existing setup you'd use pip install with the --user option)
2.) create a virtualenv for python3 with system site packages enabled as you will have issues with ansible and package installation otherwise
3.) enable your virtualenv (Do not forget this!)
4.) Check that you really enabled your virtualenv
5.) pip install ansible with the -U option
Try out ansible and specify the path to the python executable of your virtualenv in with the ansible_python_interpreter setting of ansible ( https://docs.ansible.com/ansible/latest/reference_appendices/interpreter_discovery.html )
Collecting python-setuptools
You might try to use a virtualenv in order to avoid conflicts with existing packages.
You might try something like:
sudo pip install --user virtualenv # or install virtualenv with yum if you know the package name.
then
virtualenv -p $(which python3) /root/ansiblevenv --system-site-packages
now activate the virutalenv
. /root/ansiblevenv/bin/activate # do not forget the space between the . and the /
Now check, that the active python is the one of the virtualenv
type python
you should see /root/ansiblevenv/bin/python instead if 'usr/bin/python' if not the virtualenv is not enabled properly
Now update pip (just in case)
pip install -U pip
and now try to install ansible
pip install -U ansible
You can also use the below steps to install Ansible on CentOS 8.
Step 1: Installation of EPEL repository
Ansible is not available in the default repository. So, to install it, we have to enable the EPEL repository. Firstly, we are going to install epel-release. Use the below command to install it.
sudo dnf -y install epel-release
Note: you can also use yum command instead of dnf
Step 2: Installing Ansible on CentOS 8
let’s install Ansible. Use the below command for this installation.
sudo dnf -y install ansible
Once the installation is completed, then use the below command to verify the version.
ansible --version
That's it. But you can read more about ansible installation on CentOS8 related commands for managed node and other details. You can visit my blog post for Ansible. You can use the URL below.
How to install and configure Ansible on CentOS 8
I'm new to Windows and using the command line. I'm having issues with how the path works.
I installed Python 3 using Anaconda on a Windows 10, and I'm using a virtual environment that doesn't seem to recognize python.
$ python --version
bash: python: command not found
In the command line, Python is installed, but many packages like Flask and Pandas also aren't being recognized. I've used pip install, which works correctly
$ pip install flask
Requirement already satisfied: flask in c:\users\dta\anaconda3\lib\site-packages (1.0.2)
Requirement already satisfied: click>=5.1 in c:\users\dta\anaconda3\lib\site-packages (from flask) (6.7)
Requirement already satisfied: itsdangerous>=0.24 in c:\users\dta\anaconda3\lib\site-packages (from flask) (0.24)
Requirement already satisfied: Werkzeug>=0.14 in c:\users\dta\anaconda3\lib\site-packages (from flask) (0.14.1)
Requirement already satisfied: Jinja2>=2.10 in c:\users\dta\anaconda3\lib\site-packages (from flask) (2.10)
Requirement already satisfied: MarkupSafe>=0.23 in c:\users\dta\anaconda3\lib\site-packages (from Jinja2>=2.10->flask) (1.0)
twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
But then running a program with either of those packages doesn't work and I get a result like this one:
Traceback (most recent call last):
File "app.py", line 1, in <module>
import flask
ModuleNotFoundError: No module named 'flask'
It seems like the path is set, but there's some issue with the command line recognizing it correctly. I've uninstalled and then reinstalled Python and made sure to check the box ‘Add Python to PATH’ during the installation but nothing has worked. Any ideas on how to fix this?
You most likely do not have Anaconda on your Path. Try:
echo %PATH%
if [Mini|Ana]conda is not there, open Anaconda CMD. Start typing on wundows Start Menu. In that, conda command should work. Type where conda. It show where conda is: then do something like
SETX PATH “%PATH%;%USERPROFILE%\Anaconda3\Scripts;%USERPROFILE%\Anaconda3”
This will set anaconda to Path. Close and Restart CMD
If you have different environments, try
conda env list
To activate your environment:
conda activate environmentName
Remember to use conda install ... over pip as it deals with upgrades and downgrade for compatibility issues.
if Anaconda is there, then you must have another Python their too that comes before Anaconda. That will be selected over Anaconda, unless you rearrange that Anaconda comes first before it.
If you do not want that, you can simply create an environment:
conda create -n awesome python=3.7
Then activate it and install your packages there:
conda activate awesome
conda install flask
python -V # Python 3.7
To see where Python looks for packages do:
python -c "import sys;print(sys.path)"
See where it is looking for packages.
So I've installed python via homebrow. When I do brew info python I get this:
python: stable 3.6.5 (bottled), devel 3.7.0rc1, HEAD
Interpreted, interactive, object-oriented programming language
https://www.python.org/
/usr/local/Cellar/python/3.6.5_1 (5,107 files, 103.0MB) *
Poured from bottle on 2018-06-18 at 10:15:49
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb
==> Dependencies
Build: pkg-config ✔, sphinx-doc ✘
Required: gdbm ✔, openssl ✔, readline ✔, sqlite ✔, xz ✔
Optional: tcl-tk ✘
==> Options
--with-tcl-tk
Use Homebrew's Tk instead of macOS Tk (has optional Cocoa and threads support)
--devel
Install development version 3.7.0rc1
--HEAD
Install HEAD version
==> Caveats
Python has been installed as
/usr/local/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python/libexec/bin
If you need Homebrew's Python 2.7 run
brew install python#2
Pip, setuptools, and wheel have been installed. To update them run
pip3 install --upgrade pip setuptools wheel
You can install Python packages with
pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.6/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
I'm ultimately trying to do pip3 install numpy but when I do that, I get this message:
-bash: pip3: command not found
pip install numpy seems to point to the Apple default 2.7 python version:
Requirement already satisfied: numpy in /Library/Python/2.7/site-packages (1.14.5)
So the problem seems to be in my .bash_profile as which python gives /usr/bin/python.
Here's what that looks like:
export PATH=/usr/local/bin:$PATH
export PATH=/usr/local/Cellar/python/3.6.5_1/bin:$PATH
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
export PATH=$PATH:/Users/thammond/Library/Android/sdk/platform-tools
###########
export PATH=/usr/local/Cellar/postgresql\#9.6/9.6.6/bin:$PATH
###########
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
I confirmed that /usr/local/ was listed at the top and also tried adding in export PATH=/usr/local/Cellar/python/3.6.5_1/bin:$PATH
But it's still finding the wrong python. Any ideas where I'm going wrong?
EDIT:
When I run python3 -m ensurepip --upgrade I see this:
Requirement already up-to-date: setuptools in ./Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already up-to-date: pip in ./Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
When I run python3 -m ensurepip -vvv -U I get this:
Ignoring indexes: https://pypi.python.org/simple
0 location(s) to search for versions of setuptools:
Skipping link /var/folders/7d/xvqc5yxs10n6206lytrbs9wm0000gn/T/tmpk6_9t6c2 (from -f); not a file
Skipping link file:///private/var/folders/7d/xvqc5yxs10n6206lytrbs9wm0000gn/T/tmpk6_9t6c2/pip-9.0.3-py2.py3-none-any.whl; wrong project name (not setuptools)
Found link file:///private/var/folders/7d/xvqc5yxs10n6206lytrbs9wm0000gn/T/tmpk6_9t6c2/setuptools-39.0.1-py2.py3-none-any.whl, version: 39.0.1
Local files found: /private/var/folders/7d/xvqc5yxs10n6206lytrbs9wm0000gn/T/tmpk6_9t6c2/setuptools-39.0.1-py2.py3-none-any.whl
Installed version (39.2.0) is most up-to-date (past versions: 39.0.1)
Requirement already up-to-date: setuptools in ./Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
0 location(s) to search for versions of pip:
Found link file:///private/var/folders/7d/xvqc5yxs10n6206lytrbs9wm0000gn/T/tmpk6_9t6c2/pip-9.0.3-py2.py3-none-any.whl, version: 9.0.3
Skipping link file:///private/var/folders/7d/xvqc5yxs10n6206lytrbs9wm0000gn/T/tmpk6_9t6c2/setuptools-39.0.1-py2.py3-none-any.whl; wrong project name (not pip)
Local files found: /private/var/folders/7d/xvqc5yxs10n6206lytrbs9wm0000gn/T/tmpk6_9t6c2/pip-9.0.3-py2.py3-none-any.whl
Installed version (10.0.1) is most up-to-date (past versions: 9.0.3)
Requirement already up-to-date: pip in ./Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Cleaning up...
When I look in /usr/local/Cellar/python/3.6.5_1/bin/ with finder I don't see a pip/pip3 file.
Did you try to invoke /usr/local/Cellar/python3/3.6.5_1/bin/pip3 ? If it works, it means pip installation has been successfuly completed and your bashfile will be wrong. However, the bashfile looks normal for me.
Did you confirm that there is pip3 in /usr/local/Cellar/python3/3.6.5_1/bin/?
If it does not exist, pip is not installed in the first place.
It seems to have the same problem with this page ("pip3 not installed with python 3.4.2 #33897").
The questioner of "pip3 not installed with python 3.4.2 #33897" have finaly solved it by removing /private/var/folders/hy/l_6wd1ps0nz835v4g41zhhtr0000gn/T/pip_build.
It may be because of Brew had failed to complete pip installation.
First, to bootstrap the pip installer, hit python3 -m ensurepip --upgrade and python -m ensurepip.
If it won't work, try to hit python3 -m ensurepip -vvv -U and tell what do it say.
I'm not really sure why it worked this time but just for kicks I decided to uninstall and reinstall python from homebrew again but this time it worked and pip3 installed correctly and works.
brew uninstall python3
brew install python3
now I can run pip3 install numpy --user
I develop for both Python 2 and 3.
Thus, I have to use both pip2 and pip3.
When using pip3 - I receive this upgrade request (last two lines):
$ pip3 install arrow
Requirement already satisfied (use --upgrade to upgrade): arrow in c:\program files (x86)\python3.5.1\lib\site-packages
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in c:\program files (x86)\python3.5.1\lib\site-packages (from arrow)
Requirement already satisfied (use --upgrade to upgrade): six>=1.5 in c:\program files (x86)\python3.5.1\lib\site-packages (from python-dateutil->arrow)
You are using pip version 7.1.2, however version 8.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
My default pip is for Python 2, namely:
$ python -m pip install --upgrade pip
Requirement already up-to-date: pip in /usr/lib/python2.7/site-packages
However, none of the following explicit commands succeed in upgrading the Python 3 pip:
$ python -m pip3 install --upgrade pip3
/bin/python: No module named pip3
$ python -m pip install --upgrade pip3
Collecting pip3
Could not find a version that satisfies the requirement pip3 (from versions: )
No matching distribution found for pip3
$ python -m pip install --upgrade pip3.4
Collecting pip3.4
Could not find a version that satisfies the requirement pip3.4 (from versions: )
No matching distribution found for pip3.4
What is the correct command to upgrade pip3 when it is not the default pip?
Environment:
$ python3 -V
Python 3.4.3
$ uname -a
CYGWIN_NT-6.1-WOW 2.5.2(0.297/5/3) 2016-06-23 14:27 i686 Cygwin
Just use the pip3 command you already have:
pip3 install --upgrade pip
The installed project is called pip, always. The pip3 command is tied to your Python 3 installation and is an alias for pip, but the latter is shadowed by the pip command in your Python 2 setup.
You can do it with the associated Python binary too; if it executable as python3, then use that:
python3 -m pip install --upgrade pip
Again, the project is called pip, and so is the module that is installed into your site-packages directory, so stick to that name for the -m command-line option and for the install command.
When I searched for "how to update pip3" this came up. I had the problem described here in mind:
The Problem
Upgrading with pip3 might make point pip to the Python 3 version.
It seems as if this is not the case (any more).
The solution
Update the one you want to keep after the one you want to upgrade. Hence
pip3 install --upgrade pip
pip2 install --upgrade pip --force-reinstall
will make sure that pip points to pip2.