0

the error appears after trying to install word2vec in Jupyter Notebook:

!pip install word2vec


  Compiling: gcc C:\Users\Mikhail\AppData\Local\Temp\pip-install-npzfmr51\word2vec_1d22636dcb264535b7c0bcd56e9c8d55\word2vec\includes\win32/word2vec.c -o Scripts\word2vec.exe -O2 -Wall -funroll-loops
  error: [WinError 2] Не удается найти указанный файл
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for word2vec
ERROR: Could not build wheels for word2vec, which is required to install pyproject.toml-based projects

I have already tried to reinstall python, update pip, install specific realises of Python. Nothing helps. I know that for many people installation of python 3.8 solves the problem, but that's not my case as well.

  • https://stackoverflow.com/a/35900803/7976758 Found in https://stackoverflow.com/search?q=%5Bpip%5D+windows+%22word2vec%22 – phd Apr 05 '23 at 17:17
  • 1
    Aside: for a better experience with Jupyter use the magic install commands such as `%pip install word2vec`. Use of the exclamation point in conjunction with install commands can cause problems, as discussed in [the second paragraph here](https://discourse.jupyter.org/t/location-of-libraries-or-extensions-installed-in-jupyterlab/16303/2?u=fomightez). See [here](https://discourse.jupyter.org/t/why-users-can-install-modules-from-pip-but-not-from-conda/10722/4?u=fomightez) for more about the modern magic install commands that insure installation occurs ... – Wayne Apr 05 '23 at 18:53
  • in the environment backing the kernel underlying the active notebook. – Wayne Apr 05 '23 at 18:53

1 Answers1

0

Unless you are on an uncommon OS configuration, you should generally not need to be building your own local wheels for popular libraries like Gensim.

Rather, the right choice of local versions & remote package-repositories should result in the installation of prebuilt, tested packages well-matched to your local system.

So, even if you could make this local build work (by tinkering with the right build-tools, or addressing whatever that error-reported-in-Cyrillic-is), seeing such a build proceed suggests things are suboptimal.

How did you "reinstall Python"? Did you replace the system Python (which could introduce other issues), or make a separate installation for the specific use of your project?

If the initial error was because you were originally using some leading-edge Python, then rolling to another better-supported Python (eg 3.8.x) should help – but you'd have to make sure that was the Python being used by your Jupyter service, for your specific notebook... which might not be the case.

In general, also, it's best to use project-specific Python virtual environments, rather than the system Python, for more control over versions/libraries, without cross-interference from the competing needs of the system Python and other projects.

In particular, the conda tool offers fine-grained control of multiple Python versions for multiple independent virtual environments - so your system Python can remain whatever the OS prefers, while you use some other version just for Jupyter or individual notebooks. (I prefer to start with the miniconda install – https://docs.conda.io/projects/conda/en/latest/user-guide/install/windows.html – so as not to bring in excess unneeded libraries, and keep things very explicit as to how I build up each new virtual environment for each coding project's needs.)

gojomo
  • 52,260
  • 14
  • 86
  • 115
  • I've tried to do it through Anaconda environment. The Cyrillic error, which means "File was not found" disappeared, however the problem with wheels is still actual. – Mikhail Rotar Apr 05 '23 at 19:20
  • oh no.. my fault... the problem "cyrillic error" is still here – Mikhail Rotar Apr 05 '23 at 19:37
  • I suggest starting with the smaller `miniconda`, then installing only and exactly the Python version you want (say 3.8), then the minimal libraries you need. If you're still having a problem expanding this question, or asking a fresh question, with full details (such as transcript of everything tried, & showing verified active versions of Python used in the Jupyter server an specific notebook engine), so as to better be sure of what the current 'problem frontier' really is. – gojomo Apr 05 '23 at 21:20
  • Also, while you may have many personal & organizational reasons to prefer Windows, the whole Python data-science stack tends to be better tested/maintained/updated for Linux/Unix systems, if that's an option. – gojomo Apr 05 '23 at 21:22
  • Actually, missed something: that `word2vec` PyPI project – https://pypi.org/project/word2vec/, 1 dev's wrapper of original minimally-featured Google `word2vec.c` – doesn't seem to have been updated in ~3 years. It is unlikely to have current wheels prebuilt for recent Windows Pythons – & may never have had prebuilt wheels for any platform. If for some reason you must use it, you may have to dig into all the missing build-tools & their proper configs – just to build the inner `word2vec.c`, even if not the Python parts. So I'd recommend using a more-maintained Python-focused wod2vec like Gensim. – gojomo Apr 05 '23 at 21:30