jon-chun / sentimentarcs_notebooks

SentimentArcs: a large ensemble of dozens of sentiment analysis models to analyze emotion in text over time
MIT License
35 stars 8 forks source link

Request for Environment Details: Python Version and Library Dependencies #1

Open nielsr2 opened 11 months ago

nielsr2 commented 11 months ago

Hi!

I'm trying to run the notebooks, but I get an error in during the TextHero library import in 'sentiment_arcs_part1_preprocessing.ipynb'.

From what I can understand, it appears to be due to incompatibilities between TextHero (which depends on Gensim) and the Python version used (Google Colab defaults to 3.10.13).

The specific error that initially occurs is a ModuleNotFoundError for TextHero. When I attempt to resolve this by running !pip install texthero, it fails due to Gensim's incompatibility with this Python version.

After some quick research, I tried downgrading to Python 3.8.1, and specifying some older versions of the libraries (gensim==3.6.0, texthero==1.1.0) - I was endowed with slight progress, but get a new set of errors - which appears to relate to the incompatibilities mentioned.

To accurately reproduce the environment and run the notebooks successfully, could you please provide the specific versions of Python and the libraries (especially TextHero and Gensim) used in your project? (like a requirements.txt, environment.yml, or something similar)

Looking forward to get it up and running, so your help would be much appreciated :)

/Niels

afelleson commented 11 months ago

Hi Niels,

Thanks for submitting this issue!

I've got a potential fix, if you're willing to test it out for me: Revert everything back to how it was originally and just require spacy>=2.0.0,<3.0.0 (e.g., spacy==2.3.7, if you want to specify an exact version for the import). If that alone doesn't work, downgrading the Python version like you did before might help.

Let us know how that goes, please!

More info about this issue (based on my notes for this updated, in-progress SentimentArcs package):

nielsr2 commented 11 months ago

Thanks for the swift response :)

I tried rolling back, and specifying the spacy version - Unfortunately, it didn't work. The install of TextHero still fails because of gensim.

I tried downgrading the python version - The installs appear working, but with a lot of warning about restart needed. The notebook crashes when restarting, so it that seems futile. I downgrade to 3.8 the following way:

!apt-get update -y !apt-get install python3.8 python3.8-distutils !update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 !update-alternatives --config python3 !apt-get install python3-pip !python3 -m pip install --upgrade pip --user

Ignoring the warnings, it appears to successfully install all libraries. It however fails importing from 'pysbd' later, despite it being installed successfully.

alishamaybe commented 8 months ago

Hi Niels and @afelleson,

Have either of you figured out a full fix for this problem? Texthero has also failed to install for me because of Gensim failing to build.

Two days ago, I tried downgrading to Python 3.8 like how Niels did, and all libraries seemed to install successfully. I could import from pysbd—but I couldn't import Texthero. I got an error saying, "No module named 'texthero'".

Yesterday when I was rerunning the cells, including the one downgrading Python to 3.8, Texthero failed to install again because of Gensim. So, I tried @afelleson's suggestion of reverting and installing spaCy 2.3.7, but I still got the same Gensim-related problem with installing Texthero. Then when I tried the other suggestion of downgrading to Python 3.8 and tried installing spaCy 2.3.7, the notebook tells me to restart the runtime, but the restart fails. The logs say that there is no module named colab_kernel_launcher.

Do either of you have any suggestions on what I should do? @afelleson Would it be better for me to try using the SentimentArcs WebApp?

I'm trying to use SentimentArcs for an undergrad project, so I'd appreciate any help!

Alisha

afelleson commented 8 months ago

I worked on this for a few hours but never found a solution :( I think I'm gonna give up on this one, but maybe @jon-chun could help if Niels hasn't figured it out either?

@alishamaybe if you're analyzing novels, the web app would be a good option! If you have issues running the web app itself and instead want to use the SentimentArcsPackage in your own Python code, I'd be happy to help! (You can open a 'question' issue on the SentimentArcsPackage repo or give me some other way to contact you.) The package isn't fully completed or tested yet, but it should be less buggy than these notebooks, and I'll be able to solve issues over there much more easily & quickly because I wrote that code.

nielsr2 commented 8 months ago

I didn't find a solution. I planned to check out the package, but haven't gotten around to it yet.