eliorc / node2vec

Implementation of the node2vec algorithm.
MIT License
1.23k stars 247 forks source link

Error installing gensim in poetry env on mac m1 #98

Closed Abdulk084 closed 1 year ago

Abdulk084 commented 1 year ago

I am installing an NLP library gensim in my poetry environment. All other packages are installed properly except gensim which gives the following error.

Processing /Users/-----/Library/Caches/pypoetry/artifacts/67/a8/59/699d242b8d8a8210e1113653bd7d111fa5264372a1cd6d6bc97caf3abc/gensim-4.2.0.tar.gz
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Installing backend dependencies: started
    Installing backend dependencies: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error

    × Preparing metadata (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [55 lines of output]
        running dist_info
        creating /private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-modern-metadata-_tq3rf3k/gensim.egg-info
        writing /private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-modern-metadata-_tq3rf3k/gensim.egg-info/PKG-INFO
        writing dependency_links to /private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-modern-metadata-_tq3rf3k/gensim.egg-info/dependency_links.txt
        writing requirements to /private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-modern-metadata-_tq3rf3k/gensim.egg-info/requires.txt
        writing top-level names to /private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-modern-metadata-_tq3rf3k/gensim.egg-info/top_level.txt
        writing manifest file '/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-modern-metadata-_tq3rf3k/gensim.egg-info/SOURCES.txt'
        Traceback (most recent call last):
          File "/Users//Library/Caches/pypoetry/virtualenvs/jobs-model-idEQdzBn-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
            main()
          File "/Users//Library/Caches/pypoetry/virtualenvs/jobs-model-idEQdzBn-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
          File "/Users//Library/Caches/pypoetry/virtualenvs/jobs-model-idEQdzBn-py3.8/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
            return hook(metadata_directory, config_settings)
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 377, in prepare_metadata_for_build_wheel
            self.run_setup()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 483, in run_setup
            super(_BuildMetaLegacyBackend,
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 335, in run_setup
            exec(code, locals())
          File "<string>", line 335, in <module>
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 87, in setup
            return distutils.core.setup(**attrs)
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
            return run_commands(dist)
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
            dist.run_commands()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
            self.run_command(cmd)
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1217, in run_command
            super().run_command(command)
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
            cmd_obj.run()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/command/dist_info.py", line 96, in run
            self.egg_info.run()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 308, in run
            self.find_sources()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 316, in find_sources
            mm.run()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 560, in run
            self.add_defaults()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 597, in add_defaults
            sdist.add_defaults(self)
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/command/sdist.py", line 106, in add_defaults
            super().add_defaults()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 252, in add_defaults
            self._add_defaults_ext()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
            build_ext = self.get_finalized_command('build_ext')
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 306, in get_finalized_command
            cmd_obj.ensure_finalized()
          File "/private/var/folders/kl/20p2y1y17rz7q4y62yxq6jm80000gn/T/pip-build-env-yd25xwx2/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 109, in ensure_finalized
            self.finalize_options()
          File "<string>", line 107, in finalize_options
        AttributeError: 'dict' object has no attribute '__NUMPY_SETUP__'
        [end of output]

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

  × Encountered error while generating package metadata.

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.

  at ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/env.py:1476 in _run
      1472│                 output = subprocess.check_output(
      1473│                     command, stderr=subprocess.STDOUT, env=env, **kwargs
      1474│                 )
      1475│         except CalledProcessError as e:
    → 1476│             raise EnvCommandError(e, input=input_)
      1477│ 
      1478│         return decode(output)
      1479│ 
      1480│     def execute(self, bin: str, *args: str, **kwargs: Any) -> int:

The following error occurred when trying to handle this error:

And then the error goes further like this.

 PoetryException

  Failed to install /Users/-----/Library/Caches/pypoetry/artifacts/67/a8/59/699d242b8d8a8210e1113653bd7d111fa5264372a1cd6d6bc97caf3abc/gensim-4.2.0.tar.gz

  at ~/Library/Application Support/pypoetry/venv/lib/python3.8/site-packages/poetry/utils/pip.py:51 in pip_install
       47│ 
       48│     try:
       49│         return environment.run_pip(*args)
       50│     except EnvCommandError as e:
    →  51│         raise PoetryException(f"Failed to install {path.as_posix()}") from e
       52│ 

I am using mac-os with M1 chip. I have applied the following remedies.

  1. Reinstalled poetry environment.
  2. Installed outside poetry and it works fine outside poetry.
  3. Cleared poetry cache
eliorc commented 1 year ago

Are you saying you managed to install the library without Poetry but failed with Poetry?

Abdulk084 commented 1 year ago

yes, that is correct. Outside poetry, I am able to install it, but inside poetry, I am getting this error.

eliorc commented 1 year ago

So I'm not sure how to help - seems like a poetry error not a node2vec error.