'pip' not recognised command when installing packages - python

I am trying to install the oauth package from the PYPI list of standard directories by submitting the following code to command prompt:
pip install oauth==1.0.1
This is to install the specific version 1.0.1 of 'oauth'. However I am getting the following error message:
pip is not recognised as an internal or external command
I am using Python 3.3 on Windows 8 and have installed Pip via Command Prompt using the code:
Get-Pip.py
What am I doing wrong?

Your python Scripts directory wasn't added to your Windows path. Typically, this path is C:\Python3x\Scripts where the x is the minor version of Python you have installed (ie. 3 for Python 3.3 or 4 for Python 3.4)
Once that is added to your path, you can open a new command prompt and use pip.
If you don't want (or can't) alter your path variable, you can also add the full path to your command to get it to work
C:\Python3x\Scripts\pip.exe install oauth==1.0.1
Again, the x will follow the above values for the minor version of Python.

Look at the subfolder \Scripts in your Python3 instalation path.
Check if there is the pip.exe file or pip3.exe or pip3.3.exe.
In my instalation there is the pip3.exe file, so I need to write pip3 install oauth==1.0.1

Related

Upgrade python to 3.10 in windows; Do I have to reinstall all site-packages manually?

I have in windows 10 64 bit installed python 3.9 with site-packages. I would like to install python 3.10.2 on windows 10 64 bit and find a way to install packages automatically in python 3.10.2, the same ones I currently have installed in python 3.9. I am also interested in the answer to this question for windows 11 64 bit.
I upgraded to python 3.10.2 in windows 10 64 bit. To properly install the packages, install the appropriate version of the Microsoft Visual C++ compiler if necessary. Details can be read https://wiki.python.org/moin/WindowsCompilers . With the upgrade to python 3.10.2 from 3.9, it turned out that I had to do it, due to errors that are appearing during the installation of the packages. Before the installing python 3.10.2, type and execute the following command in the windows command prompt:
pip freeze > reqs.txt
This command writes to the reqs.txt file the names of all installed packages in the version suitable for pip. If you run the command prompt with administrator privileges, the reqs.txt file will be saved in the directory C:\WINDOWS\system32.
Then, after the installing of python 3.10.2 and the adding it to the paths in PATH, with the help of the command prompt you need to issue the command:
pip install -r reqs.txt
This will start the installing of the packages in the same versions as for python 3.9. If problems occur, e.g. an installation error appears during the installation of lxml, then you can remove from the regs.txt file the entry with the name of the package whose installation is causing the problem and then install it manually. To edit the reqs.txt file you need the administrator privileges. The easiest way is to run the command prompt in the administrator mode, type reqs.txt and click Enter to edit it.
I decided later to update the missing packages to the latest version, because I suspected that with python 3.10.2 older versions were not compatible.
This means that when upgrading to python 3.10.2 it is worth asking yourself whether it is better to upgrade for all packages. To do this, you can generate the list of the outdated packages using the command:
pip list –-outdated
After the printing of the list in the command prompt, you can upgrade the outdated packages using the command:
pip install --upgrade <package-name>
This can be automated by the editing of the reqs.txt file and the changing of the mark == to > which will speed up the upgrade. The mark > should only be changed for the outdated packages or you will get an error: "Could not find a version that satisfies the requirement ... ".
Supplement to virtual environments:
When you enter a virtual environment directory (in the windows command prompt):, such as D:\python_projects\data_visualization\env\Scripts, type activate to activate it. Then create the reqs.txt file analogous to the description above. Then, copy the file to a temporary directory. After this delete the virtual environment, e.g. using the windows explorator by the deleting of the contents of the env directory. Then, using the version of python in windows of our choice, create a virtual environment using the env directory (see: https://docs.python.org/3/library/venv.html). Copy the regs.txt file to the newly created D:\python_projects\data_visualization\env\Scripts directory. Install site-packages with the support of the regs.txt file as described above.
No you need not reinstall python packages.
conda create --name project-env python=3.x
You can also look at an alternative method to install python versions Install python version

PIP not present in Python 3.8 for Windows

I read in the PyPa pip documentation that pip comes with Python versions above 3.4 . Meanwhile when I run the 'pip help' command on my command prompt it gives me the message below:
'pip' is not recognized as an internal or external command,
operable program or batch file.
I tried executing a suggested command from a response to a similar question yielding this:
Looking in links: c:\Users\Public\Documents\Wondershare\CreatorTemp\tmpdgjv05zc
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-19.2.3 setuptools-41.2.0
I ran 'pip' help again yet again it gave me the same tone-deaf message
'pip' is not recognized as an internal or external command,
operable program or batch file.
I can run Python files and 'py --version' gives me the version of Python I'm using. I also tried placing the 'get-pip.py' file in a folder and getting to it through command prompt. Then I executed these commands
C:\Users\User\Desktop\pyt>python get-pip.py
C:\Users\User\Desktop\pyt>py get-pip.py
C:\Users\User\Desktop\pyt>python3 get-pip.py
They were executed immediately one-after-another but now no messages appear on the screen . Instead the OS goes to the next line, ignoring my command as if I didn't already execute one.
Why is it that I don't have pip installed? How can I install it?
Typically, when installing Python, if you add it to the PATH system environment variable, both the Python3x (containing the Python executable) and the Python3x\Scripts (containing pip) folders will be added to your path.
Apparently, something has happened to your path causing only the first of those two to be on the path.
Check which Python is on the path by running where python from the command line. If that's the version of Python you expect to be using, add the Scripts folder for the same version to the path as well.
Alternatively, uninstall your version of Python and then reinstall, ensuring you check it so it adds Python to the PATH - at the end of the Windows installation, there's the option to lift PATH length restrictions, which may be your issue.
Likely you didn't add your python installation to your path (here's a how-to guide if you've never done this before). If you are on windows then add %USERPROFILE%\AppData\Local\Programs\Python\Python38\Scripts\ to your path. Change the 38 to whichever point release you installed (so if you installed python 3.7 then it would be 37 etc.).

Pip installs to anaconda directory instead python's directory (Windows)

Whenever I try to install package with pip (using wheel or just regular pip install numpy ->e.g), pip installs new package to location where Anaconda holds its site-packages. How do I remove that? That started happening since I installed Anaconda which I use for some tasks as python interpreter, but now I need my regular python installation.
If you have Python 3 installed but you see that which pip points to your Anaconda installation, try using pip3 instead - if it is available then you will see that which pip3 points to your Pythons installation path instead of your Anaconda path. Same with which python3.
Instead of just writing pip instal ... in the command line, which apparently points to your Anaconda installation, you can navigate (using the cd command) to your Python installation and invoke the pip.exe file located somewhere there.
I guess you could try renaming one of pip.exe files (the one in Anaconda or the one in Python) to something else (e.g. pipanadonda.exe), and then you will be able to call them separately from the command line.

How to install packages with pip in Windows PowerShell

I am using Python 2.7.9 on a Windows 8 computer.
I tried to install lxml by typing pip install lxmlin Windows PowerShell after typing python, but I get the following error: SyntaxError: invalid syntax
I tried installing pip by using the following tutorial http://www.tylerbutler.com/2012/05/how-to-install-python-pip-and-virtualenv-on-windows-with-powershell/ only to later realize that I already had pip.exe, pip2.7.exe and pip2.exe installed when I first installed Python. They are located in the C:\Python27\Scripts directory.
Yet, if I try something like pip help I will get an invalid syntax error.
Do I have to reinstall pip or how do I get it to work in order to install the lxml library.
Thank you for any help you can provide.
I had the same problem. You need to set the PATH environment variable, so that the system recognizes the command "pip".
If typing easy_install or pip [in PowerShell] doesn’t work, it means the Scripts folder is not in your path. Run the next command in that case (Note that this command must be run only once or your PATH will get longer and longer). Make sure to replace c:\Python33\Scripts with the correct location of your Python installation:
setx PATH "%PATH%;C:\Python33\Scripts"
Close and reopen PowerShell after running this command.
Source: http://arunrocks.com/guide-to-install-python-or-pip-on-windows/
Starting from Python versions 2.7.9 and 3.4.0, 'pip' is already included in the regular install. Check if the path to the 'Scripts' directory inside your Python installation directory is contained in your system's 'PATH' environment variable, so 'pip' can be found.
Look here for more information:
How do I install pip on Windows?
Edit: Sounds like you are trying to run pip inside python, You shouldn't get an 'invalid syntax' error through the command prompt. More like "'pip' is not recognized". Try simply just opening command prompt and typing 'pip help'

Installing Scrapy-Python and Easy_install on windows 7

I'm trying to install Scrapy on windows 7. I'm following these instructions:
http://doc.scrapy.org/en/0.24/intro/install.html#intro-install
I’ve downloaded and installed python-2.7.5.msi for windows following this tutorial https://adesquared.wordpress.com/2013/07/07/setting-up-python-and-easy_install-on-windows-7/, and I set up the environment variables as mentioned, but when I try to run python in my command prompt I get this error:
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\>python
‘python’ is not recognized as an internal or external command,
operable program or batch file.
C:\> python ez_setup.py install
‘python’ is not recognized as an internal or external command,
operable program or batch file.
C:\>
Could you please help me solve this?
Scrapy doesn't work with Python 3 as mentioned in their FAQ
you should install Python 2.7
ur is python2 syntax you are trying to install an incompatible package meant for python2 not python3:
_ajax_crawlable_re = re.compile(ur'<meta\s+name=["\']fragment["\']\s+content=["\']!["\']/?>')
^^ python2 syntax
Also pip is installed by default for python3.4
Step By Step way to install scrapy on Windows 7
Install Python 2.7 from Python Download link (Be sure to install Python 2.7 only because currently scrapy is not available for Python3 in Windows)
During pyhton install there is checkbox available to add python path to system variable click that option. Otherwise you can add path variable manually.
You need to adjust PATH environment variable to include paths to the Python executable and additional scripts.
The following paths need to be added to PATH C:\Python27\;C:\Python27\Scripts\;
If you have any other problem in adding path variable please refer to this link
3. To update the PATH open a Command prompt in administration mode and run: :\python27\python.exe c:\python27\tools\scripts\win_add2path.py.Close the command prompt window and reopen it so changes take effect, run the following command, to check ever thing added to path variable.
python -–version which will give output as Python 2.7.12 (your version might be different than mine)
pip --version which will give output as pip 9.0.1 (your version might be different than mine)
4. You need to install visual basic C++ Python complier. You can download that from Download link
5. Then you install to install libxml which python library used by scrapy. You download it by writing a command pip install libxml into command prompt.
but if you face some problem in pip installation you can download it from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml download libxml package according to your system architecture. Open command prompt into that download directory and pip install NAME_OF_PACKAGE.whl
6. Install pywin32 from Download link. Be sure you download the architecture (win32 or amd64) that matches your system
7. Then open command prompt and run this command pip install scrapy
I hope this will help in successful installing scrapy
8. For Reference use can your these links Scrapy official Page and Blog on how to install scrapy on windows
How to install Scrapy 1.4 on Python 3.6 on Windows 8.1 Pro x64
pip install virtualenv
pip install virtualenvwrapper
pip install virtualenvwrapper-win
mkvirtualenv my_scrapy_project
I advice to use virtualenv. In my example I am using name my_scrapy_project for my virtual environment.
If you want to go out of virtualenv, simply type deactivate, if you want to go back into, simply type workon my_scrapy_project.
Go to: http://landinghub.visualstudio.com/visual-cpp-build-tools
Click on button: Download Visual C++ Build Tools 2015
Install these tools.
Go to: https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
Find and download: lxml-4.1.1-cp36-cp36m-win32.whl
Move this file to your active directory in commandline and install it:
pip install lxml-4.1.1-cp36-cp36m-win32.whl
pip install scrapy
And that is all, it should work.

Categories

Resources