ibell / pdsim

Steady-State simulation code for positive displacement machines
MIT License
38 stars 25 forks source link

Installation Issue- Building Wheel for PDSim error #89

Open TolikPa opened 9 months ago

TolikPa commented 9 months ago

Dear community,

I am trying to Install PDSim to work on my machine using Anaconda interpreter and PyCharm. I get the following error massage when I do the "pip install -e ." command. I verified that I have the required packages and that they are updated, but the error remains.

Would appreciate any advice on how to resolve the matter.

Thank you very much for helping

" Building wheel for PDSim (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for PDSim (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [11 lines of output] fatal: not a git repository (or any of the parent directories): .git fatal: not a git repository (or any of the parent directories): .git Error: Command '['git', 'rev-parse', 'HEAD']' returned non-zero exit status 128. Unable to extract the git revision, set to placeholder Error: Command '['git', 'rev-parse', '--abbrev-ref', 'HEAD']' returned non-zero exit status 128. Unable to extract the git branch, set to placeholder to be written to init.py: version = '2.14' git_revision = '????' git_branch = '????' 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 PDSim Failed to build PDSim ERROR: Could not build wheels for PDSim, which is required to install pyproject.toml-based projects "

ibell commented 9 months ago

You need to install a compiler as described in the docs, and also in the error message. Did you do a git clone? That is required to make sure all the dependencies are properly included.

TolikPa commented 9 months ago

Thank you very much for the response. I have followed this page for the installation process : https://pdsim.readthedocs.io/en/latest/install_build.html

I have installed TortuiseGit and followed this instructions: "Option A: If you installed TortoiseGit, In Windows Explorer, go to a folder where you want to put the source code for PDSim. Right-click and select “Git Clone…”. Use the URL https://github.com/ibell/pdsim."

ibell commented 9 months ago

Looks like git is not available at the terminal, which is ok, but it is good idea to add git to the path in general.

Did you install a compiler?

TolikPa commented 9 months ago

I have installed Minconda and Visual Studio toolbox

ibell commented 9 months ago

Which Visual Studio?

TolikPa commented 9 months ago

Microsoft Visual C++ 2015-2019 Redistributed (x86) - 14.28.29325 and Microsoft Visual C++ 2015-2019 Redistributed (x64) - 14.38.33130

ibell commented 9 months ago

That's not what you need - see the link in the error message: https://visualstudio.microsoft.com/visual-cpp-build-tools/

TolikPa commented 9 months ago

I have both of them installed; the Visual Studio community 2022 (2) and Visual Studio Build Tools 2022

ibell commented 9 months ago

Hmm, that should be sufficient. Can you do instead: python setup.py build?

TolikPa commented 9 months ago

I have submitted the command in the cmd terminal window I got an: import cython ModuleNotFoundError: No Module named 'cython' During handling of the above expression, another exception occurred: ... ImportError: Sorry the required package cython was not found

ibell commented 9 months ago

Right, you need to do: pip install cython

TolikPa commented 9 months ago

I followed the same process with all the uninstalled packages CoolProp and numpy. Eventually, when I submitted the python setup.py build? It provided me with this response "to be written to init.py.... invalid command name 'build?" and a long list of warnings

ibell commented 9 months ago

How about instead : pip -vv wheel . ?

ibell commented 9 months ago

Just tested on my windows machine and wheel building is fine

ibell commented 9 months ago

FWIW, I have installed VS community 2022

TolikPa commented 9 months ago

still getting the same error Error:failed to build one or more wheels

TolikPa commented 9 months ago

Should I do the installation form VS or terminal should be fine ?

ibell commented 9 months ago

That's an interesting idea. Can you try that? In principle terminal should be ok, but it will depend on the details of how you installed.

TolikPa commented 9 months ago

I tried to run it thou VS build tool terminal, and from the VS terminal itself. it resulted in the same error.

Is it possible that I should change something in the setup file to the pyproject file?

ibell commented 9 months ago

Can you post the entire terminal output from your command to the error? Not sure it will be illuminating, but I don't have any great ideas at present.

TolikPa commented 9 months ago

Good morning, the massage is

Obtaining file:///C:/Users/tolik/pdsim Installing build dependencies ... done Checking if build backend supports build_editable ... done Getting requirements to build editable ... done Installing backend dependencies ... done Preparing editable metadata (pyproject.toml) ... done Building wheels for collected packages: PDSim Building editable for PDSim (pyproject.toml) ... error error: subprocess-exited-with-error

× Building editable for PDSim (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [74 lines of output] to be written to init.py: version = '2.14' git_revision = '710b8615a7d9dd67afff9c8d1bf608a9eb97efe8' git_branch = 'master' C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\normal\Lib\site-packages\wheel\bdist_wheel.py:108: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")): Traceback (most recent call last): File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 150, in run self._create_wheel_file(bdist_wheel) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 339, in _create_wheel_file files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 262, in _run_build_commands self._run_build_subcommands() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 289, in _run_build_subcommands self.run_command(name) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command super().run_command(command) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 345, in run self.build_extensions() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\Cython\Distutils\build_ext.py", line 135, in build_extension super(build_ext, self).build_extension(ext) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 548, in build_extension objects = self.compiler.compile( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 343, in compile self.initialize() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 253, in initialize vc_env = _get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools\msvc.py", line 228, in msvc14_get_vc_env return _msvc14_get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools\msvc.py", line 185, in _msvc14_get_vc_env raise distutils.errors.DistutilsPlatformError("Unable to find vcvarsall.bat") distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ C:\Users\tolik\AppData\Local\Temp\pip-build-env-ivivdi6a\overlay\Lib\site-packages\setuptools_distutils\dist.py:988: _DebuggingTips: Problem in editable installation. !!

          ********************************************************************************
          An error happened while installing `PDSim` in editable mode.

          The following steps are recommended to help debug this problem:

          - Try to install the project normally, without using the editable mode.
            Does the error still persist?
            (If it does, try fixing the problem before attempting the editable mode).
          - If you are using binary extensions, make sure you have all OS-level
            dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
          - Try the latest version of setuptools (maybe the error was already fixed).
          - If you (or your project dependencies) are using any setuptools extension
            or customization, make sure they support the editable mode.

          After following the steps above, if the problem still persists and
          you think this is related to how setuptools handles editable installations,
          please submit a reproducible example
          (see https://stackoverflow.com/help/minimal-reproducible-example) to:

              https://github.com/pypa/setuptools/issues

          See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
          ********************************************************************************

  !!
    cmd_obj.run()
  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 editable for PDSim Failed to build PDSim ERROR: Could not build wheels for PDSim, which is required to install pyproject.toml-based projects

ibell commented 9 months ago

Can you post the output when you run from a Visual Studio shell? It seems like your config is messed up on your computer if python cannot find vcvarsall.bat (which sets a bunch of paths and environment variables)

TolikPa commented 9 months ago

Ian, thank you very much for looking into this; here is the error message from Visual Studio from the power shell; the code that I ran was "pip install -e ."


PS C:\Users\tolik\pdsim> pip install -e .
Installing build dependencies ... done Checking if build backend supports build_editable ... done Getting requirements to build editable ... done Installing backend dependencies ... done Preparing editable metadata (pyproject.toml) ... done Building wheels for collected packages: PDSim Building editable for PDSim (pyproject.toml) ... error error: subprocess-exited-with-error

× Building editable for PDSim (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [74 lines of output] to be written to init.py: version = '2.14' git_revision = '710b8615a7d9dd67afff9c8d1bf608a9eb97efe8' git_branch = 'master' C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\normal\Lib\site-packages\wheel\bdist_wheel.py:108: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")): Traceback (most recent call last): File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 150, in run self._create_wheel_file(bdist_wheel) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 339, in _create_wheel_file files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 262, in _run_build_commands self._run_build_subcommands() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 289, in _run_build_subcommands self.run_command(name) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools\dist.py", line 963, in run_command super().run_command(command) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 345, in run self.build_extensions() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\Cython\Distutils\build_ext.py", line 135, in build_extension super(build_ext, self).build_extension(ext) File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 548, in build_extension objects = self.compiler.compile( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 343, in compile self.initialize() File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils_msvccompiler.py", line 253, in initialize vc_env = _get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools\msvc.py", line 228, in msvc14_get_vc_env return _msvc14_get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools\msvc.py", line 185, in _msvc14_get_vc_env raise distutils.errors.DistutilsPlatformError("Unable to find vcvarsall.bat") distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ C:\Users\tolik\AppData\Local\Temp\pip-build-env-3b3ku4zm\overlay\Lib\site-packages\setuptools_distutils\dist.py:988: _DebuggingTips: Problem in editable installation. !!

          ********************************************************************************
          An error happened while installing `PDSim` in editable mode.

          The following steps are recommended to help debug this problem:

          - Try to install the project normally, without using the editable mode.
            Does the error still persist?
            (If it does, try fixing the problem before attempting the editable mode).
          - If you are using binary extensions, make sure you have all OS-level
            dependencies installed (e.g. compilers, toolchains, binary libraries, ...).
          - Try the latest version of setuptools (maybe the error was already fixed).
          - If you (or your project dependencies) are using any setuptools extension
            or customization, make sure they support the editable mode.

          After following the steps above, if the problem still persists and
          you think this is related to how setuptools handles editable installations,
          please submit a reproducible example
          (see https://stackoverflow.com/help/minimal-reproducible-example) to:

              https://github.com/pypa/setuptools/issues

          See https://setuptools.pypa.io/en/latest/userguide/development_mode.html for details.
          ********************************************************************************

  !!
    cmd_obj.run()
  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 editable for PDSim Failed to build PDSim ERROR: Could not build wheels for PDSim, which is required to install pyproject.toml-based projects ***8

ibell commented 9 months ago

I am running out of ideas, it should not behave like this. In your developer prompt, can you do this:

**********************************************************************
** Visual Studio 2022 Developer Command Prompt v17.9.0
** Copyright (c) 2022 Microsoft Corporation
**********************************************************************

D:\Program Files\Microsoft Visual Studio\2022\Community>where cl
D:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\bin\Hostx86\x86\cl.exe
TolikPa commented 7 months ago

Hey Ian, I was able to install and run the PDSim at the end, but the problem was that it couldn't build the wheels and finish the installation.

The missing step was to go into the Visual studio build tools and install the C++ package (it is a two-step installation process that was needed).

Thank you very much for your time and for looking into it.

Looking forward to get some results out of the software

Have a great day

ibell commented 7 months ago

That is great to hear. I somehow thought that the C++ tooling was installed by default so I didn't think to mention that. Good to know.