I need to be able to pip install Python modules, and I'm new to computer programming. I keep getting the same invalid syntax errors.
Here's the exact error. Unfortunately it's not much to go on:
>>> pip install beautifulsoup4
File "<stdin>", line 1
pip install beautifulsoup4
^
SyntaxError: invalid syntax
Here's what I've read and tried:
Ran cmd as administrator.
All pip attempts have been in the command line, not the Python shell or editor.
Every permutation I can find in the textbook, online, or youtube: "pip install requests", "pip -m install requests", "C:/...Scripts> pip install requests", and several others.
Tried uninstalling and reinstalling a different version of Python, both 32- and 64-bit. (Windows is 64-bit, but 32-bit has better compatibility, I hear.)
Hit the docs hard for install, pathway (it's correct and the command line recognizes Python 3.5.2) and pip.
I'm losing it here. Any suggestions would be greatly appreciated, save one. Do not tell me that I need to be running the install script in the command line, not in Python. I have never ran it in Python.
Related
I am running Python 3.8.3. Previously I had Python 3.6 installed.
When I try to install by pip e.g.
pip install requests
I get the error
Fatal error in launcher: Unable to create process using '"c:\users\myname\appdata\local\programs\python\python36\python.exe" "C:\Users\MyName\AppData\Local\Programs\Python\Python36\Scripts\pip.exe" install requests'
Uninstalling Python 3.6 did not resolve this. I also tried reinstalling pip from https://pypi.org/project/pip/#files.
How can I get pip working again so I can install packages again?
On a side note, the reason I installed 3.8.3 in the first place instead of continuing with 3.6 was that Windows opened its app store any time the python command was used in PowerShell. I figured I might as well download the new version, since at the time I saw no reason to fight it. Still, it would be nice to know how to stop Windows from commandeering this.
If typing python in your command prompt opens python 3.6 then try py -3 or another possible PATH variable you have set for python 3.8
then to use pip for just that python version do the following command
[PATH VARIABLE] -m pip install [py-package]
e.g.
python -m pip install requests
When you are runing pip install requests, it runs the first pip it finds on th path. You can see from the error message, that it is using c:\users\myname\appdata\local\programs\python\python36\python.exe, so you are not really installing anything for Python 3.8.
If running python on your computer runs Python 3.8, then I suggest using this option to run pip:
python -m pip install requests
And if you have to enter full path to start python3.8, than do that:
/full/path/to/python.exe -m pip install requests
I can't install any python modules that require python 2.7 or later. I have uninstalled everything that Mac would let me that was related to python 2, and I run everything on python 3. I am completely lost. I am on Mac and whenever I try to install a module(like praw) this pops up.
I used the command
pip install praw
Collecting praw
Using cached https://files.pythonhosted.org/packages/41/89/94c1ec81a05536e2c2a1dc2e8f5402c8ad65963f28948bf41c64621e238b/praw-6.5.0-py2-none-any.whl
ERROR: Package 'praw' requires a different Python: 2.7.16 not in '>=3.5' ```
Welcome to Stack Overflow Malachi! I believe you're looking for the command pip3 (pip3 install praw) to install Python 3 packages through pip. If you open your terminal and type man pip to get the manual page, there is a line that says:
pip is the command to use when installing packages for Python 2, while pip3 is the command to use when installing packages for Python 3.
Looks like the most recent version of praw requires Python 3.5 or greater.
The last version that supported Python 2.7 was praw 5.4.0. If you're still using Python 2.7 and need this package, try running
pip install praw==5.4.0
If you're using Python 3.x, check to see if you're using the right version of pip. If you have both Python 2 and Python 3 installed on your system, you'll likely need to install system wide packages using pip3 instead if pip. In this case, try running
pip3 install praw
Alternatively, if you're targeting a specific Python interpreter (e.g. python3.7, python3.8, etc), and want to be certain that you are using the correct pip executable for your interpreter, you can run pip as a Python package via
python3 -m pip <args>
where python3 can be replaced by any interpreter path.
Okay, so, I'm running Python 3.4.3 with pip 9.0.1, with the setuptools and wheel.
I'm running this inside JetBrains PyCharm Professional 2017.2.3.
The issue I'm having is trying to install the twitter api packages from this tutorial (ya I'm a n00b) http://wiki.openhatch.org/Twitter
I'm struggling with installing the 4 dependencies mentioned in the first part of the tutorial (httplib2, simplejson, oauth2 and python-twitter)
Honestly, I'm just getting back into programming and this is a project I'd like to complete.
So, I need help with:
Installing pip, and how to use it, and where (python shell or command line or)
the dev.twitter.com website (and where to find what I need from there)
Any help is massively appreciated and sorry if I sound really n00by, but do correct me where I'm using incorrect terms etc because that's how I learn I guess :)
If you haven't got pip installed, find your python installation file.Execute it and choose 'Change Python Installation'. Now choose 'pip' to install and 'add python.exe to path'. Wait for it to finish. Now run windows command line and type:
pip install package_name
Sometimes you may experience that a package isn't available on pip or doesn't work.There are 2 common (not always working) ways to install a package without making pip download the file:
1) A package may be available as a .whl file for download.Download it.Now find it and copy its name .Open a command line in dictionary where it is located and type
pip install **now paste the filename and add .whl**'
2)A package is available as a zip file.Packages are often packed into a zip file.Download the file and extract it.Open a command line in it's directory.You may see setup.py file.Run
python setup.py install
When finished installing pip and adding python to path,you can run:
pip install httplib2 simplejson oauth2 python-twitter
Done.
Once you have pip installed, open the command prompt and just type pip install name_of_the_extension.
In this case, pip install httplib2 will install this package.
I believe you have pip installed on your computer, so it shouldn't be a problem to install the 4 packages you need.
I've got a problem while I want to install couple packages for python 3.4.
The problem appears while I want to type pip. Any commands after word pip, easy_install are giving the same error. Installed get-pip.py before but the error still occurs:
C:\Users\Konrad>pip
Fatal error in launche: Job information querying failed
I'm running windows10 x64. The cmd was in admin mode.
Aby suggestions? I typed that error message through google, but there weren't any helpful answers.
Running python just works and launches Python 3.4.3.
That doesn't look like the Python pip command. You have a different pip executable in the way somewhere.
Use python -m pip as a work-around; it'll use Python to find the module and use it as a command-line tool (which is explicitly supported):
python -m pip install <something>
I'm currently stuck on exercise 46 in Zed Shaw's "Learn Python the Hardway". He says I need to install the following python packages:
pip
distribute
nose
virtualenv
He doesn't give the reader any directions on how to properly install the packages and use them. I went to the pip website but the directions were also very vague and kind of unhelpful for a newbie. The installation guide found on https://pip.pypa.io/en/latest/installing.html says to download the get-pip.py file and then run it by typing python get-pip.py in what I presume to be terminal.
When I do that it starts downloading, then says cleaning up.. and then a red error message appears that says:
Exception:
Traceback (most recent call last):"
followed by a bunch of file names before ending with
"OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip
Does anyone know how to correct this? If it helps, the get-pip.py file is in my downloads folder, so I did cd Downloads before running python get-pip.py"
You can do:
sudo easy_install pip
or install it with homebrew: http://mxcl.github.io/homebrew/
and then:
brew install python
The error-message is IMHO pretty clear - you are not allowed to write into the given directory.
The reason for this is that you use the system-provided Python 2.7. While installing pip shouldn't break it, I personally would rather download a Python 2.7 installer, install it, and then do
$ /Library/Frameworks/Python.framework/Versions/2.7/bin/python get-pip.py
This should install pip into this python, and place the pip-executable at the same location as just given
$ /Library/Frameworks/Python.framework/Versions/2.7/bin/pip
If you insist on using the system python, make it "sudo python get-pip.py". But I wouldn't mess with my system python unless forced to.