Can't use pip to install flask [duplicate] - python

I have installed python 3.5 on my Windows 7 machine. When I installed it, I marked the check box to install pip. After the installation, I wanted to check whether pip was working, so I typed pip on the command line and hit enter, but did not respond. The cursor blinks but it does not display anything.
Please help.
Regards.

Add the Script folder of python to your environment path
or you can do this from command line:
python -m pip install package-name

go the windows cmd prompt
go to the python directory
then type python -m pip install package-name

run it at the cmd window, not inside the python window. it took me forever to realize my mistake.

I was having the same problem on Windows 10, This is how I fix it:
Click the search icon and type System Environment
In System Properties click on Environment Variables
In System Variables tab click New
Enter PYTHON3_SCRIPTS for the variable name and C:\Users\YOUR USER NAME\AppData\Local\Programs\Python\Python38-32\Scripts for Variable Value. Don't forget to change (YOUR USER NAME) in the path with your user, And to change your Python version or just go to this path to check it C:\Users\YOUR USER NAME\AppData\Local\Programs\Python
Click OK
Click NEW again!
Enter PYTHON3_HOME for the variable name and C:\Users\YOUR USER NAME\AppData\Local\Programs\Python\Python38-32\ for Variable Value. Don't forget to change (YOUR USER NAME) in the path with your user, And to change your Python version or just go to this path to check it C:\Users\YOUR USER NAME\AppData\Local\Programs\Python
Click OK
Find Path in the same tab select it and click Edit
Click New and type %PYTHON3_SCRIPTS% Then click OK
Now, everything is set. Restart your Terminal and pip should be working now.

I had the same problem with Version 3.5.2.
Have you tried py.exe -m install package-name? This worked for me.

As soon as you open a command prompt, use:
python -m pip install --upgrade pip
then
python -m pip install <<package-name>>

If you are working in Pycharm, an easy way is go to file>setting>project interpreter. Click on the + icon you will find on right side probably and then search and install required library.

For those with several python versions of python 3 installed in windows: I solved this issue by executing the pip install command directly from my python35 Scripts folder in cmd...for some reason pip3 pointed to python 34 even though python 35 was set first in environmental variables.

I had the issue, and answered this same question sometimes ago. Do open a cmd if in windows OS or linux OS with admistrative privilege. Then python -m pip install --upgrade pip
then
python -m pip install <>

Working on windows and above version than 3.0
First upgrade pip to pip3 by following command:
pip3 install --upgrade setuptools pip
Then install maximum package by following command:
pip3 install <package_name>
I never wrote all package because some package not support to pip or pip3 command.

Related

Problem with install pyinstaller with pip [duplicate]

Whenever I try to install a new python package I get this message first :
Defaulting to user installation because normal site-packages is not writeable
even though I have administrator rights and I am running my py scripts and installation commands on my computer.
Any ideas why I keep getting this message before every and each pip installation?
Thanks in advance
While this most likely is to be avoided, the only option I found to work is to use the --ignore-installed switch such as:
pip install -U --ignore-installed python-openstackclient
as root which allowed python to overwrite all old distro files with the correct new versions.
This is an old question, but it mirrored my problem well. After running python3 -m virtualenv myproject, it created myproject/local/bin/activate instead of myproject/bin/activate, and after sourcing this file, pip3 install some_package would report Defaulting to user installation because normal site-packages is not writeable and proceed to install packages as the user rather than the virtual environment.
The fix for both issues was:
sudo pip3 uninstall virtualenv
sudo apt install -y python3-virtualenv
This second command will be different for non-Debian distributions.
I had this problem. you can copy packages file to AppData>Roaming>Python>Python3.(X)>script directory
work for me!
first I need to ask when you open cmd, is python added to path? when you type 'python' in cmd does something happen? If not, try to add python to path, otherwise if that doesn't work, try re-installing python. Also which version of python do you have? Does this happen with every package you try to install? Finally if nothing works, try to change the download location of python, and run cmd as admin/without admin, try both.
For anyone who does not wanna reinstall python, if u get the defaulter message, then all you have to do is go to AppData>Roaming>Python>Python3.(X)>site-packages. Cut the folders that are related to the package(U can identify by seeing the date modified), and paste the folders in originally installed python.exe destination then>Lib>site-packages. Hopefully when you restart the code editor modules will work. I did this and it worked.

Pip is not installed with python 3.7.3 even i did selected it on install

I installed python to my new computer (Windows 7). I needed to use pip to install packages but I couldn't find it in the folder where it was supposed to be located.
I have tried to bootstrap it
python -m ensurepip --default-pip
and get-pip.py didn't work either (Got a bunch of errors)
I have looked for the folder it should be in to make sure I was looking in the right place
import os
import sys
print (os.path.dirname(sys.executable) + '\Scripts\\')
which gives
'C:\Users\Dell\AppData\Local\Programs\Python\Python37-32\Scripts\'
as an output (Folder where I was looking in the first place). That folder is empty. I have 'show hidden files, folders and drives' on, I have searched for it from my entire computer, re-installed python and tried older (and 3.7.4 since it was released the time i noticed that pip was missing) versions, i have even added that empty folder to PATH and called for pip to make sure that it isn't just hidden from me. I have ran a repair and modify on installer too. Am I just missing some obvious step or is something wrong elsewhere?
Double-Click again on your python3.7 Windows x86 executable installer (i.e: setup.exe file). Then follow this pattern click on Modify > pip > add python to environment variable
Finally click on install and its done . * Note I am using python3.6.7 but the steps are same for python3.7.3
If you are having trouble installing pip just do the following things.
Install Python 3x normally.
Go to properties of my computer -> Advance system settings -> new -> give vairable name as Path and variable value as the location of Python scripts and save it in my case it is.
C:\Users\Atharva\AppData\Local\Programs\Python\Python37-32\Scripts
Restart your computer and open cmd.
now you can use pip commands.
You should consider upgrading via the 'python -m pip install –upgrade pip' command.
Thats all
Type the following command in a CMD window:
python -m ensurepip --default-pip
This will download and install pip as a package. This code worked for me.

How can i make computer read a python file instead of py?

I have a problem with installing numpy with python 3.6 and i have windows 10 64 bit
Python 3.6.6
But when i typed python on cmd this appears
Python is not recognized as an internal or external command
I typed py it solves problem but how can i install numpy
I tried to type commant set path =c:/python36
And copy paste the actual path on cmd but it isnt work
I tried also to edit the enviromnent path through type a ; and c:/python 36 and restart but it isnt help this
I used pip install nupy and download pip but it isnt work
Try pip3 install numpy. To install python 3 packages you should use pip3
On Windows, the py command should be able to launch any Python version you have installed. Each Python installation has its own pip. To be sure you get the right one, use py -3.6 -m pip instead of just pip.
You can use where pip and where pip3 to see which Python's pip they mean. Windows just finds the first one on your path.
If you activate a virtualenv, then you you should get the right one for the virtualenv while the virtualenv is active.

Python pip is not working

I am using Python 3.4 on Windows 7.
I need to install the six module, I have pip installed on my C.
The problem is, whenever I type pip on my cmd nothing happens.
I made sure that my environment variables are set correctly but I am still facing the problem.
Try adding the pip executable to your path.
Show us your path variable, you can see it by typing this at a cmd prompt:
echo %PATH%
Do you know where pip is actually installed? On my Windows VM it's here:
c:\Python34\Scripts\pip.exe
That would mean you need C:\Python34\Scripts in your path.
Just download this file https://bootstrap.pypa.io/get-pip.py and then run python get-pip.py.
In my case, to know my pip version, I have to do it as follows
py -m pip --version

pip install access denied on Windows

I am trying to run pip install mitmproxy on Windows, but I keep getting access denied, even with cmd and PowerShell using the Run as Administrator option.
WindowsError: [Error 5] Access is denied: 'c:\\users\\bruno\\appdata\\local\\temp\\easy_install-0fme6u\\cryptography-0.9.1\\.eggs\\cffi-1.1.2-py2.7-win-amd64.egg\\_cffi_backend.pyd'
How can I make this work?
For Windows, in Command Prompt (Admin) try to run pip install using the Python executable:
python -m pip install mitmproxy
This should work, at least it worked for me for other package installation.
Change your Python installation folder's security permissions by:
Open a Python shell
Go to task manager
Find the python process
Right-click and open location
The folder will open in explorer, go up a directory
Right-click the folder and select properties
Click the security tab and hit 'edit'
Add everyone and give them permission to Read and Write.
Save your changes
If you open cmd as admin; then you can do the following:
If Python is set in your PATH, then:
python -m pip install mitmproxy
Personally, I found that by opening cmd as admin then run
python -m pip install mitproxy
seems to fix my problem.
Note:- I installed python through chocolatey
One additional thing that has not been covered in previous answers and that often cause issues on Windows and stopped me from installing some package despite running as admin is that you get the same permission denied error if there is another program that use some of the files you (or pip install) try to access. This is a really stupid "feature" of Windows that pops up many times, e.g. when trying to move some files.
In addition I have no clue how to figure out which program locks a particular file, so the easiest ting to do is to reboot and do the installation before starting anything, in particular before running e.g. Spyder or any other Python-based software. You can also try to close all programs, but it can be tricky to know which one actually holds a file. For a directory for example, it is enough that you have an Explorer window open at that directory.
As, i am installing through anaconda Prompt .In my case, it didn't even work with python -m pip install Then, i add this
python -m pip install <package_name> --user
It works for me.
Like: python -m pip install mitmproxy --user
Another you should try that run the Command Prompt as Run as Administrator and then try pip install. It should work either.
Open cmd with "Run as administrator" and execute the command pip install mitmproxy. It will install it.
Try to give permission to full control the python folder.
Find the python root directory-->right button click-->properties-->security-->edit-->give users Full Control-->yes and wait the process finished.
It works for me.
The cause in my case was having a jupyter notebook open, which was importing the relevant library; the root cause seems to be windows error due to the file being open / in use (see also #Robert's answer, and the recommendation to reboot).
So another thing to verify is that no other python processes are running.
For me, shutting down the notebook server solved the issue.
Try to delete the folder c:\\users\\bruno\\appdata\\local\\temp\\easy_install-0fme6u manually and then retry the pip command.
When all else fails, try quitting your IDE. I had many cases in which PyCharm was causing this. As soon as I quit PyCharm, I was able to finally install my packages from the command line. Alternatively, you can also install through PyCharm itself in Settings -> Project: xxx -> Project Interpreter -> +.
Opening command prompt As Administrator just worked for me without using Python executable.
Right click on command prompt shortcut and choose "Run as Administrator".
Then run the following command.
pip install Django
In my case,
Windows Defender is blocking the process and every time I run a pip command it will show pop up of security threat.
What I do is exclude the python folder.
Below are the steps:
Click the Windows icon, search "Windows Security" app, and open it
Choose Virus & threat protection on the left menu
Scroll down to Virus & threat protection settings
Click Manage settings
Scroll down to Exclusions
Click Add or remove exclusions
Click Add an exclusion, and choose Folder
Navigate to this path C:\Users{Your_User}\AppData\Local\Programs\Python
Select folder
Relaunch your Command prompt
Sometimes you just need to make sure you do not have any python environments running.
I met a similar problem.But the error report is about
[SSL: TLSV1_ALERT_ACCESS_DENIED] tlsv1 alert access denied (_ssl.c:777)
First I tried this https://python-forum.io/Thread-All-pip-install-attempts-are-met-with-SSL-error#pid_28035 ,but seems it couldn't solve my problems,and still repeat the same issue.
And Second if you are working on a business computer,generally it may exist a web content filter(but I can access https://pypi.python.org through browser directly).And solve this issue by adding a proxy server.
For windows,open the Internet properties through IE or Chrome or whatsoever ,then set valid proxy address and port,and this way solve my problems
Or just adding the option pip --proxy [proxy-address]:port install mitmproxy.But you always need to add this option while installing by pypi
The above two solution is alternative for you demand.
In my case, it didn't even work with python -m pip install
What I have done is, from a cmd as administrator:
PsExec.exe -i -s -d cmd.exe
In order to spawn a SYSTEM cmd, then pip install mitmproxy
;)
Open Command Prompt as Administrator.
To Install any Python Package use this command including --user.
pip install --ignore-installed --upgrade --user <packagename>
Had the same problem when installing pycaret.
I've solved in two different ways (that I'll list below).
Option 1
Upgraded pip with
python -m pip install --user --upgrade pip
Then
pip install --user pycaret[full]
Found a relevant discussion on the error here.
Option 2
Assuming one is using Anaconda, open Anaconda prompt, for the environment one is working with, as admin
And run
pip install --user pycaret[full]
or
pip install pycaret[full]
I also work in secure environment, Hence for install module I use this code:-
pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org
in last add your library name , such as :
pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org numpy
Run cmd.exe as an administrator then type:
python -m pip install
Running cmd as administrator solved for me. You can also try --user.
If you do not want to repeat the steps you need to give full access to anaconda folder.
Just close all the python files opened. And try to run as administrator. It will work.
e.g.
pip install mitmproxy

Categories