jind11 / TextFooler

A Model for Natural Language Attack on Text Classification and Inference
MIT License
485 stars 79 forks source link

Which python version? #63

Closed jhuvehicle closed 5 months ago

jhuvehicle commented 5 months ago

Hello,

I am currently trying to reproduce the results in your code, however I am running into the following error:

Collecting absl-py==0.9.0 (from -r requirements.txt (line 1)) Downloading absl-py-0.9.0.tar.gz (104 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 104.0/104.0 kB 3.1 MB/s eta 0:00:00 error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. Preparing metadata (setup.py) ... error error: metadata-generation-failed

× Encountered error while generating package metadata. ╰─> See above for output.

note: This is an issue with the package mentioned above, not pip. hint: See above for details.

Which python version should I be using?

Doing a quick search online I found that there may not be support for python 3.10 and beyond

https://github.com/RasaHQ/rasa/issues/11101

jind11 commented 5 months ago

Could you try python earlier than 3.6?

jhuvehicle commented 5 months ago

Could not find a version that satisfies the requirement joblib==0.15.1 (from -r requirements.txt (line 17)) (from versions: 0.3.2d.dev, 0.3.2e.dev, 0.3.2f.dev, 0.3.2g.dev, 0.7.0d, 0.1a0.dev0, 0.2a0.dev0, 0.3a0.dev0, 0.3.1a0.dev0, 0.3.2.dev0, 0.3.2a0.dev0, 0.3.2b0.dev0, 0.3.2rc0.dev0, 0.3.3a0.dev0, 0.3.3b0.dev0, 0.3.3rc0.dev0, 0.3.4.dev0, 0.3.5.dev0, 0.3.6.dev0, 0.3.7.dev0, 0.4.0.dev0, 0.4.1.dev0, 0.4.2.dev0, 0.4.3.dev0, 0.4.4.dev0, 0.4.5.dev0, 0.4.6.dev0, 0.5.0.dev0, 0.5.0a0.dev0, 0.5.1.dev0, 0.5.2.dev0, 0.5.3.dev0, 0.5.4.dev0, 0.5.5.dev0, 0.5.6.dev0, 0.5.7.dev0, 0.5.7a0.dev0, 0.5.7b0.dev0, 0.5.7, 0.6.0a0, 0.6.0b0, 0.6.0b2, 0.6.0b3, 0.6.0, 0.6.1, 0.6.2, 0.6.3, 0.6.4, 0.6.5, 0.7.0a0, 0.7.0b0, 0.7.0rc0, 0.7.1, 0.8.0a0, 0.8.0a2, 0.8.0a3, 0.8.0, 0.8.1, 0.8.2, 0.8.3, 0.8.3.post1, 0.8.4, 0.9.0b2, 0.9.0b3, 0.9.0b4, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.10.0, 0.10.2, 0.10.3, 0.11a3, 0.11, 0.12.0, 0.12.1, 0.12.2, 0.12.3, 0.12.4, 0.12.5, 0.13.0, 0.13.1, 0.13.2, 0.14.0, 0.14.1) No matching distribution found for joblib==0.15.1 (from -r requirements.txt (line 17))

jhuvehicle commented 5 months ago

I got the same error message from python 3.5.4 and 3.5.6

jind11 commented 5 months ago

This work was done in early 2019, at that time most likely I used python 2.7

jhuvehicle commented 5 months ago

Screen_Shoot It says here you are using python 3.6?

jind11 commented 5 months ago

ok, then it should be python 3.6. Did you create a conda env and then install packages by using this requirements.txt?

jhuvehicle commented 5 months ago

https://github.com/jind11/TextFooler/issues/44

jhuvehicle commented 5 months ago

python 3.5.4 h1357f44_23 pkgs/main python 3.5.4 hc495aa9_21 pkgs/main python 3.5.4 hd3c4935_11 pkgs/main python 3.5.4 hdec4e59_20 pkgs/main python 3.5.4 hedc2606_15 pkgs/main python 3.5.5 h0c2934d_0 pkgs/main python 3.5.5 h0c2934d_1 pkgs/main python 3.5.5 h0c2934d_2 pkgs/main python 3.5.6 he025d50_0 pkgs/main python 3.6.2 h09676a0_15 pkgs/main python 3.6.2 h6679aeb_11 pkgs/main python 3.6.3 h210ce5f_2 pkgs/main python 3.6.3 h3389d20_0 pkgs/main python 3.6.3 h3b118a2_4 pkgs/main python 3.6.3 h9e2ca53_1 pkgs/main python 3.6.4 h0c2934d_2 pkgs/main python 3.6.4 h0c2934d_3 pkgs/main python 3.6.4 h6538335_0 pkgs/main python 3.6.4 h6538335_1 pkgs/main python 3.6.5 h0c2934d_0 pkgs/main python 3.6.6 hea74fb7_0 pkgs/main python 3.6.7 h33f27b4_0 pkgs/main python 3.6.7 h33f27b4_1 pkgs/main python 3.6.7 h9f7ef89_2 pkgs/main python 3.6.8 h9f7ef89_0 pkgs/main python 3.6.8 h9f7ef89_1 pkgs/main python 3.6.8 h9f7ef89_7 pkgs/main python 3.6.9 h5500b2f_0 pkgs/main python 3.6.10 h9f7ef89_0 pkgs/main python 3.6.10 h9f7ef89_1 pkgs/main python 3.6.10 h9f7ef89_2 pkgs/main python 3.6.12 h5500b2f_2 pkgs/main python 3.6.13 h3758d61_0 pkgs/main

jhuvehicle commented 5 months ago

I am going to try with python 3.6.3, I did go through the process of pip install requirements but was not successful.

jhuvehicle commented 5 months ago

(base) C:\Users\13013\Desktop\TextFooler-master\TextFooler-master>conda create -n py39 python=3.6 Collecting package metadata (current_repodata.json): done Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source. Collecting package metadata (repodata.json): done Solving environment: done

==> WARNING: A newer version of conda exists. <== current version: 23.7.4 latest version: 24.1.2

Please update conda by running

$ conda update -n base -c defaults conda

Or to minimize the number of packages updated during conda update use

 conda install conda=24.1.2

Package Plan

environment location: C:\Users\13013\anaconda3\envs\py39

added / updated specs:

The following NEW packages will be INSTALLED:

certifi pkgs/main/win-64::certifi-2021.5.30-py36haa95532_0 pip pkgs/main/win-64::pip-21.2.2-py36haa95532_0 python pkgs/main/win-64::python-3.6.13-h3758d61_0 setuptools pkgs/main/win-64::setuptools-58.0.4-py36haa95532_0 sqlite pkgs/main/win-64::sqlite-3.41.2-h2bbff1b_0 vc pkgs/main/win-64::vc-14.2-h21ff451_1 vs2015_runtime pkgs/main/win-64::vs2015_runtime-14.27.29016-h5e58377_2 wheel pkgs/main/noarch::wheel-0.37.1-pyhd3eb1b0_0 wincertstore pkgs/main/win-64::wincertstore-0.2-py36h7fe50ca_0

Proceed ([y]/n)? y

Downloading and Extracting Packages

Preparing transaction: done Verifying transaction: done Executing transaction: done #

To activate this environment, use

#

$ conda activate py39

#

To deactivate an active environment, use

#

$ conda deactivate

(base) C:\Users\13013\Desktop\TextFooler-master\TextFooler-master>conda activate py39

(py39) C:\Users\13013\Desktop\TextFooler-master\TextFooler-master>dir Volume in drive C is Acer Volume Serial Number is E070-6E33

Directory of C:\Users\13013\Desktop\TextFooler-master\TextFooler-master

03/12/2024 04:08 PM

. 03/12/2024 04:08 PM .. 03/12/2024 04:08 PM 12,292 .DS_Store 03/12/2024 04:08 PM .idea 03/12/2024 04:08 PM 27,015 attack_classification.py 03/12/2024 04:08 PM 51,679 attack_nli.py 03/12/2024 04:08 PM BERT 03/12/2024 04:08 PM 579 comp_cos_sim_mat.py 03/12/2024 04:08 PM 11,734 criteria.py 03/12/2024 04:08 PM data 03/12/2024 04:08 PM 8,906 dataloader.py 03/12/2024 04:08 PM ESIM 03/12/2024 04:08 PM InferSent 03/12/2024 04:08 PM 1,063 LICENSE 03/12/2024 04:08 PM 2,767 modules.py 03/12/2024 04:08 PM 3,341 README.md 03/12/2024 04:08 PM 681 requirements.txt 03/12/2024 04:08 PM 1,137 run_attack_classification.py 03/12/2024 04:08 PM 1,710 run_attack_nli.py 03/12/2024 04:08 PM 9,706 train_classifier.py 13 File(s) 132,610 bytes 7 Dir(s) 258,556,547,072 bytes free

(py39) C:\Users\13013\Desktop\TextFooler-master\TextFooler-master>pip install -r requirements.txt Collecting absl-py==0.9.0 Using cached absl-py-0.9.0.tar.gz (104 kB) Collecting astor==0.8.1 Using cached astor-0.8.1-py2.py3-none-any.whl (27 kB) Collecting beautifulsoup4==4.9.1 Using cached beautifulsoup4-4.9.1-py3-none-any.whl (115 kB) Collecting boto3==1.14.7 Using cached boto3-1.14.7-py2.py3-none-any.whl (128 kB) Collecting botocore==1.17.7 Using cached botocore-1.17.7-py2.py3-none-any.whl (6.3 MB) Collecting certifi==2020.4.5.2 Using cached certifi-2020.4.5.2-py2.py3-none-any.whl (157 kB) Collecting chardet==3.0.4 Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB) Collecting click==7.1.2 Using cached click-7.1.2-py2.py3-none-any.whl (82 kB) Collecting docutils==0.15.2 Using cached docutils-0.15.2-py3-none-any.whl (547 kB) Collecting feedparser==5.2.1 Using cached feedparser-5.2.1.zip (1.2 MB) ERROR: Command errored out with exit status 1: command: 'C:\Users\13013\anaconda3\envs\py39\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_6a8d281d78644619980a79734274d54f\setup.py'"'"'; file='"'"'C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_6a8d281d78644619980a79734274d54f\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\13013\AppData\Local\Temp\pip-pip-egg-info-1mwxfg_y' cwd: C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_6a8d281d78644619980a79734274d54f\ Complete output (1 lines): error in feedparser setup command: use_2to3 is invalid.

WARNING: Discarding https://files.pythonhosted.org/packages/5d/20/c6ec54fc79fb944f2058a5fef149b8a0d67993db5e3ba7ea58ce931e365e/feedparser-5.2.1.zip#sha256=cd2485472e41471632ed3029d44033ee420ad0b57111db95c240c9160a85831c (from https://pypi.org/simple/feedparser/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Using cached feedparser-5.2.1.tar.gz (252 kB) ERROR: Command errored out with exit status 1: command: 'C:\Users\13013\anaconda3\envs\py39\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_21536845589e4fc6ad583bd52084acb3\setup.py'"'"'; file='"'"'C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_21536845589e4fc6ad583bd52084acb3\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\13013\AppData\Local\Temp\pip-pip-egg-info-ql5ql1no' cwd: C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_21536845589e4fc6ad583bd52084acb3\ Complete output (1 lines): error in feedparser setup command: use_2to3 is invalid.

WARNING: Discarding https://files.pythonhosted.org/packages/ca/f4/91a056f11751701c24f86c692d92fee290b0ba3f99f657cdeb85ad3da402/feedparser-5.2.1.tar.gz#sha256=bd030652c2d08532c034c27fcd7c85868e7fa3cb2b17f230a44a6bbc92519bf9 (from https://pypi.org/simple/feedparser/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. Using cached feedparser-5.2.1.tar.bz2 (192 kB) ERROR: Command errored out with exit status 1: command: 'C:\Users\13013\anaconda3\envs\py39\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_f2d8aa1d56884fb0b9813de50e9483e0\setup.py'"'"'; file='"'"'C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_f2d8aa1d56884fb0b9813de50e9483e0\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\13013\AppData\Local\Temp\pip-pip-egg-info-qqx0_do3' cwd: C:\Users\13013\AppData\Local\Temp\pip-install-n0erghrq\feedparser_f2d8aa1d56884fb0b9813de50e9483e0\ Complete output (1 lines): error in feedparser setup command: use_2to3 is invalid.

WARNING: Discarding https://files.pythonhosted.org/packages/91/d8/7d37fec71ff7c9dbcdd80d2b48bcdd86d6af502156fc93846fb0102cb2c4/feedparser-5.2.1.tar.bz2#sha256=ce875495c90ebd74b179855449040003a1beb40cd13d5f037a0654251e260b02 (from https://pypi.org/simple/feedparser/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement feedparser==5.2.1 (from versions: 4.1, 5.0, 5.0.1, 5.1, 5.1.1, 5.1.2, 5.1.3, 5.2.0.post1, 5.2.1, 6.0.0b1, 6.0.0b2, 6.0.0b3, 6.0.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.0.9, 6.0.10, 6.0.11) ERROR: No matching distribution found for feedparser==5.2.1

jhuvehicle commented 5 months ago

Just tried python 3.6 and it did not work. TT 3_12_2024

jind11 commented 5 months ago

interesting, I would suggest using this code base: https://github.com/QData/TextAttack. My textfooler method has been also implemented in it. It is still being maintained.

jhuvehicle commented 5 months ago

thanks I appreciate your help. TT 3_12_2024