rteabeault / AnkiSpacy

5 stars 1 forks source link

Install does not work for models in Windows. #1

Closed rteabeault closed 3 years ago

rteabeault commented 3 years ago

The current vendored pip code was modified so that it could run without an installed python. In other words so that it could use the partial python in anki. This seems to work fine in OS X but is failing for installing models in Windows.


Collecting https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-2.3.0/de_core_news_sm-2.3.0.tar.gz
  Downloading https://github.com/explosion/spacy-models/releases/download/de_core_news_sm-2.3.0/de_core_news_sm-2.3.0.tar.gz (14.9 MB)
     |################################| 14.9 MB 939 kB/s 
call_subprocess ['C:\\Program Files\\Anki\\anki.exe', '-c', "import sys, setuptools, tokenize; sys.argv[0] = 'C:\\\\Users\\\\rteabeault\\\\AppData\\\\Local\\\\Temp\\\\pip-req-build-sp902g07\\\\setup.py'; __file__='C:\\\\Users\\\\rteabeault\\\\AppData\\\\Local\\\\Temp\\\\pip-req-build-sp902g07\\\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))", 'egg_info', '--egg-base', 'C:\\Users\\rteabeault\\AppData\\Local\\Temp\\pip-pip-egg-info-849b38nm'] C:\Users\rteabeault\AppData\Local\Temp\pip-req-build-sp902g07\
set sys.argv to ['-c', 'egg_info', '--egg-base', 'C:\\Users\\rteabeault\\AppData\\Local\\Temp\\pip-pip-egg-info-849b38nm']
set cwd to C:\Users\rteabeault\AppData\Local\Temp\pip-req-build-sp902g07
running eval on: import sys, setuptools, tokenize; sys.argv[0] = 'C:\\Users\\rteabeault\\AppData\\Local\\Temp\\pip-req-build-sp902g07\\setup.py'; __file__='C:\\Users\\rteabeault\\AppData\\Local\\Temp\\pip-req-build-sp902g07\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\cli\base_command.py", line 224, in _main
    status = self.run(options, args)
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\cli\req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\commands\install.py", line 320, in run
    requirement_set = resolver.resolve(
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\resolution\resolvelib\resolver.py", line 121, in resolve
    self._result = resolver.resolve(
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_vendor\resolvelib\resolvers.py", line 445, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_vendor\resolvelib\resolvers.py", line 310, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_vendor\resolvelib\resolvers.py", line 169, in _merge_into_criterion
    name = self._p.identify(requirement)
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\resolution\resolvelib\provider.py", line 60, in identify
    return dependency.name
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\resolution\resolvelib\requirements.py", line 41, in name
    return self.candidate.name
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\resolution\resolvelib\candidates.py", line 188, in name
    return self.project_name
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\resolution\resolvelib\candidates.py", line 182, in project_name
    self._name = canonicalize_name(self.dist.project_name)
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\resolution\resolvelib\candidates.py", line 239, in dist
    self._prepare()
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\resolution\resolvelib\candidates.py", line 226, in _prepare
    dist = self._prepare_distribution()
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\resolution\resolvelib\candidates.py", line 318, in _prepare_distribution
    return self._factory.preparer.prepare_linked_requirement(
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\operations\prepare.py", line 480, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\operations\prepare.py", line 523, in _prepare_linked_requirement
    dist = _get_prepared_distribution(
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\operations\prepare.py", line 88, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\distributions\sdist.py", line 41, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\req\req_install.py", line 555, in prepare_metadata
    self.metadata_directory = self._generate_metadata()
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\req\req_install.py", line 530, in _generate_metadata
    return generate_metadata_legacy(
  File "C:\Users\rteabeault\Documents\GitHub\AnkiSpacy\src\_vendor\pip\_internal\operations\build\metadata_legacy.py", line 93, in generate_metadata
    exec(theargs, globals(), globals())
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'```
rteabeault commented 3 years ago

This is also a problem in OS X. I was not seeing it on OS X because another addon I had been working was also vendoring some packages and it masked the problem. I need to now figure out what packages need to be vendored by the AnkiSpacy addon to fix the problem.

rteabeault commented 3 years ago

Added setuptools to the _vendor and am now getting the following error

Collecting https://github.com/explosion/spacy-models/releases/download/da_core_news_sm-2.3.0/da_core_news_sm-2.3.0.tar.gz
  Downloading https://github.com/explosion/spacy-models/releases/download/da_core_news_sm-2.3.0/da_core_news_sm-2.3.0.tar.gz (16.9 MB)
     |################################| 16.9 MB 856 kB/s 
call_subprocess ['/Applications/Anki.app/Contents/MacOS/Anki', '-c', "import sys, setuptools, tokenize; sys.argv[0] = '/private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-req-build-618bs9cn/setup.py'; __file__='/private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-req-build-618bs9cn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\\r\\n', '\\n');f.close();exec(compile(code, __file__, 'exec'))", 'egg_info', '--egg-base', '/private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-pip-egg-info-2_8stgj7'] /private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-req-build-618bs9cn/
set sys.argv to ['-c', 'egg_info', '--egg-base', '/private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-pip-egg-info-2_8stgj7']
set cwd to /private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-req-build-618bs9cn
running eval on: import sys, setuptools, tokenize; sys.argv[0] = '/private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-req-build-618bs9cn/setup.py'; __file__='/private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-req-build-618bs9cn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))
/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  warnings.warn(
/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/distutils/dist.py:274: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/distutils/dist.py:274: UserWarning: Unknown distribution option: 'zip_safe'
  warnings.warn(msg)
ERROR: Exception:
Traceback (most recent call last):
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/distutils/dist.py", line 539, in _parse_command_opts
    cmd_class = self.get_command_class(command)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/setuptools/dist.py", line 771, in get_command_class
    return _Distribution.get_command_class(self, command)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/distutils/dist.py", line 843, in get_command_class
    raise DistutilsModuleError("invalid command '%s'" % command)
distutils.errors.DistutilsModuleError: invalid command 'egg_info'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/distutils/core.py", line 134, in setup
    ok = dist.parse_command_line()
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/distutils/dist.py", line 483, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/setuptools/dist.py", line 929, in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/distutils/dist.py", line 541, in _parse_command_opts
    raise DistutilsArgError(msg)
distutils.errors.DistutilsArgError: invalid command 'egg_info'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/cli/base_command.py", line 224, in _main
    status = self.run(options, args)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/commands/install.py", line 320, in run
    requirement_set = resolver.resolve(
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/resolution/resolvelib/resolver.py", line 121, in resolve
    self._result = resolver.resolve(
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_vendor/resolvelib/resolvers.py", line 445, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_vendor/resolvelib/resolvers.py", line 310, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_vendor/resolvelib/resolvers.py", line 169, in _merge_into_criterion
    name = self._p.identify(requirement)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/resolution/resolvelib/provider.py", line 60, in identify
    return dependency.name
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/resolution/resolvelib/requirements.py", line 41, in name
    return self.candidate.name
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/resolution/resolvelib/candidates.py", line 188, in name
    return self.project_name
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/resolution/resolvelib/candidates.py", line 182, in project_name
    self._name = canonicalize_name(self.dist.project_name)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/resolution/resolvelib/candidates.py", line 239, in dist
    self._prepare()
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/resolution/resolvelib/candidates.py", line 226, in _prepare
    dist = self._prepare_distribution()
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/resolution/resolvelib/candidates.py", line 318, in _prepare_distribution
    return self._factory.preparer.prepare_linked_requirement(
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/operations/prepare.py", line 480, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/operations/prepare.py", line 523, in _prepare_linked_requirement
    dist = _get_prepared_distribution(
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/operations/prepare.py", line 88, in _get_prepared_distribution
    abstract_dist.prepare_distribution_metadata(finder, build_isolation)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/distributions/sdist.py", line 41, in prepare_distribution_metadata
    self.req.prepare_metadata()
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/req/req_install.py", line 555, in prepare_metadata
    self.metadata_directory = self._generate_metadata()
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/req/req_install.py", line 530, in _generate_metadata
    return generate_metadata_legacy(
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/pip/_internal/operations/build/metadata_legacy.py", line 93, in generate_metadata
    exec(theargs, globals(), globals())
  File "<string>", line 1, in <module>
  File "/private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-req-build-618bs9cn/setup.py", line 64, in <module>
    setup_package()
  File "/private/var/folders/b7/5x8j655x1ln50hzhjx1h6p_40000gp/T/pip-req-build-618bs9cn/setup.py", line 48, in setup_package
    setup(
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/setuptools/__init__.py", line 165, in setup
    return distutils.core.setup(**attrs)
  File "/Users/rteabeault/workspace/anki_addons/AnkiSpaCy/src/_vendor/distutils/core.py", line 136, in setup
    raise SystemExit(gen_usage(dist.script_name) + "\nerror: %s" % msg)
SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: invalid command 'egg_info'