flair import failing on mac ubuntu and google colab - opennlp

i am trying to use flair nlp framework ,
https://github.com/flairNLP/flair
but getting error
# load the NER tagger
tagger = SequenceTagger.load('ner')
tried on local , remote and other machine . all failing as its not able to download a model from s3 .google colab also gives same error .
all give error message as:
OSError: HEAD request failed for url https://s3.eu-central-1.amazonaws.com/alan-nlp/resources/models-v0.4/NER-conll03-english/en-ner-conll03-v0.4.pt with status code 301.
.

I was having the same issue, I don't know what happen with the link but I found another one.
You can look flair master repo https://github.com/flairNLP/flair/blob/master/flair/models/sequence_tagger_model.py
on the def _fetch_model(model_name) line 971.
There are using another path already "https://nlp.informatik.hu-berlin.de/resources/models", so they change to that path instead of alan-nlp.
So you can find your model here https://nlp.informatik.hu-berlin.de/resources/models/ner/

I had a similar problem to this.
Note that flair now hosts the majority of their models on Huggingface.
Most likely what you need to do is install the latest version of flair which has the sequence_tagger_model.py (and probably others) pointing to the right link.
I had to uninstall flair, and then reinstall it:
pip uninstall flair
pip install flair
to ensure it worked.

Related

Fetch Google Places Data using Python

I'm trying to write a short python script which fetches data from Google Places API and exports it as a .csv file.
Unfortunately I'm stuck right at the beginning.
I want to use requests package but my machine cannot find it.
I've installed Python 3.5 on my Mac and when I use pip to install requests it says:
Requirement already satisfied: requests in /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages
But when I run the program I get an import error which says:
ImportError: No module named requests
Do you have any ideas how i can fix this issue?
Thanks in advance.
Much love.
Use python -m pip install requests instead. Your pip installation was probably for a different version.

ValueError with spacy.load('en_core_web_sm')

I'm getting
ValueError: could not broadcast input array from shape (96) into shape (128)
for
spacy.load('en_core_web_sm')
I manually downloaded and installed the model as i'm working on a work computer with download restrictions.
I have followed the instructions to download and copy from this link: https://github.com/explosion/spaCy/issues/3113
Copy the folder
Python35\lib\site-packages\en_core_web_sm
create a folder named en in
Python35\Lib\site-packages\spacy\data
, paste the copied contents to en, and rename the folder as en_core_web_sm-2.0.0.
Copy the
__init__.py
file in en_core_web_sm and paste it in en (that is, the init.py file must be in both
Python35\Lib\site-packages\spacy\data\en and
Python35\Lib\site-packages\spacy\data\en\en_core_web_sm-2.0.0
I am able to run
spacy.load('en_core_web_sm')
but am giving a ValueError instead.
Appreciate all help. Thanks!
I had the same error.
Updated spacy to version 2.1.3.
Now it is working properly.
If you are using Anaconda:
conda install -c conda-forge spacy
In order to let you use the en_core_web_sm model via the shortcut link 'en', spaCy creates a symlink. This means you need to have permissions to do this. See here for more details: https://spacy.io/usage/models#usage-link
A note in case others come across this issue later: Copy-pasting the folder and renaming it is really only the last resort if you can't run the command with admin permissions and you need to be able to load the model via spacy.load('en'). This is usually not the case – you can just install the model and load it via its full name, spacy.load('en_core_web_sm'). In fact, I often prefer this syntax, since it's more explicit and you immediately know which model is loaded.
--Copied from the same link you have mentioned in the question. No Copyright violation.
Download en through terminal then use
spacy.load("en_core_web_sm") it will work..

how can I manually install a module in qpython?

I am using qpython as a non-root user and I have googled it up but all recommendations don't work both manually and using pip...I keep on getting errors...
I get erors when I use both:
pip install requests from pip console
and:
import pip
pip.main(['install','requests']) on python console
The error is something like:
cannot fetch base url https://pypi.python.org/simple/
could not find any downloads that satisfy the condition requests
...
if there is a workaround or a fix I would be happy to accept...
Did you use the newest version(>=2.0.7) Installing requests from QPYPI works well in the newest version. https://github.com/qpython-android/qpython/releases
Yes! This fixed my problem once I used the beta v2.1 from
https://github.com/qpython-android/qpython/releases
Google play did not give me the latest version (I had 1.xx)
I was able to use QPYPY to install requests and it automatically installed the required library urllib3.

Node.js - using socks5 module

I'm on a Mac running OSX 10.8.2. I'm learning Node.js and want to do requests using socks.
In the Terminal I used
git clone https://github.com/mattcg/socks5-http-client.git
to get the socks5 http client source.
In the downloaded source folder is an example called example-tor, so I ran
node example-tor.js
This gives me a message saying "Cannot find module 'socks5-client'".
This error is being thrown in a js file in the source folder called agent.js on a line that says var socksClient = require('socks5-client');
What am I doing wrong?
To be honest, I am just beginning Node.js. I'm not sure if I fully understand how modules work, where they are located on my Mac and how Node.js is supposed to know where they are.
I have been running through the documentation, "hello world" tutorials and tutorials to install things like "npm" package manager but the whole process of getting something working seems very messy and unclear.
Hope someone can point me in the right direction.
Try running npm install from the terminal in the socks5-http-client top folder (the same one with the package.json file)

Including date and time in Tex File

The latex file is giving the following error:
! LaTeX Error: File `datetime.sty' not found.
Here is the Latex code: \usepackage{datetime}
Am I missing something?
I am using Debian 3.1 Linux Machine.
I don't use Debian myself, but if I look it up, Debian contains it in the package 'texlive-latex-extra'. If you installed LaTeX via the packet-manager of debian (I think so) the command 'apt-get install texlive-latex-extra' executed as root should install you the needed file. Alternatively you can use a graphical package-manager to install the package.
If your LaTeX Distribution does not load the package automatically, you can try to install it manually according to the readme file here: http://www.ctan.org/pub/tex-archive/macros/latex/contrib/datetime/ Edit: http://www.ctan.org/pkg/datetime
Yes, you are missing the datetime.sty file; you are probably missing the whole package too. What system are you using for managing your (La)TeX installation ? If you tell us you may get more specific advice than I can give.
You need to get the datetime package from CTAN or one of its mirrors and install it into your local texmf tree. Your LaTeX manager will do this for you. You may also be able to configure your LaTeX manager to automatically download and install packages the first time they are requested.

Resources