Pip - Fatal error in launcher: Unable to create process using '"'
Asked Answered
T

39

192

I installed python 3.5.1 via ampps and it's working. However, when i try to use pip, i get the following message:

Fatal error in launcher: Unable to create process using '"'

I already reinstalled ampps into a path which doesn't include any whitespaces. Note that the "python -m pip" workaround doesn't work for me too, since i get the following message everytime i use it:

C:\Users\MyUserName\Desktop\Ampps\python\python.exe: Error while finding spec for 'pip.__main__' (<class 'ImportError'>: No module named 'queue'); 'pip' is a package and cannot be directly executed

How do i get pip to work properly? I hope, there is a way to use the pip command itself without the preceding python command.

EDIT: This is what happens, if i try to run python -c "import pip.__main__":

Traceback (most recent call last):
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\compat\__init__.py", line 11, in <module>
    from logging.config import dictConfig as logging_dictConfig
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\logging\config.py", line 30, in <module>
    import logging.handlers
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\logging\handlers.py", line 28, in <module>
    import queue
ImportError: No module named 'queue'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\__init__.py", line 13, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\utils\__init__.py", line 18, in <module>
    from pip.compat import console_to_str, stdlib_pkgs
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\compat\__init__.py", line 13, in <module>
    from pip.compat.dictconfig import dictConfig as logging_dictConfig
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\site-packages\pip\compat\dictconfig.py", line 22, in <module>
    import logging.handlers
  File "C:\Users\MyUserName\Desktop\Ampps\python\lib\logging\handlers.py", line 28, in <module>
    import queue
ImportError: No module named 'queue'
Tandem answered 13/5, 2016 at 22:9 Comment(8)
What happens when you run python -c "import pip.__main__"Flavouring
Be mindful of the current directory when using the -m and -c options. There's no script in this case, so Python just sets whatever the current directory is as sys.path[0]. So modules and packages in the current directory can shadow site modules and packages, such as pip and queue.Mountaineer
Make sure that the original installation directory is completely removed from disk and that its directories are removed from PATH, such that you're running the correct pip.exe. Also, you can upgrade pip to overwrite a bad pip.exe, which you can do via python -m pip install --upgrade pip.Mountaineer
@eryksun Every point you mentioned is observed but it doesn't help either.Tandem
@eryksun Also i can't use any python -m pip command, since they all throw "Error while finding spec for 'pip.__main__'..." alerts.Tandem
Whooph... The installation looks really broken. It misses queue module, which is a part of python standard library. Maybe it can be installed separately in ampps?Vig
it solved for me by just adding pip.exe location int into PATH environmental variable. B) (for windows)Tuning
it happened to me on Python 3.11.0 in Windows 10 with active virtualenv at Powershell console, when I change the parent folder name of my project folder name, then back to normal when I rename to its original nameBlackdamp
T
247

I fixed my issue by...

  1. downloading Python 3 at the official website and installing it via express installation
  2. Copy & Paste the standalone python into the ampps/python folder and overwriting the python version provided by AMPPS
  3. running python -m pip install --upgrade pip in cmd

Now pip and python 3 are installed in their latest version.

It seems that AMPPS doesnt't provide a full-fledged python build. So you need to update python yourself.

Thanks to y'all.

Tandem answered 14/5, 2016 at 15:22 Comment(8)
python2 -m pip install --upgrade pip for python2.7 where python2 was defined in ENV_PATH variablesSelfeffacement
Note that depending on where you installed Python, you may need to run cmd with Admin rights.Tweeny
Note that, for me (running the python.org version of Python on Windows 10), it was absolutely necessary to use the python -m pip <additional parts of command>. For example, pip install requests gave me the error noted in the question title, but python -m pip install requests installed the requests module beautifully.Mozellemozes
I had same issue...the key was as Mulder said: python -m pip install --upgrade pipAssail
Step 3 solved the issue for me. I suggest before trying steps 1 and 2, try step 3.Courthouse
I was trying to install flask-cors and was getting this error in my virtual environment. Updating the pip helped me solve this error.Sorcery
This is not an answer related to the question and it should be removed. The solution is python -m pip install --force-reinstall --upgrade pip.Neuroglia
Having the same error with pipenv. python -m pip install --upgrade pipenv resolved my pipenv issue as well. Thank you!Disrupt
D
116

This worked for me under Windows 10 x64:

Ensure that the Python directories are in the path, e.g.:

# Edit Environment variables so that variable "path" points to the new location.
# Insert these at the start of the list (or delete other Python directories), as Windows takes the first match it finds.
# Type "Win-S" then search for "Edit the System Environment Variables".
# Or see Control Panel under "System Properties".
S:\Research\bin\Python375\Scripts\
S:\Research\bin\Python375\

Then:

python -m pip install --upgrade --force-reinstall pip

In my particular case, the error was caused by shifting the Python directory to a new location.

Dubenko answered 5/12, 2019 at 10:37 Comment(2)
Worked this one: https://mcmap.net/q/14491/-why-am-i-getting-importerror-no-module-named-pip-39-right-after-installing-pipAnnuity
Haha, with 3.9.12 it tried to reinstall pip-22.1 and got this error: ValueError: Unable to find resource t64.exe in package pip._vendor.distlibWiseman
R
76

The same error, but in a different situation. I have a virtual environment, in which I ran, in the VE's \Scripts directory where pip.exe is:

pip freeze

I got the error message

Fatal error in launcher: Unable to create process using '"'

There is no space in my VE path (google that error). Then I tried python -m pip install --upgrade pip and got

Requirement already up-to-date: pip in o:\upsdowns\flask\lib\site-packages

so then I tried

python -m pip freeze

and that worked. I think it might be a path issue in the VE, but I'm OK with this workaround.

I'm adding this here because this page is high up when you google that errormessage. In other words, I didn't make a new question, even though my situation is quite different from the OP's. Possibly even, I got into that situation because I didn't add modules to the virtual environment "properly".

Anyway, I hope it helps some.

Rabbi answered 27/9, 2016 at 20:26 Comment(4)
Works like a charm. I was facing this error after moving around my Python files and trying to run ipython from PyCharmBitterweed
Thanks for the tip, I've run into many issues with pip in a virtual environment so this tip along with the others I've collected, get the job done. I would add: installing new packages in a virtual env requires the same process: 'python -m pip install newpackage'Preclinical
In case this helps someone, I got this problem in this context: https://mcmap.net/q/14035/-importing-modules-from-parent-folderSanious
first try python -m pip install --upgrade --force-reinstall pip and then do python -m pip freezeNisbet
K
36

I found a very simple solution to, (Pip - Fatal error in launcher:)

1) You must not have multiple environmental variables for the python path.

A) Goto Environmental Variables and delete Python27 in the path if you have Python 3.6.5 installed.  Pip is confused by multiple paths!!!
Karelia answered 8/5, 2018 at 7:41 Comment(3)
how do I go to environmental variables?Hazeghi
@Hazeghi - If you're using Windows 10, just try entering "environment variables" in the search bar. Look at the Path variable for both user and system. My two path variables were in conflict, since they both contained a Python path.Novelette
i did this and pip still reference to old path somehowSchwinn
R
21

run this python code:

import pip
pip.main(['install','flask']) # replace flask with the name of module you want to install

If you need to install multiple modules from a requirements.txt file,

import pip
fo = open("C:/...../requirements.txt", "r")
inp = fo.read()
ls =inp.split()     

for i in ls:
    pip.main(['install',i])
Revareval answered 6/1, 2017 at 14:40 Comment(2)
This worked for me; running pip inside of Python instead of at the Windows command prompt. I was trying to install the Brunel visualization package but Anaconda and the command prompt didn't work. Thanks for posting this alternate solution.Eade
This is great idea to circumvent the problems that Windows paths can create. Bravo! Thanks as well for including the instructions for the requirements.txt installation. I think that will help a lot of people.Mozellemozes
M
17

I apparently had Python installed in both C:\Python39 and %LocalAppData%\Programs\Python\Python39\.

I was able to fix the error by deleting the install in C:\Python39

Mountie answered 16/5, 2021 at 19:13 Comment(2)
It worked for me as wellVerdi
Same here, Thanks!Leadin
W
11

WORKING FINE !!!

Just upgrade your pip package by running below command. python3 -m pip install --upgrade pip

Note: I installed both python 3.6 and 2.7 version. Hence I explicitly specified python3

Snapshot

C:\AK>pip3 install argparse
Fatal error in launcher: Unable to create process using '"c:\python36\python.exe"  "C:\Python36\Scripts\pip3.exe" install argparse'

C:\AK>python3 -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/30/db/9e38760b32e3e7f40cce46dd5fb107b8c73840df38f0046d8e6514e675a1/pip-19.2.3-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 312kB/s
Installing collected packages: pip
  Found existing installation: pip 18.1
    Uninstalling pip-18.1:
      Successfully uninstalled pip-18.1
Successfully installed pip-19.2.3

C:AK>pip3 install argparse
Collecting argparse
  Using cached https://files.pythonhosted.org/packages/f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl
Installing collected packages: argparse
Successfully installed argparse-1.4.0
Walcott answered 26/9, 2019 at 5:26 Comment(0)
L
9

I had my environmental variables set properly and I had reinstalled Python, updated pip - nothing worked but below solution:

I solved the problem by going to folder:

C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\

and removing all versions of Python but the one that you are using. I had 3 versions of Python in this folder.

Lin answered 12/11, 2019 at 10:57 Comment(0)
Q
8

The fastest way is:

python -m pip install pip==9.0.0

If you want the latest pip, you can run

pip install -U pip

afterwards.

Quinquennial answered 3/10, 2017 at 20:3 Comment(2)
Thanks Antony. Rolling back to pip 9.0.0 from 9.0.1 worked for me. I think there is some issue with 9.0.1 version. Note that I use python3 for new builds, and use python2 to check out old codes and projects . I am using pip2 to install packages for python2.Magree
This was great. I moved my virtualenv and couldn't figure out how to change what pip was looking at based on other suggestions - so much easier to install a new pip. Thanks.Plaything
H
8

I got the same error when installed both python2 and python3 on my Windows 7.

You can use python3 -m pip install xxxxxx to install your package.

Or, fix it completely:

  1. Try to run python3 -m pip install --upgrade pip in cmd.

  2. If failed in step 1, try python3  -m pip install --upgrade --force-reinstall pip

Hal answered 8/3, 2018 at 2:50 Comment(0)
D
7

Checked the evironment path, I have two paths navigated to two pip.exe and this caused this error. After deleting the redundant one and restart the PC, this issue has been fixed. The same issue for the jupyter command fixed as well.

Diapason answered 18/7, 2018 at 10:13 Comment(1)
i have C;\Users\...Python\Python37-32Tecla
M
6

One more very basic and simple solution. Run the related python version's installation file (setup file) and click repair mode. It hardly takes one-two minutes and everything works perfectly after that :)

Malachite answered 8/7, 2017 at 12:11 Comment(1)
I tried and tried a lot of the other solutions and none of them worked. The reason yours did was because after I ran repair mode, pip was downgraded from version 10 to version 9. I had upgraded it. Version 9 worked fine, version 10 just didn't work.Salsify
H
5

I got the same error but when using tensorboard:

Fatal error in launcher: Unable to create process using '"'

I found out that the problem was caused by existing two copies of tensotboard.exe in two different directories and both directories were added to the path:

C:\Program Files\Python36\Scripts

and

C:\Users\...\AppData\Local\Programs\Python\Python36\Scripts

I removed the first one from the path and it fixed the problem.

Homestead answered 19/6, 2018 at 19:6 Comment(0)
D
4

I was trying to install "bottle" package in python 3.6.6 having pip version 18.0 on Windows. I faced the same error as follows:-

Fatal error in launcher: Unable to create process using '"c:\users\arnab sinha\python.exe"  "C:\Users\Arnab Sinha\Scripts\pip.exe" install bottle'

All I typed after that was

py -m pip install bottle

This solved my issue.

Dryer answered 13/1, 2019 at 18:33 Comment(0)
M
4

All the above answers are of great technical help. Recently I also faced the same issue due to a blunder I did with my project.

I created venv inside my project root by issuing the command python -m venv . and then for some reason I didn't like the name of my project. So I changed it and boom.

pip started behaving erratically and I searched dozens of forums thinking some corrupt file had crept inside my python installation. I didn't find any solution there that could help me. Finally, I opened my activate.bat file to know how this script was changing my environment and there I saw the old project name mentioned. Eureka!

I reverted back to my old project name and everything became smooth. Without any reinstallation. Without any change request to office admin. Without any delay.

SOLUTION: If you have changed the name of your project after creating your venv, you might face this error. Reverting the new name into the old name will save your time and effort. Also please don't forget to upvote if this answer helped.

Mutism answered 29/5, 2019 at 8:58 Comment(1)
also happened to me, the name of the project or the route of the project. I solved it returning my folder back to its original location, but thanks because you actually solved hoy to fix it. Thanks.Brinn
D
3

It happened to me using pip package, then I solved it like below:

1) First of all uninstall pip using python command

$python -m pip uninstall pip

2) Then reinstall pip package using easy_install command

$easy_install pip

3) Finally, try again pip command on command line directly, install any package

$pip install pylint

or only execute pip command

$pip
Dogface answered 15/4, 2018 at 6:24 Comment(2)
this worked for me, but I'd like to understand why this worked and not doing python -m pip install --upgrade --force-reinstall pipRodrigues
I think its happen when Python PATH is corrupted. So, pip command isn't able to modify this Python PATH to install new package; therefore you should use other tools like easy_install. This happened to me on Windows but if you want to try, you can reinstall Python environment.Tussis
R
3

I installed python 2 and python 3 both in my windows 7. After having both versions of python, I moved to download PIP.

After downloading pip via downloading the get-pip.py file and run into the command prompt and navigate to the folder containing get-pip.py file.

I Run the following command:

python get-pip.py

after downloading PIP, I was getting the following error, Fatal error in launcher: Unable to create process using '"' SOLUTION **Then what worked for me is: I just run the following below command

python3 -m pip install --upgrade pip

And my pip started working. Hope it helps !**

Rimrock answered 29/3, 2019 at 9:26 Comment(0)
P
3

For me the problem was that I was using built-in Powershell terminal in VSCode. I don't know what is causing the problem when using powershell (maybe some priviledges?) but the solution was just switching to built-in cmd inside VSCode or using Windows cmd / Powershell app.

Palingenesis answered 22/7, 2022 at 12:53 Comment(0)
S
2

My solution is quite simple, i faced the same problem

Fatal error in launcher: Unable to create process using '"'

the solution was to change the path from where i am running pip.

Supersensual answered 23/12, 2016 at 14:31 Comment(1)
Where did you change the path to?Polarization
W
2

neither of the other answers helped me case: downgrading python from 3.6 to 3.5 for using pyinstaller package.

here is the solution for this specific case:

  1. pip uninstall
  2. go to C:\Users\your-usern\AppData\Local\Programs\Python\Python36\Scripts
  3. delete the script resembling , i.e pyinstaller.exe in my case
  4. pip install

may probably work for you as well.

Wouldbe answered 9/9, 2017 at 21:16 Comment(1)
I had already reinstaller pip cause I had the same error when using pip, but after reinstall pip worker but pyinstaller still didn´t. So I reinstalled pyinstallerHazeghi
S
2

If none of the solutions mentioned above work, it can be due to environment variables pointing to two different locations. Just use where virtualenv to find the paths that are linked to virtualenv command. Run the following in cmd.

D:\>where virtualenv

The output will look like:

C:\Program Files\Python37\Scripts\virtualenv.exe

C:\Users\username\AppData\Local\Programs\Python\Python36\Scripts\virtualenv.exe

You can see there is conflicting installation of python36 and python37. I just deleted python37 folder and the conflict was resolved.

Sevik answered 30/7, 2019 at 2:30 Comment(0)
C
2

If you have a slight variation of that error message, like this: Fatal error in launcher: Unable to create process using '"[insert file path to python exe]" "[insert path to pip.exe]" ': The system cannot find the file specified.

That was due to the File unable to the actual python instillation.

Solution:

  • Create a junction folder using mklink /j [path to folder you want to create] [path you want to link the folder to] to direct it to your actual python path

This can happen if you install and uninstall a bunch of different python version and it messes up a couple registry keys. You can directly change the registry to fix it, but not recommended

Cap answered 21/1, 2022 at 12:35 Comment(0)
T
2

Anyone still struggled like me can do these; Locate yourself to:

"C:\Users\USERNAME\AppData\Local\Programs\Python\Python310\Scripts"

To download a package manually open gitbash here and enter the command below in the directory above:

$ pip.exe install "the package"

If you still want to to be able to call with "pip" or "pip3" check the website below and paste that "/script" file to the path location; https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

Tracheitis answered 26/8, 2022 at 23:52 Comment(0)
S
1

I started seeing this error after I moved my project (including its virtual environment). Deleting and recreating the virtual environment set everything right.

As RolfBly mentioned, running python -m pip freeze > somefile prior to deleting the environment allows for quick recovery: running pip -r somefile in the new environment will restore all packages.

Syck answered 13/3, 2017 at 6:29 Comment(0)
H
1

I solved it by following the steps from this website https://www.sysrecon.com/programming/python-pip-how-to-get-around-fatal-error-in-launcher-unable-to-create-process-using/

Update pip using: python -m pip install -U pip from command line after you've located the right directory in which python is installed in your machine.

Hoon answered 3/12, 2017 at 23:6 Comment(0)
C
1

For me it was an error in my path. You should directly call the script using the directory where it is stored.

C:\Users\YourUserName\AppData\Local\Programs\Python\Python36\Scripts\pip install requests

And for running python scripts you can do this:

C:\Users\Avanish\AppData\Local\Programs\Python\Python36\python -m pip install requests
Cerveny answered 12/3, 2019 at 12:52 Comment(0)
E
1

I got the same error and followed a couple of answers. I have tried to upgrade and install 9.0.0 version of pip using the commands below

python3 -m pip install --upgrade pip
python -m pip install pip==9.0.0

For both the commands I got the warning which looked like this

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))

Nothing seemed to work. I lost my patients and followed the below steps and got it working

  1. Navigate to the path "C:\Users...Python\Python37-32\Scripts"
  2. Delete the files pip ,pip3 , pip3.7
  3. Then I used the command python -m pip install pip==9.0.0 which then installed pip
  4. Then I entered the required command of pyperclip which I wanted to leverage which was pip install pyperclip

Ignore the 4th step. Adding it only to let people know I was also able to install the required pyperclip seemlessly, if at all anyone is on the same path to install some modules further

Escolar answered 14/9, 2019 at 20:17 Comment(0)
N
1

Usually this is due to python version set on your Environment Variables. Check PATH (or Path) for both System and Client variables.

If its pointing to "path/to/python-installation/Python3.x-32", change it to "path/to/python-installation/Python3.x"

Again check value on both System and Client Environment Variables

Nerveracking answered 14/10, 2019 at 16:13 Comment(0)
G
1

an easy fix here https://github.com/pypa/pip/issues/5292

This involves installing pip and easy re-installing it as below

python -m pip uninstall pip
easy_install.exe pip
Gooseneck answered 27/2, 2021 at 11:34 Comment(1)
This python -m pip uninstall pip saves a lot of time when you have class path of python (3.8) and you want to use the virtual environment (python3.6) inside script folder onlyOubre
K
1

I cleared the PATH and it helped!
I left only the latest version of python.

Karlow answered 19/3, 2022 at 16:39 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewCarpetbagger
B
0

I started seeing the

Fatal error in launcher: Unable to create process using '"'

after installing Python 3.6 onto a Windows 10 machine. I set the Path variable to point to the Python36 folder. The python command functioned correctly, but the pip command did not.

To fix the error, I opend up the command prompt shell with administrator privileges and ran the pip commands.

Blend answered 27/10, 2017 at 9:46 Comment(0)
S
0

Yes, you need to update the Python version manually.

Spender answered 19/2, 2018 at 12:2 Comment(0)
H
0

Check your Windows PATH environment variable. It has a limit of 260 characters and your python location might be past that character limit.

You can either move your Python paths higher in the path list or disable the Windows character limit as described here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

A registry key allows you to enable or disable the new long path behavior. To enable long path behavior set the registry key at HKLM\SYSTEM\CurrentControlSet\Control\FileSystem LongPathsEnabled (Type: REG_DWORD). The key's value will be cached by the system (per process) after the first call to an affected Win32 file or directory function (list follows). The registry key will not be reloaded during the lifetime of the process. In order for all apps on the system to recognize the value of the key, a reboot might be required because some processes may have started before the key was set.

The registry key can also be controlled via Group Policy at Computer Configuration > Administrative Templates > System > Filesystem > Enable NTFS long paths.

Hutment answered 27/2, 2018 at 22:1 Comment(0)
D
0

My solution is to run twine upload over the python -m argument.

So just use python -m:

python -m twine upload dist/*

Dichogamy answered 11/4, 2018 at 6:41 Comment(0)
S
0

I met the the same error as you.that is because i had transplanted my python file from D disk to e disk. after that ,when I inputed python ,it worked. pip and other exe file which has the same path as pip ,it did not work. when "python -m pip install --upgrade pip" order was inputed,pip order worked,but other exe file which has the same path as pip did not work,so i think it is not the best way. at last I unistalled my python,and re-install it.everything is okay.maybe it is not the best way for all of you ,but it is for me.

Salpinx answered 27/6, 2018 at 11:49 Comment(0)
R
0

I got this error while running the command using pip3. I have python 3.6 installed on windows. I was trying this-

pip3 install PACKAGENAME

It gave error. The solution in this particular case is simply to run the command as pip.

pip install PACKAGENAME

Raymundorayna answered 29/8, 2018 at 5:16 Comment(0)
E
0

This Works for me:

  1. Download Vs tool using Link

  2. Select specific C++ which is specified in Image Image

3. Install and restart if required.

NOTE: I am using Python 3.12.0 and windows 11.

Ellett answered 4/12, 2023 at 10:24 Comment(0)
E
0

Direct Solution (worked in windows)

Rerun:

python -m venv (same_env_name)

The missing files will be added, and the packages will still be there.

Empoverish answered 1/1 at 8:36 Comment(0)
A
-1
D:\Python36\Scripts>pip3 -V
Fatal error in launcher: Unable to create process using '"'

D:\Python36\Scripts>python3 -m pip freeze
beautifulsoup4==4.5.1
bs4==0.0.1
Naked==0.1.31
pycrypto==2.6.1
PyYAML==3.12
requests==2.11.1
shellescape==3.4.1
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.

D:\Python36\Scripts>python3 -m pip install --upgrade pip

D:\Python36\Scripts>pip3 -V
pip 9.0.1 from d:\python36\lib\site-packages (python 3.6)
Aesop answered 12/1, 2017 at 6:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.