twitter / communitynotes

Documentation and source code powering Twitter's Community Notes
https://twitter.github.io/communitynotes
Apache License 2.0
1.42k stars 196 forks source link

Missing scipy in requirements.txt #173

Closed marinomaria closed 10 months ago

marinomaria commented 10 months ago

Hi! Amazing work šŸ‘

Describe the bug The requirements.txt file is missing the scipy dependency. In README.md it states:

While your normal Python install may "just work" if you're lucky, if you run into any issues and want to install the exact versions of Python packages that we've tested the code with, please create a new virtual environment and install the packages from requirements.txt:

python -m venv communitynotes_env
source communitynotes_env/bin/activate
pip install -r requirements.txt

Then after downloading the data files (see next section) into /sourcecode/, you will be able to run:

cd sourcecode
python main.py

Doing this will result in:

  File "../communitynotes/sourcecode/scoring/reputation_matrix_factorization/weighted_loss.py", line 1, in <module>
    import scipy.sparse as sps
ModuleNotFoundError: No module named 'scipy'

This can be easily fixed by adding the dependency in requirements.txt

To Reproduce Steps to reproduce the behavior:

  1. git clone https://github.com/twitter/communitynotes.git
  2. conda create --name communitynotes python=3.7.9 (or use venv)
  3. conda activate communitynotes (or use venv)
  4. pip install -r requirements.txt
  5. Download data from https://twitter.com/i/communitynotes/download-data into /sourcecode/data folder
  6. python main.py --enrollment data/userEnrollment-00000.tsv --notes data/notes-00000.tsv --ratings data/ratings-00000.tsv --status data/noteStatusHistory-00000.tsv --outdir data
jbaxter commented 10 months ago

Resolved here: https://github.com/twitter/communitynotes/commit/2b279a6411b95e0501c37499d24551b292021b5b Thank you for reporting!!