makcedward / nlpaug

Data augmentation for NLP
https://makcedward.github.io/
MIT License
4.44k stars 463 forks source link

UnknownExtra: requests 2.27.1 has no such extra feature 'socks' #310

Open moe-men opened 2 years ago

moe-men commented 2 years ago

I'm trying to use nlpaug python 3.9.12 i installed :

! pip install -q numpy 
! pip install -q requests==2.28.1
! pip install -q nlpaug==1.1.11

when i call


import nlpaug.augmenter.word as naw
import nlpaug.flow as nafc

from nlpaug.util import Action

i get this issue :

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File /opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py:2760, in Distribution.requires(self, extras)
   2759 try:
-> 2760     deps.extend(dm[safe_extra(ext)])
   2761 except KeyError as e:

KeyError: 'socks'

The above exception was the direct cause of the following exception:

UnknownExtra                              Traceback (most recent call last)
Input In [27], in <cell line: 1>()
----> 1 import nlpaug.augmenter.word as naw
      2 import nlpaug.flow as nafc
      4 from nlpaug.util import Action

File /opt/conda/lib/python3.9/site-packages/nlpaug/__init__.py:2, in <module>
      1 from __future__ import absolute_import
----> 2 from nlpaug.base_augmenter import *
      4 __all__ = ['base_augmenter']
      6 __version__ = '1.1.11'

File /opt/conda/lib/python3.9/site-packages/nlpaug/base_augmenter.py:7, in <module>
      4 import pandas as pd
      5 from multiprocessing.dummy import Pool as ThreadPool
----> 7 from nlpaug.util import Action, Method, WarningException, WarningName, WarningCode, WarningMessage
     10 class Augmenter:
     11     def __init__(self, name, method, action, aug_min, aug_max, aug_p=0.1, device='cpu', 
     12         include_detail=False, verbose=0):

File /opt/conda/lib/python3.9/site-packages/nlpaug/util/__init__.py:9, in <module>
      6 from nlpaug.util.text import *
      7 from nlpaug.util.audio import *
----> 9 from nlpaug.util.file import *
     10 from nlpaug.util.decorator import *
     11 from nlpaug.util.logger import *

File /opt/conda/lib/python3.9/site-packages/nlpaug/util/file/__init__.py:1, in <module>
----> 1 from nlpaug.util.file.download import *
      2 from nlpaug.util.file.library import *
      3 from nlpaug.util.file.read import *

File /opt/conda/lib/python3.9/site-packages/nlpaug/util/file/download.py:8, in <module>
      5 import urllib
      6 import zipfile
----> 8 import gdown
      9 import requests
     12 class DownloadUtil:

File /opt/conda/lib/python3.9/site-packages/gdown/__init__.py:12, in <module>
      9 from .extractall import extractall
     11 __author__ = "Kentaro Wada <[www.kentaro.wada@gmail.com](https://www%2Ekentaro%2Ewada@gmail.com/)>"
---> 12 __version__ = pkg_resources.get_distribution("gdown").version

File /opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py:478, in get_distribution(dist)
    476     dist = Requirement.parse(dist)
    477 if isinstance(dist, Requirement):
--> 478     dist = get_provider(dist)
    479 if not isinstance(dist, Distribution):
    480     raise TypeError("Expected string, Requirement, or Distribution", dist)

File /opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py:354, in get_provider(moduleOrReq)
    352 """Return an IResourceProvider for the named module or requirement"""
    353 if isinstance(moduleOrReq, Requirement):
--> 354     return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
    355 try:
    356     module = sys.modules[moduleOrReq]

File /opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py:909, in WorkingSet.require(self, *requirements)
    900 def require(self, *requirements):
    901     """Ensure that distributions matching `requirements` are activated
    902 
    903     `requirements` must be a string or a (possibly-nested) sequence
   (...)
    907     included, even if they were already activated in this working set.
    908     """
--> 909     needed = self.resolve(parse_requirements(requirements))
    911     for dist in needed:
    912         self.add(dist)

File /opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py:803, in WorkingSet.resolve(self, requirements, env, installer, replace_conflicting, extras)
    800     raise VersionConflict(dist, req).with_context(dependent_req)
    802 # push the new requirements onto the stack
--> 803 new_requirements = dist.requires(req.extras)[::-1]
    804 requirements.extend(new_requirements)
    806 # Register the new requirements needed by req

File /opt/conda/lib/python3.9/site-packages/pkg_resources/__init__.py:2762, in Distribution.requires(self, extras)
   2760         deps.extend(dm[safe_extra(ext)])
   2761     except KeyError as e:
-> 2762         raise UnknownExtra(
   2763             "%s has no such extra feature %r" % (self, ext)
   2764         ) from e
   2765 return deps

UnknownExtra: requests 2.27.1 has no such extra feature 'socks'
qian-qiang commented 1 year ago

why i get like you