New to Python, tying to get started with NLTK. After a rough time installing Python on my Windows 7 64-bit system, I am now having a rough time downloading Wordnet and other NLTK data packages located here:
http://nltk.org/nltk_data/
Some packages download, some say "Out of Date"
import nltk
nltk.download()
When I use the above to download, the program doesn't let me cancel if I hit the cancel button.
So, I just shut it down and go directly to the link above to try and download it manually. When I try to download Wordnet for example, the download starts in my browser but stops mid-way through download!
This is very frustrating for me as a beginner. Is there an alternative way to download Wordnet for nltk?
I was facing the same issue. The issue in my case was that when the NLTK downloader started it had the server index as
http://nltk.github.com/nltk_data/
This needs to be changed to
http://nltk.org/nltk_data/
You can change this by going into the NLTK Downloader window and the File->Change Server Index.
Regards,
Bonson
Related
I'm trying to import the NLTK language modeling module (nltk.lm) in a Google colaboratory notebook without success. I've tried by installing everything from nltk, still without success.
What mistake or omission could I be making?
Thanks in advance.
.
Google Colab has nltk v3.2.5 installed, but nltk.lm (Language Modeling package) was added in v3.4.
In your Google Colab run:
!pip install -U nltk
In the output you will see it downloads a new version, and uninstalls the old one:
...
Downloading nltk-3.6.5-py3-none-any.whl (1.5 MB)
...
Successfully uninstalled nltk-3.2.5
...
You must restart the runtime in order to use newly installed versions.
Click the Restart runtime button shown in the end of the output.
Now it should work!
You can double check the nltk version using this code:
import nltk
print('The nltk version is {}.'.format(nltk.__version__))
You need v3.4 or later to use nltk.lm.
I want to get all links/html pages from website base URL. I read documents and got to know it can be achieved using python Beautifulsoup combination. Can you please let me know how to install BeautifulSoup and any other pre-requisite steps.
Once BeautifulSoup is installed, how i can use it in python code. If some one can share python code to achieve this.
The snippet in this question might help you in retrieving all the links from a base url.
Your question provides no information of your OS or specific goal. I'm assuming you already have Python installed.
pip is command line tool to manage python packages. You can run the following command on your terminal
pip install beautifulsoup4
The beautifulsoup documentation is a good place to get started on learning more.
I installed Python 2.7 on SLES 11 box that previously was running Python 2.6. To do so I used a script described in this post and run it as a root user. Everything went well but when it was done I discovered few issues:
No symbolic links were created and no path updated so I had to manually update the path to link to the new installation bin directory /opt/python2.7/bin
Everything runs good until I switch from root to the normal user at which point Python shell runs but some modules I installed such as PyYAML are missing. Again, these are OK when I run Python as root
As a regular user I'm not able to run pip, easy_install and wheel. For pip I get ImportError: No module named pkg_resources
P.S. Following #user suggestion I tried adding the following path taken from sys.path of the root user to .bashrc which did not fix the problem
export PYTHONPATH=$PYTHONPATH:/opt/python2.7/lib/python27.zip:/opt/python2.7/lib/python2.7:/opt/python2.7/lib/python2.7/plat-linux2:/opt/python2.7/lib/python2.7/lib-tk:/opt/python2.7/lib/python2.7/lib-old:/opt/python2.7/lib/python2.7/lib-dynload:/opt/python2.7/lib/python2.7/site-packages:/opt/python2.7/lib/python2.7/site-packages/PyYAML-3.11-py2.7-linux-x86_64.egg:/opt/python2.7/lib/python2.7/site-packages/pexpect-4.2.0-py2.7.egg:/opt/python2.7/lib/python2.7/site-packages/ptyprocess-0.5.1-py2.7.egg
Credible / official sources: no reply from official forum. Apart from the SO-link you mentioned, there is also https://unix.stackexchange.com/questions/7644/how-to-do-a-binary-install-of-python-2-7-on-suse-linux-enterprise-server-11, which sketches the way to do it described in Installing Python 2.7 on SLES 11 (SO is not official, is it? ;-)
Concerning your problem: both 2. and 3. might be caused by elements lacking in sys.path.
To test this, type
import sys; sys.path
both in user and root python and check for differences. These need to be merged. Try using PYTHONPATH first to test this, but be aware that there are different methods how to adjust sys.path.
If you just need to fix this for normal (non-daemon) users, adjusting the system-wide bash profile would be an easy solution.
(Any questions/feedback is welcome... :-)
I'm looking for a propper way to install numpy and pandas from a requirements.txt file as a dependency for my heroku django app without getting Timed out compiling Python app (15 minutes)
I know that there are some custom buildpacks like this conda-buildpack but I need it as a pip requirement because some other packages load it as additional dependency.
The solution I found to install numpy and pandas in two different commits leads to the problem that when I delete the heroku cache for some reason I have todo this two commits again.
So I want to ask how I can exceed the 15 minutes heroku compile time?
How you guys handle this?
I'm currently having the same issue (trying to install numpy, pandas, and bokeh and hitting the 15 minute heroku compile time limit).
Check out the comments from this answer. (The actual answer does not work/help, as explained in the comments)
Short version is in order to increase this time limit, you need to submit a Heroku Help Ticket. Internally, they can increase the time limit. Issue is it takes a few business days for them to respond to the tickets.
If you (or anyone else) finds another way to fix this error, let me know!
How do I use the mechanize library with Django?
I read online that I could put it in a directory (e.g. /lib/) and include as needed.
The problem is, the the source I had found didn't show how to use it from configuration to initial use. Unfortunately, I also looked high and low elsewhere on google with nothing to find. I also checked a book I have on django without any info..
Can anyone help me out?
I'm on a local install of django with python 2.7.
Thank you
As per comments, the answer is:
pip install mechanize
then just open a python interpreter and import mechanize to confirm.
That should be it, you can start using mechanize in your Django project.