Python Forum
How Do I Install Stuff for Python?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How Do I Install Stuff for Python?
#1
I just installed Pyton on my Windows 10 PC for the first time and can't figure out how to actually use it. I am trying to install something called PIP because it is recommended by another program but the only installation instructions I can find involve using some sort of command line.

The instructions at https://pip.pypa.io/en/stable/installing/ are too vague to be of use to me.

First, I tried running the curl command using cmd.exe and it ran, but when I typed in pip -V it found nothing. I also don't know what they mean by "Then run the following command in the folder where you have downloaded get-pip.py: python get-pip.py" because I have never heard of a way to run cmd.exe in a folder. The way that is run is by opening cmd.exe which is only run out of the folder C:\Windows\System32 and not any place where you download stuff.

I ultimately want to extract names from a large body of text using http://www.nltk.org/ but I can't even get the thing installed because the instructions are all written for people that have used Python before. What I really need is a Windows specific guide for people that have never used Python before that explains every single thing that must be done.

What won't work for me is telling me to use something that itself has its own learning curve without telling me what that curve is as well. For instance I see a lot of instructions telling me to use Github but they are all using some sort command line syntax. I have used Github many times, but I always used Visual Studio's NuGet Package Manager. Is there something like that that works with Python?
Reply
#2
pip is probably already installed.
open a command window and type pip -V
it should respond with the version of pip.
to run python, again from command line, type python
it should open a shell.
You will want to install an IDE so you can edit, debug and run from the same application.
I recommend VSCode, and direct you here for installation instructions:
https://python-forum.io/Thread-VS-Code-f...ght=VSCode
Reply
#3
Thanks, PIP appears to be installed already, but the pip -V command using Windows CMD does not do anything. I am now trying to run NLTK. I successfully downloaded the zip file, unzipped it, and opened the setup file using the Python shell, but when I try to run it I get this error:

Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
=============== RESTART: C:\Users\sulli\Desktop\nltk-3.5\setup.py ==============
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

error: no commands supplied
>>>
Reply
#4
no need to download zip and unzip, etc.

just do in cmd:
Output:
pip install nltk
pip wil download and install whl file for you.
because nltk is more specific package, you need to install also data (the corpora)
see https://www.nltk.org/install.html, last step is the data

In more general sense, look at https://docs.python.org/3/installing/index.html
and always check the package docs for any specific instructions on installation

Nowadays standard way to distribute package is via whl. files. Great many packages are available on PyPi. Some packages may be more difficult to install (e.g. platform specific dependencies, additional files, need to compile something, etc.).
For some of these packages, there are prebuild whl files available from Christoph Gohlke's website. You can download a whl file and install it with pip
Output:
pip install some-whl-file.whl
Of course you can download and install whl files offline also from pypi
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
Thanks guys, I have NLTK installed and finally was able to extract some relevant data using it.

Unfortunately it seems like the output of NLTK does not allow one to narrow the output to just PERSON name entity types. I could be wrong about this.

On top of that my final goal with this project is to extract individual emails from a pdf of 900 emails, so it looks like Spacy might be a better option. Unfortunately when I try to install Spacy using the package manager in Visual Studio it will not finish installing.

Would it be possible for me to install the package to my project using GitHub or maybe the Spacy zip file I downloaded. PTVS does not appear to offer an obvious solution for Python packages beyond its default Python package manager.
Reply
#6
(May-07-2020, 09:30 PM)CopBlaster Wrote: Unfortunately when I try to install Spacy using the package manager in Visual Studio it will not finish installing.
do you get any error.

You can try to download whl and install locally again using pip.
you can install it from github or using zip, but it doesn't make sense if there is wheel file.

Note that you may need to install extra data. They have pretty good instructions on installation and interactive tool to help decide what commands to run:
https://spacy.io/usage
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#7
pip comes alreday installed when you install python.To to extract names from a large body of text, here is the code.
pip install nltk
#Let us start by importing important libraries and their submodules.

import nltk
from nltk.tokenize import word_tokenize
from nltk.tag import pos_tag
#Next, we tokenize this sentence into words by using the method ‘word_tokenize()’.Also, we tag each word with their respective Part-of-Speech tags using the ‘pos_tag()’

sent= '''Prime Minister Jacinda Ardern has claimed that New Zealand had won a big 
battle over the spread of coronavirus. Her words came as the country begins to exit from its lockdown.'''
words= word_tokenize(sent)
postags=pos_tag(words)
#The next step is to use ne_chunk() to recognize each named entity in the sentence.

ne_tree = nltk.ne_chunk(postags,binary=False)
pprint(ne_tree)

ne_tree = nltk.ne_chunk(postags,binary=True)
pprint(ne_tree)
This answer is slightly influenced by the article Named Entity Recognition by greatlearning.com.Incase you want to see the full guide. I suggest you check out that article.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Run the code for some stuff it does not return me why Anldra12 3 2,846 Apr-19-2021, 02:01 PM
Last Post: Anldra12
  "Automate the Boring Stuff with Python" creating a path works but only for CMD promt Milos 2 2,867 Nov-28-2020, 01:08 PM
Last Post: Larz60+
  Unable to print stuff from while loop Nick1507 4 2,342 Sep-17-2020, 02:26 PM
Last Post: Nick1507
  Learning to have Class and doing stuff with it... bako 2 1,991 Apr-29-2020, 05:07 PM
Last Post: bako
  Automate the boring stuff : the tic tac toe game DJ_Qu 7 6,652 Apr-24-2019, 12:22 PM
Last Post: ichabod801
  More List Stuff Zman350x 3 3,434 Mar-11-2018, 12:20 AM
Last Post: Zman350x
  Need help importing stuff that python says it cant open Tiaan 2 2,838 Nov-30-2017, 09:54 PM
Last Post: Tiaan
  Python "Automate the Boring Stuff" wants me to change Windows environment variables? Atomike 8 8,862 Dec-13-2016, 03:53 PM
Last Post: Atomike

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020