libplinkio icon indicating copy to clipboard operation
libplinkio copied to clipboard

Cannot install libplinkio on Windows

Open Patricklv opened this issue 2 years ago • 6 comments

I am following page 385 of the book "An introduction to statistical genetic data analysis" to install the package libplinkio using the code pip install plinkio. Here is my code and what I was returned in Win 10 cmd:

C:\Users\Patrick Wen>pip install plinkio
Collecting plinkio
  Using cached plinkio-0.9.8.tar.gz (34 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: plinkio
  Building wheel for plinkio (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      creating build\lib.win-amd64-3.10\plinkio
      copying py-plinkio\plinkio\plinkfile.py -> build\lib.win-amd64-3.10\plinkio
      copying py-plinkio\plinkio\__init__.py -> build\lib.win-amd64-3.10\plinkio
      creating build\lib.win-amd64-3.10\tests
      copying py-plinkio\tests\write_test.py -> build\lib.win-amd64-3.10\tests
      copying py-plinkio\tests\__init__.py -> build\lib.win-amd64-3.10\tests
      running build_ext
      building 'plinkio.cplinkio' 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: Failed building wheel for plinkio
  Running setup.py clean for plinkio
Failed to build plinkio
Installing collected packages: plinkio
  Running setup.py install for plinkio ... error
  error: subprocess-exited-with-error

  × Running setup.py install for plinkio did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running install
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-3.10
      creating build\lib.win-amd64-3.10\plinkio
      copying py-plinkio\plinkio\plinkfile.py -> build\lib.win-amd64-3.10\plinkio
      copying py-plinkio\plinkio\__init__.py -> build\lib.win-amd64-3.10\plinkio
      creating build\lib.win-amd64-3.10\tests
      copying py-plinkio\tests\write_test.py -> build\lib.win-amd64-3.10\tests
      copying py-plinkio\tests\__init__.py -> build\lib.win-amd64-3.10\tests
      running build_ext
      building 'plinkio.cplinkio' 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.
╰─> plinkio

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

Any idea why the error? I have install the wheel package.

Patricklv avatar May 16 '22 07:05 Patricklv

I don't work with windows a lot, but did you try to download the new version of the build tools as suggested by the error message: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

mfranberg avatar May 16 '22 07:05 mfranberg

The Programs and Features section in Control Panel suggests I already have Microsoft Visual C++ 14.0 or greater: Microsoft Visual C++ 2015-2019 Redistributable (*64) - 14.26.28720 Microsoft Visual C++ 2015-2019 Redistributable (*86) - 14.28.29325

Given the above info, is outdated Microsoft Visual C++ the reason of my failure to install plinkio?

Additionally, I did downloaded the newest version of Microsoft Visual C++ and I was given the option to install multiple programs: Desktop development with C++, Universal Windows Platform build tools, .NET desktop buid tools, Mobile Development with .NET, Web developent build tools, Azure development build tools, Office/SharePoint build tools, Data storage and proessing build tools, Node.js build tools, and Visual Studio extension development.

If outdated Microsoft Visual C++ is the reason of the installation failure, which of the above program should I click? They seem to occupy quite a lot space. So I wish to install those that are necessary. Thank you.

Patricklv avatar May 16 '22 07:05 Patricklv

Hmm, looks correct then, any chance python is not able to locate your installation of microsoft visual c++?

As mentioned, I don't have much experience with windows development, but of the tools it wants to install the only ones I could imagine are relevant is "Universal Windows Platform build tools". But the link suggested by the error message seems to only contain the build tools "https://visualstudio.microsoft.com/visual-cpp-build-tools/", that should be enough, you shouldn't need the whole visual c++ package.

mfranberg avatar May 16 '22 09:05 mfranberg

The second answer here also has some tips: https://stackoverflow.com/questions/44951456/pip-error-microsoft-visual-c-14-0-is-required

The third answer also suggest updating setuptools might be necessary: pip install --upgrade setuptools

mfranberg avatar May 16 '22 09:05 mfranberg

With #26 and #34, you can compile libplinkio on Windows. However, they haven't been uploaded to PyPI yet. Please use the latest version on github and follow the https://github.com/mfranberg/libplinkio/issues/33#issuecomment-1127426760 procedure.

In summary,

  1. Install Visual Studio Build Tools with the “Visual C++ build tools“ option or the “Desktop development with C++” option as well as Visual C++ Redistributable.
  2. Install Git if you haven't already.
  3. Run pip install --upgrade setuptools.
  4. Run pip install git+https://github.com/mfranberg/libplinkio instead of pip install plinkio.

Kazuki-TAKEDA avatar Jun 27 '22 23:06 Kazuki-TAKEDA

Here is the zip file containing the pre-built wheels. If you cannot build py-plinkio yourself, please use this file. dist.zip

For example, if you are using the 64-bit version of Python 3.8, you can install this wheel by running pip install plinkio-0.9.9-cp38-cp38-win_amd64.whl.

Kazuki-TAKEDA avatar Jul 19 '22 13:07 Kazuki-TAKEDA