[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nielsr2 opened this issue Dec 16, 2023 · 5 comments
Open

Comments

@nielsr2
Copy link
nielsr2 commented Dec 16, 2023

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
Copy link

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):

  • Texthero depends on spaCy<3.0.
  • One of the big changes in spaCy 3.0 was to the add_pipe() function and the types of arguments it accepts. This deprecated the old syntax for that function. spaCy 3.0 was released on Feb 1, 2021.
  • Because of that change, the line nlp.add_pipe(PySBDFactory(nlp)) in this repo requires spaCy>=2.0.0,<3.0.0. (So pySBD's recommended usage only works with spaCy<3.0, even though pySBD doesn't technically have spaCy as a dependence.)

@nielsr2
Copy link
Author
nielsr2 commented Dec 18, 2023

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
Copy link
alishamaybe commented Mar 18, 2024

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
Copy link

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
Copy link
Author
nielsr2 commented Mar 19, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants