Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assistance in operation and setup #18

Open
Omeon opened this issue Oct 11, 2020 · 12 comments
Open

Assistance in operation and setup #18

Omeon opened this issue Oct 11, 2020 · 12 comments

Comments

@Omeon
Copy link

Omeon commented Oct 11, 2020

Hello. I would not pose this question unless absolutely necessary. I am writing my thesis and it is based on your ionospheric model. Unfortunately, I am just starting my path in program design and still cannot figure out how to work with it correctly and what list of commands is available. Searching with Google and looking at almost all files in the repository did not give any answers (the README.tht file was the first one read).
I will say in advance that the library itself is installed on the PC, the Fortran compiler is also installed and configured to work. What needs to be done so that I can receive data on the state of ionization of the ionosphere based on time, certain coordinates and altitude?
Please help in using this library. Thank you very much in advance.

@scivision
Copy link
Member

Which language are you wanting to use IRI2016 from ultimately? From Python or Matlab?

@Omeon
Copy link
Author

Omeon commented Oct 13, 2020

@scivision , I want to use IRI in Python. That is, in the end it must be a command or a function in the code, which, at certain coordinates and time, gives the value of the electron concentration of the F2 layer to a variable.

@scivision
Copy link
Member

This example shows the many variables you can get, and plots Electron number density vs time and altitude. If you don't have Jupyter Notebook, you can just copy and paste the code into a .py file and run from Python as a script.

https://github.com/space-physics/iri2016/blob/master/Examples/Plasma%20Variables.ipynb

@Omeon
Copy link
Author

Omeon commented Oct 15, 2020

I did as you said: for the sake of example, I decided to insert a code snippet into a .py file and it gives an error of the following kind (in debug mode):

RuntimeError generator didn't stop after throw() File "D:\Project\Working version\body\test.py", line 1, in <module> import iri2016.profile as iri

If you run the code without debugging, the error code is as follows:

`Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\importlib\resources.py", line 188, in path
yield Path(reader.resource_path(resource))
File "D:\Project\Working version\work\lib\site-packages\iri2016\base.py", line 17, in
subprocess.check_call(["ctest", "-S", str(setup), "-VV"])
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 359, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 340, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 854, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The specified file cannot be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "d:\Project\Working version\body\test.py", line 1, in
import iri2016.profile as iri
File "D:\Project\Working version\work\lib\site-packages\iri2016_init_.py", line 1, in
from .base import IRI
File "D:\Project\Working version\work\lib\site-packages\iri2016\base.py", line 17, in
subprocess.check_call(["ctest", "-S", str(setup), "-VV"])
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\contextlib.py", line 162, in exit
raise RuntimeError("generator didn't stop after throw()")
RuntimeError: generator didn't stop after throw()`

What could cause this? the Fortran compiler is installed in accordance with the instructions from README.md, all files are updated and it is also registered in the PATH path.

@scivision
Copy link
Member

it appears like CMake might not be installed on your computer. I updated the code to give a clearer error message when this is so.

@Omeon
Copy link
Author

Omeon commented Oct 17, 2020

You were right, CMake was missing. I installed it, added it to PATH. As I understood now, it cannot find the Fortran compiler.

`Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy_main
.py", line 45, in
cli.main()
File "c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 267, in run_file
runpy.run_path(options.target, run_name=compat.force_str("main"))
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "d:\Project\Working version\work\Lib\site-packages\iri2016\profile.py", line 7, in
from .base import IRI
ImportError: attempted relative import with no known parent package
PS D:\Project\Working version> & "d:/Project/Working version/work/Scripts/Activate.ps1"
(work) PS D:\Project\Working version> cd 'd:\Project\Working version'; & 'd:\Project\Working version\work\Scripts\python.exe' 'c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy\launcher' '50220' '--' 'd:\Project\Working version\work\Lib\site-packages\iri2016\profile.py'
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy_main
.py", line 45, in
cli.main()
File "c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 267, in run_file
runpy.run_path(options.target, run_name=compat.force_str("main"))
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Users\User\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "d:\Project\Working version\work\Lib\site-packages\iri2016\profile.py", line 7, in
from .base import IRI
ImportError: attempted relative import with no known parent package
(work) PS D:\Project\Working version> cd 'd:\Project\Working version'; & 'd:\Project\Working version\work\Scripts\python.exe' 'c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy\launcher' '50229' '--' 'd:\Project\Working version\work\Lib\site-packages\iri2016\profile.py'
Traceback (most recent call last):
File "d:\Project\Working version\work\Lib\site-packages\iri2016\profile.py", line 7, in
from .base import IRI
ImportError: attempted relative import with no known parent package
(work) PS D:\Project\Working version> cd 'd:\Project\Working version'; & 'd:\Project\Working version\work\Scripts\python.exe' 'c:\Users\User.vscode\extensions\ms-python.python-2020.9.114305\pythonFiles\lib\python\debugpy\launcher' '50258' '--' 'd:\Project\Working version\body\test.py'

  • Extra verbosity turned on
    Reading Script: D:/Project/Working version/work/Lib/site-packages/iri2016/setup.cmake
    -- CMake 3.18.2
    -- 4 CPU cores detected
    SetCTestConfiguration:SourceDirectory:D:/Project/Working version/work/Lib/site-packages/iri2016
    SetCTestConfiguration:BuildDirectory:D:/Project/Working version/work/Lib/site-packages/iri2016/build
    Run dashboard with model Experimental
    Source directory: D:/Project/Working version/work/Lib/site-packages/iri2016
    Build directory: D:/Project/Working version/work/Lib/site-packages/iri2016/build
    SetCTestConfigurationFromCMakeVariable:Site:CTEST_SITE
    SetCTestConfiguration:Site:Windows
    Site: Windows
    Build name: (empty)
    Use Experimental tag: 20201017-1409
    SetCTestConfiguration:BuildDirectory:D:/Project/Working version/work/Lib/site-packages/iri2016/build
    SetCTestConfiguration:SourceDirectory:D:/Project/Working version/work/Lib/site-packages/iri2016
    SetCTestConfiguration:ConfigureCommand:"C:/Program Files/CMake/bin/cmake.exe" "-GMinGW Makefiles" "D:/Project/Working version/work/Lib/site-packages/iri2016"
    Configure project
    Configure with command: "C:/Program Files/CMake/bin/cmake.exe" "-GMinGW Makefiles" "D:/Project/Working version/work/Lib/site-packages/iri2016"
    Run command: "C:/Program Files/CMake/bin/cmake.exe" "-GMinGW Makefiles" "D:/Project/Working version/work/Lib/site-packages/iri2016"
    CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: CMAKE_Fortran_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    Command exited with the value: 1
    Error(s) when configuring the project
    SetCTestConfiguration:BuildDirectory:D:/Project/Working version/work/Lib/site-packages/iri2016/build
    SetCTestConfiguration:SourceDirectory:D:/Project/Working version/work/Lib/site-packages/iri2016
    SetCTestConfiguration:ConfigureCommand:"C:/Program Files/CMake/bin/cmake.exe" "-GMinGW Makefiles" "D:/Project/Working version/work/Lib/site-packages/iri2016"
    Configure project
    Configure with command: "C:/Program Files/CMake/bin/cmake.exe" "-GMinGW Makefiles" "D:/Project/Working version/work/Lib/site-packages/iri2016"
    Run command: "C:/Program Files/CMake/bin/cmake.exe" "-GMinGW Makefiles" "D:/Project/Working version/work/Lib/site-packages/iri2016"
    CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
    CMake Error: CMAKE_Fortran_COMPILER not set, after EnableLanguage
    -- Configuring incomplete, errors occurred!
    Command exited with the value: 1
    Error(s) when configuring the project
    -- SKIP: ctest_build(): returncode: -1; CMake error code: -1
    -- SKIP: ctest_test(): returncode: -1; CMake error code: -1
    CMake Error at D:/Project/Working version/work/Lib/site-packages/iri2016/setup.cmake:124 (message):
    Build and test failed.`

@scivision
Copy link
Member

It appears that CMake is unable to find Ninja or GNU Make.
Try

python -m pip install ninja

then try running IRI2016 again.

@Omeon
Copy link
Author

Omeon commented Oct 18, 2020

I followed your advice and you were absolutely right. Sorry, a new bug has appeared.

`Configure project
Configure with command: "C:/Program Files/CMake/bin/cmake.exe" "-GNinja" "D:/Project/Working version/work/Lib/site-packages/iri2016"
Run command: "C:/Program Files/CMake/bin/cmake.exe" "-GNinja" "D:/Project/Working version/work/Lib/site-packages/iri2016"
-- The Fortran compiler identification is unknown
CMake Error at CMakeLists.txt:7 (project):
No CMAKE_Fortran_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment
variable "FC" or the CMake cache entry CMAKE_Fortran_COMPILER to the full
path to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred!
See also "D:/Project/Working version/work/Lib/site-packages/iri2016/build/CMakeFiles/CMakeOutput.log".
See also "D:/Project/Working version/work/Lib/site-packages/iri2016/build/CMakeFiles/CMakeError.log".
Command exited with the value: 1
Error(s) when configuring the project
SetCTestConfiguration:BuildDirectory:D:/Project/Working version/work/Lib/site-packages/iri2016/build
SetCTestConfiguration:SourceDirectory:D:/Project/Working version/work/Lib/site-packages/iri2016
SetCTestConfiguration:ConfigureCommand:"C:/Program Files/CMake/bin/cmake.exe" "-GNinja" "D:/Project/Working version/work/Lib/site-packages/iri2016"
Configure project
Configure with command: "C:/Program Files/CMake/bin/cmake.exe" "-GNinja" "D:/Project/Working version/work/Lib/site-packages/iri2016"
Run command: "C:/Program Files/CMake/bin/cmake.exe" "-GNinja" "D:/Project/Working version/work/Lib/site-packages/iri2016"
-- The Fortran compiler identification is unknown
CMake Error at CMakeLists.txt:7 (project):
No CMAKE_Fortran_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment
variable "FC" or the CMake cache entry CMAKE_Fortran_COMPILER to the full
path to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred!
See also "D:/Project/Working version/work/Lib/site-packages/iri2016/build/CMakeFiles/CMakeOutput.log".
See also "D:/Project/Working version/work/Lib/site-packages/iri2016/build/CMakeFiles/CMakeError.log".
Command exited with the value: 1
Error(s) when configuring the project
-- SKIP: ctest_build(): returncode: -1; CMake error code: -1
-- SKIP: ctest_test(): returncode: -1; CMake error code: -1
CMake Error at D:/Project/Working version/work/Lib/site-packages/iri2016/setup.cmake:124 (message):
Build and test failed.`

As I understand it, it cannot find the path to Fortran. Fortran is added to PATH, how can it get around it then? Could there be an error in the path registers?

@scivision
Copy link
Member

scivision commented Oct 19, 2020

I would delete your "build/" directory just to be sure. Secondly, I would set environment variable FC=gfortran as follows depending on what shell you use:

  • command prompt: set FC=gfortran
  • powershell: $env:FC=gfortran

you should be able to just type gfortran --version and not get an error, it should tell you the version. If not, then the PATH isn't including gfortran.exe location

@Omeon
Copy link
Author

Omeon commented Oct 20, 2020

I don't have access to my work computer right now. Tomorrow I will return to him and try to follow your advice. I would like to thank you in advance for your help. There are few people who guide newcomers like this and give them valuable advice.

@scivision
Copy link
Member

Thanks for reporting these issues. Yes the ones developing tend to forgot the little techniques that users may not be aware of.

@Omeon
Copy link
Author

Omeon commented Oct 21, 2020

I have verified that GFortran was installed correctly as you said, verified that the gfortran --version cmd command responds correctly. But for some reason now everything has returned to the old error, which indicates that SMake is not installed on the computer.
#18 (comment)
Perhaps it needs to be used in some special way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants