"Internal Server Error" when try to load localhost8080 for NER annotation

Hi,
Can you please help? Yesterday, my locally run Prodigy stopped working. I run the command in terminal and it all looks fine, but then when I open http://localhost:8080 I get the message "Internal Server Error" on the webpage, and the following appears in Terminal:

prodigy ner.manual evaluation_tagging_dev blank:en /Users/aoifefinn/Documents/Documents–TeHikuMacBookAir/Te_Hiku/Experiments/Eval1-dev-1.txt --label ADJ,AUX,CCONJ,DET,NOUN,NUM,PRON,PROPN,VERB

Using 9 label(s): ADJ, AUX, CCONJ, DET, NOUN, NUM, PRON, PROPN, VERB

:sparkles: Starting the web server at http://localhost:8080 ...
Open the app in your browser and start annotating!

Task exception was never retrieved
future: <Task finished name='Task-3' coro=<RequestResponseCycle.run_asgi() done, defined at /Users/this_user/opt/anaconda3/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py:388> exception=AttributeError("'str' object has no attribute 'decode'")>
Traceback (most recent call last):
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 393, in run_asgi
self.logger.error(msg, exc_info=exc)
File "/Users/this_user/opt/anaconda3/lib/python3.8/logging/init.py", line 1471, in error
self._log(ERROR, msg, args, **kwargs)
File "/Users/this_user/opt/anaconda3/lib/python3.8/logging/init.py", line 1585, in _log
self.handle(record)
File "/Users/this_user/opt/anaconda3/lib/python3.8/logging/init.py", line 1594, in handle
if (not self.disabled) and self.filter(record):
File "/Users/this_user/opt/anaconda3/lib/python3.8/logging/init.py", line 807, in filter
result = f.filter(record)
File "cython_src/prodigy/util.pyx", line 121, in prodigy.util.ServerErrorFilter.filter
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/uvicorn/protocols/http/httptools_impl.py", line 390, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/uvicorn/middleware/proxy_headers.py", line 45, in call
return await self.app(scope, receive, send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/fastapi/applications.py", line 140, in call
await super().call(scope, receive, send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/applications.py", line 134, in call
await self.error_middleware(scope, receive, send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/middleware/errors.py", line 178, in call
raise exc from None
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/middleware/errors.py", line 156, in call
await self.app(scope, receive, _send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/middleware/cors.py", line 76, in call
await self.app(scope, receive, send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/middleware/base.py", line 25, in call
response = await self.dispatch_func(request, self.call_next)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/prodigy/app.py", line 198, in reset_db_middleware
response = await call_next(request)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/middleware/base.py", line 45, in call_next
task.result()
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/middleware/base.py", line 38, in coro
await self.app(scope, receive, send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/exceptions.py", line 73, in call
raise exc from None
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/exceptions.py", line 62, in call
await self.app(scope, receive, sender)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/routing.py", line 590, in call
await route(scope, receive, send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/routing.py", line 208, in call
await self.app(scope, receive, send)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/routing.py", line 41, in app
response = await func(request)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/fastapi/routing.py", line 129, in app
raw_response = await run_in_threadpool(dependant.call, **values)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/starlette/concurrency.py", line 25, in run_in_threadpool
return await loop.run_in_executor(None, func, *args)
File "/Users/this_user/opt/anaconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/prodigy/app.py", line 316, in static_root
return serve_main()
File "/Users/this_user/opt/anaconda3/lib/python3.8/site-packages/prodigy/app.py", line 305, in serve_main
value=token.decode("utf-8"),
AttributeError: 'str' object has no attribute 'decode'

hi @aanifh!

At quick glance it looks like you may have a problem with the data your loading.

Can you provide the text/record where you had this error? Also can you provide your prodigy version (run prodigy stats)? We'll need an example to replicate it on our end.

Hi, thanks for the quick reply:

These are the Prodigy stats:

============================== :sparkles: Prodigy Stats ==============================

Version 1.10.8
Location /Users/this_user/opt/anaconda3/lib/python3.8/site-packages/prodigy
Prodigy Home /Users/this_user/.prodigy
Platform macOS-10.16-x86_64-i386-64bit
Python Version 3.8.8
Database Name SQLite
Database Id sqlite
Total Datasets 59
Total Sessions 158

(base) this_user@this_users-MacBook-Air ~ %

I'm not sure how to upload the data, but it's a .txt file this is a screenshot of it

One thing that might be relevant, my Anaconda-Navigator did some auto-update, Prodigy was definitely working prior to that, and hasn't since. It might be a coincidence, but I'm not sure.

I tried on Prodigy v1.11.8 on Python 3.10.8 these steps and didn't have any issues:

# file.txt
Britney and Kylie are the pop queens
Madonna hates Elton
Taylor writes about her exes
python -m prodigy ner.manual samp_data blank:en data/file.txt --label ADJ,AUX,CCONJ,DET,NOUN,NUM,PRON,PROPN,VERB

Are you able to run any other recipes?

For example:

python -m prodigy ner.correct sample_data en_core_web_sm data/file.txt --label PERSON

Granted, you're running on v1.10.8 and Python 3.8.8 (so it could be a versioning). But if it were working earlier, I can't see any obvious issue.

This is good to know. Would it be possible for you to reinstall Prodigy? Try first to reinstall your version (v1.10.8). Alternatively, you could try to upgrade but I still think this should work so it doesn't disrupt anything else for v1.10.8 first so it may be better to try the older version first.

Hi, thanks for this, so I uninstalled Prodigy redownloaded our most recent license and got this in the terminal:Last login: Wed Nov 23 16:38:41 on ttys000
(base) this_user@this_users_computer ~ % pip install prodigy -f https://0245-68E3-477C-D8C9@download.prodi.gy
Looking in links: https://****@download.prodi.gy
Requirement already satisfied: prodigy in ./opt/anaconda3/lib/python3.8/site-packages (1.10.8)
Requirement already satisfied: catalogue<1.1.0,>=0.0.8 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (1.0.0)
Requirement already satisfied: pydantic<1.9.0,>=1.0.0 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (1.8.2)
Collecting pyjwt<2.0.0,>=1.6.1
Using cached PyJWT-1.7.1-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: toolz<=1.0.0,>=0.8.2 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (0.11.1)
Requirement already satisfied: cachetools>=2.1.0 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (4.2.2)
Requirement already satisfied: fastapi<0.45.0,>=0.44.0 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (0.44.1)
Requirement already satisfied: aiofiles in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (0.7.0)
Requirement already satisfied: spacy<2.4.0,>=2.3.0 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (2.3.5)
Requirement already satisfied: plac<1.2.0,>=0.9.6 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (1.1.3)
Requirement already satisfied: starlette<=0.12.9,>=0.12.9 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (0.12.9)
Requirement already satisfied: uvicorn<0.12.0,>=0.11.6 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (0.11.8)
Requirement already satisfied: requests<3.0.0,>=2.0.0 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (2.25.1)
Requirement already satisfied: wasabi<1.1.0,>=0.4.2 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (0.8.2)
Requirement already satisfied: peewee<4.0.0,>=3.12.0 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (3.14.4)
Requirement already satisfied: srsly<1.1.0,>=0.0.6 in ./opt/anaconda3/lib/python3.8/site-packages (from prodigy) (1.0.5)
Requirement already satisfied: typing-extensions>=3.7.4.3 in ./opt/anaconda3/lib/python3.8/site-packages (from pydantic<1.9.0,>=1.0.0->prodigy) (3.7.4.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./opt/anaconda3/lib/python3.8/site-packages (from requests<3.0.0,>=2.0.0->prodigy) (1.26.4)
Requirement already satisfied: chardet<5,>=3.0.2 in ./opt/anaconda3/lib/python3.8/site-packages (from requests<3.0.0,>=2.0.0->prodigy) (4.0.0)
Requirement already satisfied: certifi>=2017.4.17 in ./opt/anaconda3/lib/python3.8/site-packages (from requests<3.0.0,>=2.0.0->prodigy) (2020.12.5)
Requirement already satisfied: idna<3,>=2.5 in ./opt/anaconda3/lib/python3.8/site-packages (from requests<3.0.0,>=2.0.0->prodigy) (2.10)
Requirement already satisfied: preshed<3.1.0,>=3.0.2 in ./opt/anaconda3/lib/python3.8/site-packages (from spacy<2.4.0,>=2.3.0->prodigy) (3.0.5)
Requirement already satisfied: blis<0.8.0,>=0.4.0 in ./opt/anaconda3/lib/python3.8/site-packages (from spacy<2.4.0,>=2.3.0->prodigy) (0.7.4)
Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in ./opt/anaconda3/lib/python3.8/site-packages (from spacy<2.4.0,>=2.3.0->prodigy) (1.0.5)
Requirement already satisfied: thinc<7.5.0,>=7.4.1 in ./opt/anaconda3/lib/python3.8/site-packages (from spacy<2.4.0,>=2.3.0->prodigy) (7.4.5)
Requirement already satisfied: numpy>=1.15.0 in ./opt/anaconda3/lib/python3.8/site-packages (from spacy<2.4.0,>=2.3.0->prodigy) (1.20.1)
Requirement already satisfied: cymem<2.1.0,>=2.0.2 in ./opt/anaconda3/lib/python3.8/site-packages (from spacy<2.4.0,>=2.3.0->prodigy) (2.0.5)
Requirement already satisfied: setuptools in ./opt/anaconda3/lib/python3.8/site-packages (from spacy<2.4.0,>=2.3.0->prodigy) (52.0.0.post20210125)
Requirement already satisfied: tqdm<5.0.0,>=4.38.0 in ./opt/anaconda3/lib/python3.8/site-packages (from spacy<2.4.0,>=2.3.0->prodigy) (4.59.0)
Requirement already satisfied: click==7.* in ./opt/anaconda3/lib/python3.8/site-packages (from uvicorn<0.12.0,>=0.11.6->prodigy) (7.1.2)
Requirement already satisfied: websockets==8.* in ./opt/anaconda3/lib/python3.8/site-packages (from uvicorn<0.12.0,>=0.11.6->prodigy) (8.1)
Requirement already satisfied: uvloop>=0.14.0 in ./opt/anaconda3/lib/python3.8/site-packages (from uvicorn<0.12.0,>=0.11.6->prodigy) (0.15.2)
Requirement already satisfied: httptools==0.1.* in ./opt/anaconda3/lib/python3.8/site-packages (from uvicorn<0.12.0,>=0.11.6->prodigy) (0.1.2)
Collecting h11<0.10,>=0.8
Using cached h11-0.9.0-py2.py3-none-any.whl (53 kB)
Installing collected packages: h11, pyjwt
Attempting uninstall: h11
Found existing installation: h11 0.12.0
Uninstalling h11-0.12.0:
Successfully uninstalled h11-0.12.0
Attempting uninstall: pyjwt
Found existing installation: PyJWT 2.4.0
Uninstalling PyJWT-2.4.0:
Successfully uninstalled PyJWT-2.4.0
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
httpcore 0.13.3 requires h11<0.13,>=0.11, but you have h11 0.9.0 which is incompatible.
Successfully installed h11-0.9.0 pyjwt-1.7.1
(base) this_user@this_users_computer ~ %

And then (just to see what would happen) I tried to open Prodigy with the NER manual and I couldn't and got this message in terminal:

Last login: Wed Nov 23 16:42:04 on ttys000
(base) this_user@this_users_computer ~ % prodigy ner.manual evaluation_tagging_dev blank:en /Users/this_user/Documents/Documents–MacBookAir/Experiments/Eval1-dev-1.txt --label ADJ,AUX,CCONJ,DET,NOUN,NUM,PRON,PROPN,VERB
/Users/this_user/opt/anaconda3/bin/python: No module named prodigy
(base) this_user@this_users_computer ~ %

Thanks @aanifh!

First, did you create a virtual environment unique to Prodigy?

I see (base) but not sure if that a new environment. What's nice with a new environment is you can also modify your version of Python for it.

As of v1.11.8, I recommend Python 3.9 for Prodigy. Python 3.8 and 3.10 should work too.

python3.9 -m venv .env # can change to python3.8 or python3.10
source .env/bin/activate

Then, before installing Prodigy, make sure to upgrade your pip.

pip install --upgrade pip

Now install Prodigy:

pip install prodigy -f https://XXXX-XXXX-XXXX-XXXX@download.prodi.gy

You can add your pip install for Prodigy to your requirements.txt as well as other packages you want to install so you can reproduce this process.

After this, then run:

python -m prodigy stats

Last, since you're upgrading from v1.10.8 to v1.11.8, be sure to glance through Prodigy's changelog, especially v1.11 that included some big changes.

Hope this helps. Let us know if you have further questions!