FileNotFoundError: [Errno 2] No such file or directory: 'data.jsonl'

I reinstalled that, it seems I have it, as pip shows that in pip list,
I ran through this command in cmd

python -m prodigy ( in anconda)

but when I go to the directory, It is only a jason file in .prodigy which is included

{

}
(I opened with notebook)

then I tried by
jupyter lab by this command
import prodigy

prodigy.serve('ner.teach', 'dataset', 'en_core_web_sm', 'data.jsonl',
None, None, ['PERSON', 'ORG'], None, None)

import prodigy

prodigy.serve('ner.teach', 'dataset', 'en_core_web_sm', 'data.jsonl',
None, None, ['PERSON', 'ORG'], None, None)
the result was like before
Oops, something went wrong :frowning:

morever I have this error in python
18:40:27 - Task queue depth is 1
18:40:27 - Task queue depth is 2
18:40:27 - Task queue depth is 3
18:40:27 - Exception while serving /get_questions
Traceback (most recent call last):
File "C:\Users\moha\Anaconda3\lib\site-packages\waitress\channel.py", line 356, in service
task.service()
File "C:\Users\moha\Anaconda3\lib\site-packages\waitress\task.py", line 176, in service
self.execute()
File "C:\Users\moha\Anaconda3\lib\site-packages\waitress\task.py", line 447, in execute
app_iter = self.channel.server.application(env, start_response)
File "C:\Users\moha\Anaconda3\lib\site-packages\hug\api.py", line 451, in api_auto_instantiate
return module.hug_wsgi(*args, **kwargs)
File "C:\Users\moha\Anaconda3\lib\site-packages\falcon\api.py", line 244, in call
responder(req, resp, **params)
File "C:\Users\moha\Anaconda3\lib\site-packages\hug\interface.py", line 789, in call
raise exception
File "C:\Users\moha\Anaconda3\lib\site-packages\hug\interface.py", line 762, in call
self.render_content(self.call_function(input_parameters), context, request, response, **kwargs)
File "C:\Users\moha\Anaconda3\lib\site-packages\hug\interface.py", line 698, in call_function
return self.interface(**parameters)
File "C:\Users\moha\Anaconda3\lib\site-packages\hug\interface.py", line 100, in call
return __hug_internal_self._function(*args, **kwargs)
File "C:\Users\moha\Anaconda3\lib\site-packages\prodigy\app.py", line 173, in get_questions
tasks = controller.get_questions()
File "cython_src\prodigy\core.pyx", line 129, in prodigy.core.Controller.get_questions
File "cython_src\prodigy\components\feeds.pyx", line 56, in prodigy.components.feeds.SharedFeed.get_questions
File "cython_src\prodigy\components\feeds.pyx", line 61, in prodigy.components.feeds.SharedFeed.get_next_batch
File "cython_src\prodigy\components\feeds.pyx", line 131, in prodigy.components.feeds.SessionFeed.get_session_stream
File "C:\Users\moha\Anaconda3\lib\site-packages\toolz\itertoolz.py", line 368, in first
return next(iter(seq))
File "cython_src\prodigy\components\sorters.pyx", line 151, in iter
File "cython_src\prodigy\components\sorters.pyx", line 61, in genexpr
File "cython_src\prodigy\models\ner.pyx", line 292, in call
File "cython_src\prodigy\models\ner.pyx", line 259, in get_tasks
File "cytoolz/itertoolz.pyx", line 1047, in cytoolz.itertoolz.partition_all.next
File "cython_src\prodigy\models\ner.pyx", line 209, in predict_spans
File "cytoolz/itertoolz.pyx", line 1047, in cytoolz.itertoolz.partition_all.next
File "cython_src\prodigy\components\preprocess.pyx", line 35, in split_sentences
File "C:\Users\moha\Anaconda3\lib\site-packages\spacy\language.py", line 548, in pipe
for doc, context in izip(docs, contexts):
File "C:\Users\moha\Anaconda3\lib\site-packages\spacy\language.py", line 572, in pipe
for doc in docs:
File "nn_parser.pyx", line 367, in pipe
File "cytoolz/itertoolz.pyx", line 1047, in cytoolz.itertoolz.partition_all.next
File "nn_parser.pyx", line 367, in pipe
File "cytoolz/itertoolz.pyx", line 1047, in cytoolz.itertoolz.partition_all.next
File "pipeline.pyx", line 431, in pipe
File "cytoolz/itertoolz.pyx", line 1047, in cytoolz.itertoolz.partition_all.next
File "C:\Users\moha\Anaconda3\lib\site-packages\spacy\language.py", line 746, in _pipe
for doc in docs:
File "C:\Users\moha\Anaconda3\lib\site-packages\spacy\language.py", line 551, in
docs = (self.make_doc(text) for text in texts)
File "C:\Users\moha\Anaconda3\lib\site-packages\spacy\language.py", line 544, in
texts = (tc[0] for tc in text_context1)
File "cython_src\prodigy\components\preprocess.pyx", line 34, in genexpr
File "cython_src\prodigy\components\filters.pyx", line 35, in filter_duplicates
File "cython_src\prodigy\components\filters.pyx", line 16, in filter_empty
File "cython_src\prodigy\components\loaders.pyx", line 22, in _rehash_stream
File "cython_src\prodigy\components\loaders.pyx", line 142, in JSONL
File "C:\Users\moha\Anaconda3\lib\pathlib.py", line 1176, in open
opener=self._opener)
File "C:\Users\moha\Anaconda3\lib\pathlib.py", line 1030, in _opener
return self._accessor.open(self, flags, mode)
FileNotFoundError: [Errno 2] No such file or directory: 'data.jsonl'

could you let me know what is ithe problerm

When you come across errors like that, try to always check the last output in the terminal. That will usually tell you the true error that occurred. In your case, see here:

Your command references a file data.jsonl, but that file can't be found. So maybe double-check that the relative path is correct, or use the absolute path to that file on your filesystem.

thank you for your answer, I do not have such file in my system, I only have a folder .prodigy. There is two files there
prodigy 28kb (database file)
prodigy JSON FILe (which is empty) only (1kb)
{
{
I am kind of stopped from yesterday how can I PROCEED, I reinstalled prodigy, still a problem

as it is mentioend prodigy is in my pip list.

I only used this command, since it was in one of your reply in the forum.

import prodigy

prodigy.serve(‘ner.teach’, ‘dataset’, ‘en_core_web_sm’, ‘data.jsonl’,
None, None, [‘PERSON’, ‘ORG’], None, None)

beside that I really do not know how to run pridogy from cmd

It would be nice let me know what should I do

many thanks

The data.jsonl is supposed to be the input data, so the texts you want to load in (in this case, as newline-delimited JSON – but Prodigy supports other file formats as well). If you want to annotate data, you need to load it in from a file. That's what the source argument is for.

Here's an example of such a file – this would then be text texts you're annotating:

https://raw.githubusercontent.com/explosion/prodigy-recipes/master/example-datasets/raw_news-headlines-nyt.jsonl

To get a better feeling for how Prodigy works, you might find the following links useful:

Does running it in your notebook / JupyterLab with ! not work? That's normally how you run commands from a cell. For example: !prodigy ner.teach....

To get rid of this error you can try using os.listdir() function to check that at least python sees the file exists or not.

1 Like

Try using the exact, or absolute, path. The terms absolute and relative also have their usual English meaning. A relative path shows where something is relative to some start point; an absolute path is a location starting from the top.

When you open a file with the name “filename.ext”; you are telling the open() function that your file is in the current working directory . This is called a relative path.

file = open('filename.ext') //relative path

In the above code, you are not giving the full path to a file to the open() function, just its name - a relative path. The error “FileNotFoundError: [Errno 2] No such file or directory” is telling you that there is no file of that name in the working directory. So, try using the exact, or absolute path.

file = open(r'C:\path\to\your\filename.ext') //absolute path

In the above code, all of the information needed to locate the file is contained in the path string - absolute path.

It's a common misconception that relative paths are relative to the location of the python script, but this is untrue. Relative file paths are always relative to the current working directory, and the current working directory doesn't have to be the location of your python script. . In order to make this work, the directory containing the python executable must be in the PATH, a so-called environment variable that contains directories that are automatically used for searching executables when you enter a command. In any case, if your Python script file and your data input file are not in the same directory, you always have to specify either a relative path between them or you have to use an absolute path for one of them.