tianyikillua / medcoupling

Python repackaging of the MEDCoupling library
GNU Lesser General Public License v2.1
4 stars 3 forks source link

Trouble installing medcoupling #3

Open azzeddinetiba opened 2 years ago

azzeddinetiba commented 2 years ago

Hello Tianyi,

I had trouble installing medcoupling on both mac and Windows 10. It seems to me having a trouble finding the right python directories.

On Mac, using Python 3.9.7, cmake 3.22.0, and swig 4.0.2 I have the following error msg after pip install -U medcoupling:

  ERROR: Command errored out with exit status 1:
   command: /opt/anaconda3/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-install-vspme959/medcoupling_491eaf0d74334802b7316ea9b202b261/setup.py'"'"'; __file__='"'"'/private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-install-vspme959/medcoupling_491eaf0d74334802b7316ea9b202b261/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-wheel-vnse9cao
       cwd: /private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-install-vspme959/medcoupling_491eaf0d74334802b7316ea9b202b261/
  Complete output (88 lines):
  /opt/anaconda3/lib/python3.9/site-packages/setuptools/dist.py:487: UserWarning: Normalizing '9.4.0r1' to '9.4.0.post1'
    warnings.warn(tmpl.format(**locals()))
  running bdist_wheel
  running build
  running build_py
  Downloading http://files.salome-platform.org/Salome/other/medCoupling-9.4.0.tar.gz...
  Extracting...
  Applying patch...
  /bin/sh: patches/configuration.patch: No such file or directory
  /bin/sh: patches/medcoupling.patch: No such file or directory
  CMake Deprecation Warning at CMakeLists.txt:20 (CMAKE_MINIMUM_REQUIRED):
    Compatibility with CMake < 2.8.12 will be removed from a future version of
    CMake.
    Update the VERSION argument <min> value or use a ...<max> suffix to tell
    CMake that the project does not need compatibility with older versions.

  -- The C compiler identification is AppleClang 13.0.0.13000029
  -- The CXX compiler identification is AppleClang 13.0.0.13000029
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - done
  -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
  -- Detecting C compile features
  -- Detecting C compile features - done
  -- Detecting CXX compiler ABI info
  -- Detecting CXX compiler ABI info - done
  -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
  -- Detecting CXX compile features
  -- Detecting CXX compile features - done
  -- Performing Test COMPILER_SUPPORTS_NO_OPERATOR_NAMES
  -- Performing Test COMPILER_SUPPORTS_NO_OPERATOR_NAMES - Success
  -- Performing Test COMPILER_SUPPORTS_CXX11
  -- Performing Test COMPILER_SUPPORTS_CXX11 - Success
  -- Performing Test COMPILER_SUPPORTS_CXX0X
  -- Performing Test COMPILER_SUPPORTS_CXX0X - Success
  -- Enable C++11 support
  -- Variable PYTHONINTERP_ROOT_DIR was not explicitly defined. An installation was found anyway: /opt/anaconda3/bin
  -- Python libraries: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython3.9.dylib
  -- Python include dir: /System/Library/Frameworks/Python.framework/Versions/2.7/include/python3.9
  -- Variable PYTHONLIBS_ROOT_DIR was not explicitly defined. An installation was found anyway: /System/Library/Frameworks/Python.framework/Versions/2.7
  CMake Error at /private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-install-vspme959/medcoupling_491eaf0d74334802b7316ea9b202b261/configuration-9.4.0/cmake/FindSalomePythonLibs.cmake:66 (SALOME_EXTRACT_VERSION):
    SALOME_EXTRACT_VERSION Macro invoked with incorrect arguments for macro
    named: SALOME_EXTRACT_VERSION
  Call Stack (most recent call first):
    CMakeLists.txt:171 (FIND_PACKAGE)

  CMake Error at /private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-install-vspme959/medcoupling_491eaf0d74334802b7316ea9b202b261/configuration-9.4.0/cmake/FindSalomePythonLibs.cmake:71 (MESSAGE):
    Python libs and interpreter versions are NOT matching: vs 3.9.7
  Call Stack (most recent call first):
    CMakeLists.txt:171 (FIND_PACKAGE)

  -- Configuring incomplete, errors occurred!
  See also "/private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-install-vspme959/medcoupling_491eaf0d74334802b7316ea9b202b261/medCoupling-9.4.0/build/CMakeFiles/CMakeOutput.log".
  See also "/private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-install-vspme959/medcoupling_491eaf0d74334802b7316ea9b202b261/medCoupling-9.4.0/build/CMakeFiles/CMakeError.log".
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/mp/h7b8hbp16j3dsm48zv_kfqzc0000gn/T/pip-install-vspme959/medcoupling_491eaf0d74334802b7316ea9b202b261/setup.py", line 176, in <module>
      setup(
    File "/opt/anaconda3/lib/python3.9/site-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
       ...
azzeddinetiba commented 2 years ago

On Windows 10, I had to install using python setup.py install after modifying line 120 into cmake_args += ["-G", "Visual Studio 16 2019"] and I get the following error msg :

    CMake that the project does not need compatibility with older versions.

  -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19043.
  CMake Warning at C:/Users/azzed/Documents/Mechanical engineering/PhD_Year/medcoupling-master/medcoupling-master/configuration-9.4.0/cmake/SalomeSetupPlatform.cmake:130 (MESSAGE):
    Compiler C:/Program Files (x86)/Microsoft Visual
    Studio/2019/BuildTools/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe has
    no C++11 support.
  Call Stack (most recent call first):
    CMakeLists.txt:49 (INCLUDE)

  CMake Error at C:/Users/azzed/Documents/Mechanical engineering/PhD_Year/medcoupling-master/medcoupling-master/configuration-9.4.0/cmake/FindSalomePythonLibs.cmake:66 (SALOME_EXTRACT_VERSION):
    SALOME_EXTRACT_VERSION Macro invoked with incorrect arguments for macro
    named: SALOME_EXTRACT_VERSION
  Call Stack (most recent call first):
    CMakeLists.txt:171 (FIND_PACKAGE)

  CMake Error at C:/Users/azzed/Documents/Mechanical engineering/PhD_Year/medcoupling-master/medcoupling-master/configuration-9.4.0/cmake/FindSalomePythonLibs.cmake:71 (MESSAGE):
    Python libs and interpreter versions are NOT matching: vs 3.8.3
  Call Stack (most recent call first):
    CMakeLists.txt:171 (FIND_PACKAGE)

  -- Configuring incomplete, errors occurred!

Using Python 3.8.3, cmake 3.22.0 and swig 4.0.2.

Thank you

azzeddinetiba commented 2 years ago

On Windows 10, I had to install using python setup.py install after modifying line 120 into cmake_args += ["-G", "Visual Studio 16 2019"] and I get the following error msg :

    CMake that the project does not need compatibility with older versions.

  -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19043.
  CMake Warning at C:/Users/azzed/Documents/Mechanical engineering/PhD_Year/medcoupling-master/medcoupling-master/configuration-9.4.0/cmake/SalomeSetupPlatform.cmake:130 (MESSAGE):
    Compiler C:/Program Files (x86)/Microsoft Visual
    Studio/2019/BuildTools/VC/Tools/MSVC/14.27.29110/bin/Hostx64/x64/cl.exe has
    no C++11 support.
  Call Stack (most recent call first):
    CMakeLists.txt:49 (INCLUDE)

  CMake Error at C:/Users/azzed/Documents/Mechanical engineering/PhD_Year/medcoupling-master/medcoupling-master/configuration-9.4.0/cmake/FindSalomePythonLibs.cmake:66 (SALOME_EXTRACT_VERSION):
    SALOME_EXTRACT_VERSION Macro invoked with incorrect arguments for macro
    named: SALOME_EXTRACT_VERSION
  Call Stack (most recent call first):
    CMakeLists.txt:171 (FIND_PACKAGE)

  CMake Error at C:/Users/azzed/Documents/Mechanical engineering/PhD_Year/medcoupling-master/medcoupling-master/configuration-9.4.0/cmake/FindSalomePythonLibs.cmake:71 (MESSAGE):
    Python libs and interpreter versions are NOT matching: vs 3.8.3
  Call Stack (most recent call first):
    CMakeLists.txt:171 (FIND_PACKAGE)

  -- Configuring incomplete, errors occurred!

Using Python 3.8.3, cmake 3.22.0 and swig 4.0.2.

Thank you

after setting an environment variable 'PYTHON_ROOT_DIR' to the python path, building wheels pursued a little bit before issuing another error :


    Waiting for swig wrappings !!!
    XXXXXXXXX/medcoupling-master/medcoupling-master/medCoupling-9.4.0/build/src/MEDCoupling_Swig/CMakeFiles/_MEDCouplingCompat.dir/MEDCouplingPYTHON_wrap.
cxx was unexpected at this time.
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6006: "cmd.exe" exited with c
ode 255. [C:\XXXXXXXXX\medcoupling-master\medcoupling-master\medCoupling-9.4.0\build\src\MEDCoupling_Swig\_MEDCouplingCom
pat_ready.vcxproj]
    interpkernel.vcxproj -> C:\XXXXXXXXX\medcoupling-master\medcoupling-master\medCoupling-9.4.0\build\src\INTERP_KERNEL\
Release\interpkernel.dll
    medcouplingcpp.vcxproj -> C:\XXXXXXXXX\medcoupling-master\medcoupling-master\medCoupling-9.4.0\build\src\MEDCoupling\
Release\medcoupling.dll
    medcouplingremapper.vcxproj -> C:\XXXXXXXXX\medcoupling-master\medcoupling-master\medCoupling-9.4.0\build\src\MEDCoup
ling\Release\medcouplingremapper.dll
    _MEDCouplingRemapper.vcxproj -> C:\XXXXXXXXX\medcoupling-master\medcoupling-master\medCoupling-9.4.0\build\src\MEDCou
pling_Swig\Release\_MEDCouplingRemapper.pyd
    Waiting for swig wrappings !!!
    XXXXXXXXX/medcoupling-master/medcoupling-master/medCoupling-9.4.0/build/src/PyWrapping/CMakeFiles/_medcoupling.dir/medcouplingPYTHON_wrap.cxx was unex
pected at this time.
  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(234,5): error MSB6006: "cmd.exe" exited with c
ode 255.
tianyikillua commented 2 years ago

@azzeddinetiba I'll have a look if I have some time.

I think we will first upgrade to the latest version of medCoupling 9.7: https://salome-platform.org/downloads/current-version

tianyikillua commented 2 years ago

I'm able to build now for medCoupling 9.7, under Windows 10 / Miniconda. A binary wheel has been uploaded medcoupling-9.7.0.post1-cp37-cp37m-win_amd64.whl, if you are using Python 3.7 you can directly use it pip install -U medcoupling.

If you want to build from source (for instance you are using Python 3.8, 3.9)

azzeddinetiba commented 2 years ago

Works perfectly in Linux and Windows. Thank you

[ For potential future users, I had to change the maximum path length limitation in my Windows for the building to work ( https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd ) ]

It still returns the same error in Mac tho (Python 3.9.7)

tianyikillua commented 2 years ago

Works perfectly in Linux and Windows. Thank you

Great!!

For Mac a patch maybe necessary...I'll have a look.