Open Oussamaaat opened 4 months ago
My guess is that the solid.for
is not compiled as well. How did you install the code?
i used the 3rd option below, it seemed to have compiled it but i'll try again today... thank you for your feedback!! any suggestions for compilers on windows ?
# option 3: manually compile the Fortran code and setup environment variable
cd PySolid/src/pysolid
f2py -c -m solid solid.for
export PYTHONPATH=${PYTHONPATH}:~/tools/PySolid
I would recommend using conda/mamba install
directly, instead of compiling it yourself, which can be buggy. I have not tried it on windows before.
thanks, i tried conda but the error is still there.. i think the .for file is not compiled successfully... i'll see if i can install it on linux wsl
thanks, i tried conda but the error is still there.. i think the .for file is not compiled successfully... i'll see if i can install it on linux wsl
Well.....I have the same issue. I used conda to install all requested packages (successed).
To install Pysolid,
First I use "python -m pip install PySolid", the error message is below: ..... Building wheel for PySolid (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for PySolid (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [20 lines of output] scikit-build-core 0.9.8 using CMake 3.30.0 (wheel) Configuring CMake... 2024-07-18 15:09:13,582 - scikit_build_core - WARNING - Can't find a Python library, got libdir=None, ldlibrary=None, multiarch=None, masd=None loading initial cache file C:\Users\201113~1\AppData\Local\Temp\tmp7pzmcsae\build\CMakeInit.txt -- Building for: NMake Makefiles CMake Error at CMakeLists.txt:5 (project):not compiled successfully Running
'nmake' '-?'
failed with:
no such file or directory
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_Fortran_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred!
*** CMake configuration failed [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for PySolid Failed to build PySolid ERROR: Could not build wheels for PySolid, which is required to install pyproject.toml-based projects
it seems something wrong in the pyproject.toml. Anyway, can't work.
flang -Wl,--version
stdout:
stderr: flang.exe: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found]
flang.exe: error: unable to execute command: program not executable
flang.exe: error: linker command failed with exit code 1 (use -v to see invocation)Therefore, I think "solid.for" is not compiled successfully. The problem could be the commands to built the solid.for . Does anyone know the output after successful compile the solid.for....
I change to install gcc version 13.2.0 and GNU fortran 13.2.0 (Rev6, Built by MSYS2 project) and manually compile the Fortran code and setup environment variable python -m numpy.f2py -c solid.for -m soild but it failed at the last step, " FAILED: soild.cp312-win_amd64.pyd" The message is below: ........ The Meson build system Version: 1.5.0 Source dir: C:\Users\201113Z10\AppData\Local\Temp\tmppf_ohmsa Build dir: C:\Users\201113Z10\AppData\Local\Temp\tmppf_ohmsa\bbdir Build type: native build Project name: soild Project version: 0.1 Fortran compiler for the host machine: gfortran (gcc 13.2.0 "GNU Fortran (Rev6, Built by MSYS2 project) 13.2.0") Fortran linker for the host machine: gfortran ld.bfd 13.2.0 C compiler for the host machine: cc (gcc 13.2.0 "cc (Rev6, Built by MSYS2 project) 13.2.0") C linker for the host machine: cc ld.bfd 13.2.0 Host machine cpu family: x86_64 Host machine cpu: x86_64 Program C:\Users\201113Z10\AppData\Local\Programs\Python\Python312\python.exe found: YES (C:\Users\201113Z10\AppData\Local\Programs\Python\Python312\python.exe) Run-time dependency python found: YES 3.12 Library quadmath found: YES Build targets in project: 1
Found ninja-1.11.1.git.kitware.jobserver-1 at C:\Users\201113Z10\AppData\Local\Programs\Python\Python312\Scripts\ninja.EXE INFO: autodetecting backend as ninja INFO: calculating backend command to run: C:\Users\201113Z10\AppData\Local\Programs\Python\Python312\Scripts\ninja.EXE -C C:/Users/201113Z10/AppData/Local/Temp/tmppf_ohmsa/bbdir ninja: Entering directory `C:/Users/201113Z10/AppData/Local/Temp/tmppf_ohmsa/bbdir' [5/6] Compiling Fortran object soild.cp312-win_amd64.pyd.p/solid.for.obj ../solid.for:1464:10:
1464 | it1=365.25d0*y | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1465:10:
1465 | it2=30.6001d0*(m+1) | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1487:9:
1487 | ia=(rjd+0.5d0) | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1489:9:
1489 | ic=(ib-122.1d0)/365.25d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1490:9:
1490 | id=365.25d0*ic | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1491:9:
1491 | ie=(ib-id)/30.6001d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1496:10:
1496 | it1=ie*30.6001d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1497:10:
1497 | idy=ib-id-it1+fmjd | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1498:10:
1498 | it2=ie/14.d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1500:10:
1500 | it3=(7+imo)/10.d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1504:10:
1504 | ihr=tmp | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1506:10:
1506 | imn=tmp | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1351:10:
1351 | it1=365.25d0*y | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1352:10:
1352 | it2=30.6001d0*(m+1) | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1125:13:
1125 | i = ghad/360.d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1387:10:
1387 | it1=365.25d0*y | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1388:10:
1388 | it2=30.6001d0*(m+1) | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1411:10:
1411 | mjd=mjd0+tsec/86400.d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1416:9:
1416 | ia=(rjd+0.5d0) | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1418:9:
1418 | ic=(ib-122.1d0)/365.25d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1419:9:
1419 | id=365.25d0*ic | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1420:9:
1420 | ie=(ib-id)/30.6001d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1425:10:
1425 | it1=ie*30.6001d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1426:10:
1426 | idy=ib-id-it1+fmjd | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1427:10:
1427 | it2=ie/14.d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1429:10:
1429 | it3=(7+imo)/10.d0 | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1433:10:
1433 | ihr=tmp | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:1435:10:
1435 | imn=tmp | 1 Warning: Possible change of value in conversion from REAL(8) to INTEGER(4) at (1) [-Wconversion] ../solid.for:736:34:
736 | subroutine step2lon(xsta,fhr,t,xcorsta) | 1 Warning: Unused dummy argument 'fhr' at (1) [-Wunused-dummy-argument] [6/6] Linking target soild.cp312-win_amd64.pyd FAILED: soild.cp312-win_amd64.pyd ............
Finally, I manually compiled the Fortran code in Windows 11 ...after 3 days. Here is my steps.
Install anaconda and create environment of Python 3.10.
conda create --name py310 python=3.10
Install Visual Studio community 2022 and Intel® oneAPI Base Toolkit for the c and fortran compiler. (https://visualstudio.microsoft.com/zh-hant/vs/ ; https://www.intel.com/content/www/us/en/developer/tools/oneapi/base-toolkit-download.html) I also get the information to install the c and fortran compiler using PIP install, but I didn't try. (https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-windows/2024-2/pip.html#LIST-OF-AVAILABLE-PACKAGES) install Visual Studio community 2022 ---> choose C++ desktop environment remember the number of win11 SDK 10.0.22621.0 you may need to restart the computer, to launch the environmental setting.
Execute Anaconda prompt with administrator privileges (right click on Anaconda prompt and select as administrator) and activate the environment py310.
conda activate py310
install some dependencies required using pip.
pip install meson pip install numpy pip install scipy pip install scikit_build_core pip install setuptools_scm pip install matplotlib conda install -c conda-forge pysolid
Now, you may install the pysolid 0.3.2 successfully. The package of pysolid is in the path as: C:\Users\flex0\anaconda3\envs\py310\Lib\site-packages\pysolid C:\Users\flex0\anaconda3\envs\py310\Lib\site-packages\pysolid-0.3.2.dist-info
However, when using the following and it will show "DLL load failed..." (something like that....so I try to manually compiling the soild.for)
python -c "import pysolid; print(pysolid.version)"
After you download the source code and go to the folder "pysolid-0.3.3\src\pysolid" There is solid.for in the folder.
f2py -c -m solid solid.for
If it find the c and fortran compiler, it will like figure below:
You will have error messages as below: C:\Users\flex0\anaconda3\envs\py310\include\pyconfig.h(59): fatal error C1083: �L�k�}�ҥ]�t�ɮ�: 'io.h': No such file or directory
To solve the error messages and the number in the path is the win SDK number:
>set INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64
>set LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\um\x64;C:\Program Files (x86)\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64;C:\Program Files (x86)\Intel\oneAPI\compiler\2024.2\lib
Copy "rc.exe" and "rcdll.dll" from C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64\ to C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.40.33807\bin\Hostx86\x64\
Again,
f2py -c -m solid solid.for and no error messages.
You will get a " solid.cp310-win_amd64.pyd" with the original files of "solid.for", " init.py", "grid.py", "point.py" in the folder.
Copy these files "solid.cp310-win_amd64.pyd", "solid.for", " init.py", "grid.py", "point.py"
to C:\Users\flex0\anaconda3\envs\py310\Lib\site-packages\pysolid
(before replace the files in the folder, you can backup the original files)
Change the name of the folder: C:\Users\flex0\anaconda3\envs\py310\Lib\site-packages\pysolid-0.3.2.dist-info
into C:\Users\flex0\anaconda3\envs\py310\Lib\site-packages\pysolid-0.3.3.dist-info
Edit METADATA in C:\Users\flex0\anaconda3\envs\py310\Lib\site-packages\pysolid-0.3.3.dist-info
Check you have install pysolid 0.3.3
>python -c "import pysolid; print(pysolid.__version__)"
and no DLL load faile.......
Hope you guys success! Only for python 3.10, not works for python 3.12
(python 3.11.3 windows)
when running
python -c "import pysolid; print(pysolid.__version__)"
i get0.3.2
which means pysolid was installed succesfully ? when i runpython PySolid/tests/grid.py
i get the following error :D:\test_gnss\PySolid\tests\grid.py Traceback (most recent call last): File "D:\test_gnss\gnss\Lib\site-packages\pysolid\grid.py", line 45, in calc_solid_earth_tides_grid from pysolid.solid import solid_grid ImportError: DLL load failed while importing solid: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "D:\test_gnss\PySolid\tests\grid.py", line 33, in
tide_u) = pysolid.calc_solid_earth_tides_grid(dt_obj, atr, verbose=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\test_gnss\gnss\Lib\site-packages\pysolid\grid.py", line 50, in calc_solid_earth_tides_grid
raise ImportError(msg)
ImportError: Cannot import name 'solid' from 'pysolid'!
Maybe solid.for is NOT compiled yet.
Check instruction at: https://github.com/insarlab/PySolid.