rice-solar-physics / pydrad

Python tools for setting up HYDRAD runs and parsing output
https://pydrad.readthedocs.io
MIT License
4 stars 3 forks source link

PYDRAD not working under Anaconda in Windows 10 #133

Closed sjbradshaw closed 3 years ago

sjbradshaw commented 3 years ago

I think I've managed to install and set-up PYDRAD correctly. However, pytest fails to work, leading to the following output: [I have just updated Anaconda too]

(base) C:\Users\sb28\Documents\GitHub\pydrad>pytest Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\manager.py", line 267, in load_setuptools_entrypoints plugin = ep.load() File "C:\Users\sb28\AppData\Roaming\Python\Python37\site-packages\pkg_resources__init__.py", line 2446, in load self.require(*args, **kwargs) File "C:\Users\sb28\AppData\Roaming\Python\Python37\site-packages\pkg_resources__init.py", line 2469, in require items = working_set.resolve(reqs, env, installer, extras=self.extras) File "C:\Users\sb28\AppData\Roaming\Python\Python37\site-packages\pkg_resources\init__.py", line 775, in resolve raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.VersionConflict: (pytest 4.0.2 (c:\programdata\anaconda3\lib\site-packages), Requirement.parse('pytest>=4.6'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\Scripts\pytest-script.py", line 10, in sys.exit(main()) File "C:\ProgramData\Anaconda3\lib\site-packages_pytest\config__init.py", line 58, in main config = _prepareconfig(args, plugins) File "C:\ProgramData\Anaconda3\lib\site-packages_pytest\config__init__.py", line 196, in _prepareconfig pluginmanager=pluginmanager, args=args File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\hooks.py", line 284, in call return self._hookexec(self, self.get_hookimpls(), kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\manager.py", line 67, in _hookexec return self._inner_hookexec(hook, methods, kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\manager.py", line 61, in firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\callers.py", line 203, in _multicall gen.send(outcome) File "C:\ProgramData\Anaconda3\lib\site-packages_pytest\helpconfig.py", line 93, in pytest_cmdline_parse config = outcome.get_result() File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\callers.py", line 80, in get_result raise ex[1].with_traceback(ex[2]) File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\callers.py", line 187, in _multicall res = hook_impl.function(*args) File "C:\ProgramData\Anaconda3\lib\site-packages_pytest\config__init.py", line 675, in pytest_cmdline_parse self.parse(args) File "C:\ProgramData\Anaconda3\lib\site-packages_pytest\config\init__.py", line 854, in parse self._preparse(args, addopts=addopts) File "C:\ProgramData\Anaconda3\lib\site-packages_pytest\config\init__.py", line 808, in _preparse self.pluginmanager.load_setuptools_entrypoints("pytest11") File "C:\ProgramData\Anaconda3\lib\site-packages\pluggy\manager.py", line 273, in load_setuptools_entrypoints message="Plugin %r could not be loaded: %s!" % (ep.name, e), pluggy.manager.PluginValidationError: Plugin 'pytest_cov' could not be loaded: (pytest 4.0.2 (c:\programdata\anaconda3\lib\site-packages), Requirement.parse('pytest>=4.6'))!

Also, the following code fails with the output pasted after it:

config = configure.Configure.load_config('/Users/sb28/Documents/GitHub/pydrad/defaults.asdf') c = configure.Configure(config) print(c.initial_conditions_header) Traceback (most recent call last): File "", line 1, in File "C:\Users\sb28\Documents\GitHub\pydrad\pydrad\configure\configure.py", line 257, in initial_conditions_header maximum_cells=self.maximum_cells, File "C:\Users\sb28\Documents\GitHub\pydrad\pydrad\configure\configure.py", line 426, in maximum_cells n_min = self.config['general']['loop_length'] / self.config['grid']['maximum_cell_width'] KeyError: 'loop_length'

Any ideas?

jwreep commented 3 years ago

pytest worked on my Windows machine (besides warnings).

It looks like your version of pytest is out of date: (pkg_resources.VersionConflict: (pytest 4.0.2 (c:\programdata\anaconda3\lib\site-packages), Requirement.parse('pytest>=4.6'))

Try updating conda: conda update --prefix C:\ProgramData\Anaconda3 anaconda

wtbarnes commented 3 years ago

I agree with Jeff on the pytest issue. I think you just need to upgrade to something greater than 4.6. pytest should print quite a bit of output to the terminal, including the progress of the tests (in real time) and which ones passed and which failed.

With regard to your manual test with the default config, that's my fault. The default config is missing a few options, including the loop length, total time, and I believe the location of the heating for the initial conditions. I will fix that now. I believe the error message should point out which parameter is missing but maybe it's being muddled by all of the other output.

Your code snippet should work if you add the length to your config

config['general']['loop_length'] = 100 * u.Mm
wtbarnes commented 3 years ago

I'm going to close this as the original issue was related to a packaging version number and the subsequent issue is now solved by a more complete configuration in the repo.