0

I' am trying to install mmh3 python package on Windows Server 2019. Below are the steps i followed.

  1. Open cmd prompt with Administrator privilege
  2. Then run pip install mmh3

I get the below error during the installation

Collecting mmh3
  Using cached mmh3-3.0.0.tar.gz (10 kB)
  Preparing metadata (setup.py) ... done
Installing collected packages: mmh3

DEPRECATION: mmh3 is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for mmh3 ... error
  error: subprocess-exited-with-error

  × Running setup.py install for mmh3 did not run successfully.
  │ exit code: 1
  ╰─> [7 lines of output]
      running install
      C:\Program Files\Python311\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'mmh3' extension
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> mmh3

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

The stackoverflow question Link that i referred, is suggesting to download Microsoft C++ Build Tools and install Visual studio and then run pip install mmh3 via Developer command prompt for Visual Studio.

But since my environment is a production server(Windows Server 2019), i can't really install Visual studio in it. So how do i install mmh3 package on windows environment without installing Visual studio?

Note 1: I tried to run the pip install mmh3 from Anaconda Prompt and it ran successfully without any errors

Collecting mmh3
  Using cached mmh3-3.0.0-cp39-cp39-win_amd64.whl (15 kB)
Installing collected packages: mmh3
Successfully installed mmh3-3.0.0

Now when i try to execute my python script, i get an error ModuleNotFoundError: No module named 'mmh3'

Note 2: After pip install mmh3 specified in Note 1, pip show mmh3 and where python both points to the same path. I did this to confirm if my mmh3 package and python both are pointing to the same path.

raja_89
  • 3
  • 5

1 Answers1

0

As I understand you don't need to install Visual Studio to run pip install mmh3. You can just install the Build Tools with Microsoft Visual C++ 14.0 or greater and try to run pip install mmh3 after you start a new command prompt. It can be any command prompt.

When I had it on WSL2-Ubuntu I was able to solve it by installing header files and static libraries for python dev:

sudo apt-get install python3-dev
E. Dem
  • 67
  • 1
  • 7