Score:0

Error when running python code with regex: ModuleNotFoundError: No module named 'regex._regex'

mc flag

I am running this on an ubuntu server, version 22.04. The python version is 3.10. I am working on a local server in Ubuntu, where only PHP (version 8.1.2), phpmyadmin, python, mariadb and apache2 are install, and the webroot folder was given to me with all the files

This is the same question as the one posted earlier by me. I didn't provide enough information in that question and due to that it wasn't answered, so i decided to re-post this question with more information so that it can be answered.

Source code is a PHP file, where the main problem statement is this:

$str_output = shell_exec($command_exec);

Where $command_exec executes a python file with a given input.

This is the full error message that i received, all the problematic lines in the python code can be seen in the error:

"Traceback (most recent call last): 
File "/var/www/html/ngram_pos/service/word_service/checker.py", line 11, in import nltk # type: ignore 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/nltk/__init__.py", line 133, in from nltk.text import * 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/nltk/text.py", line 30, in from nltk.tokenize import sent_tokenize 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/nltk/tokenize/__init__.py", line 66, in from nltk.tokenize.casual import TweetTokenizer, casual_tokenize 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/nltk/tokenize/casual.py", line 38, in import regex # https://github.com/nltk/nltk/issues/2409 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/regex/__init__.py", line 1, in from .regex import * 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/regex/regex.py", line 419, in import regex._regex_core as _regex_core 
File "/var/www/html/ngram_pos/service/word_service/../../src/nlp_nltk_3.6.2_deb/regex/_regex_core.py", line 21, in import regex._regex as _regex ModuleNotFoundError: No module named 'regex._regex' "

Any idea as to how i can fix this?

hr flag
If you have information to add, please edit your previous question
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.