andreatramacere / jetset

JetSeT a framework for self-consistent modeling and fitting of astrophysical relativistic jets
BSD 3-Clause "New" or "Revised" License
30 stars 15 forks source link

Issue with pytest after installation from anaconda(recommended for linux) #54

Closed basuparth closed 2 years ago

basuparth commented 2 years ago

Hi, I just installed jetset with anaconda without any issues. But when I run the "pytest" command I get the following error:-

pytest --disable-warnings --pyargs jetset.tests.test_users::test_short ============================= test session starts ============================== platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 rootdir: /home/username collected 0 items

============================ no tests ran in 0.00s ============================= ERROR: module or package not found: jetset.tests.test_users::test_short (missing init.py?)

I did have jetset environment activated before I ran the test.

Secondly, I do not understand the instruction about "run all the examples outside of the installation dir" when installing with anaconda. As per the previous instructions, we created a separate environment called jetset and installed jetset over there, but we did not create any installation directory in the sense we normally would when installing by downloading the tar file->unzipping-> . . .? So, exactly what is the directory we are supposed to exit before running the examples? I am sorry if I am missing something obvious but could you please guide me about this.

P.S.- Best wishes for a merry Christmas and boxing day to this amazing community !

andreatramacere commented 2 years ago

Hi, merry Christmas to you!!! and thanks for using jetset. Which version are you using? Did you install from source or binaries? Cheers Andrea

basuparth commented 2 years ago

The version is 1.1.2. I basically followed the "Install JetSeT from Anaconda(suggested for OSX and Linux)".

conda install -c andreatramacere jetset

worked fine for me and there was no need to use

conda install -c andreatramacere -c astropy -c conda-forge jetset

andreatramacere commented 2 years ago

Hi, these instructions, to leave the directory etc, are for installation from the source. Skip the tests, and run the notebooks or the script where you prefer. In any case, I suggest you use the pre-release of version 1.2.0, i.e. version 1.2.0.rc11 The easiest way is to download the script a) https://github.com/andreatramacere/jetset-installer b) run the command "python jetset_installer.py 1.2.0rc11' The documentation for this version is here: https://andreatramacere.github.io/jetsetdoc/html/index.html This version is very close to the forthcoming 1.2.0, has several new features and bug fixing. No need to run tests, you can use directly the user guide. I noticed that with python 3.8, there are issues if your conda distribution install astropy>=5.0. So, if you use 1.2.0rc11, and your conda environment has astropy >=5.0, force to downgrade to astropy 4.2,or wait that I do a new releases within today or tomorrow, I will keep you updated in this thread.

basuparth commented 2 years ago

Great!, thanks for the detailed directions. On a slightly different matter, In your github, there is a repo on tutorial lectures given at Wuerzburg via zoom. I was wondering if there are any recordings of those lectures ? It would be a great resource to have.

andreatramacere commented 2 years ago

Hi, the release 1.2.0rc12 for conda is ready, so you can run "python jetset_installer.py 1.2.0rc12' Unfortunately, conda sometimes is a bit problematic, so I suggest 1) create a new conda env 2) follow the installation process described above for 1.2.0rc12 4) leave the directory where you run the installation process (i.e. where you run the jetset_installer.py script) 3) run this command: python -c 'import astropy; print(astropy.version);exit();' 4) if the version is >=5.0, force anaconda to downgrade to astropy 4.2

andreatramacere commented 2 years ago

Great!, thanks for the detailed directions. On a slightly different matter, In your github, there is a repo on tutorial lectures given at Wuerzburg via zoom. I was wondering if there are any recordings of those lectures ? It would be a great resource to have.

Unfortunately, I do not have recordings, I should ask the host institute. I plan to open a youtube channel for jetset, but it will take some time. If you have doubts or comments send me a message Cheers Andrea

basuparth commented 2 years ago

I tried installing the latest version, but now I run into the error

pytest --disable-warnings --pyargs jetset.tests.test_users::test_short ======================================= test session starts ======================================== platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 rootdir: /home/jotil collected 0 items / 1 error

============================================== ERRORS ============================================== _ ERROR collecting Tron/anaconda3/envs/jetset/lib/python3.8/site-packages/jetset/tests/testusers.py ImportError while importing test module '/home/jotil/Tron/anaconda3/envs/jetset/lib/python3.8/site-packages/jetset/tests/test_users.py'. Hint: make sure your test modules/packages have valid Python names. Traceback: Tron/anaconda3/envs/jetset/lib/python3.8/importlib/init.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) Tron/anaconda3/envs/jetset/lib/python3.8/site-packages/jetset/tests/test_users.py:3: in from .test_functions import test_short E ImportError: cannot import name 'test_short' from 'jetset.tests.test_functions' (/home/jotil/Tron/anaconda3/envs/jetset/lib/python3.8/site-packages/jetset/tests/test_functions.py) ===================================== short test summary info ====================================== ERROR Tron/anaconda3/envs/jetset/lib/python3.8/site-packages/jetset/tests/test_users.py =================================== 2 warnings, 1 error in 0.23s =================================== ERROR: not found: /home/jotil/Tron/anaconda3/envs/jetset/lib/python3.8/site-packages/jetset/tests/test_users.py::test_short (no name '/home/jotil/Tron/anaconda3/envs/jetset/lib/python3.8/site-packages/jetset/tests/test_users.py::test_short' in any of [])

I tried both the above method and separately by following the instructions by downloading the new package from github and installing by using setup.py. But both of them were unsuccessful. However, when I tried installing the jetset-stable version the pytests resulted into

pytest --disable-warnings --pyargs jetset.tests.test_users::test_short ============================= test session starts ============================== platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 rootdir: /home/jotil/Tron/ collected 1 item

. . [100%]

====================== 1 passed, 1060 warnings in 15.97s =======================

btw the setup.py process ends in JETSETBESSELBUILD False. Is there any significance to it?

andreatramacere commented 2 years ago

Hi, please install version 1.2.0rc12 with jetset_installer.py script, and do not run the test, just try to follow the user guide here https://andreatramacere.github.io/jetsetdoc/html/user_guide/user_guide.html Cheers Andrea

basuparth commented 2 years ago

Done! and sped through the Tutorial1 without any hiccups. Looking forward to working through all the tutorials and documentation tomorrow. And thanks for being so responsive.

A minor note -- while installing with jetset-installer we have to install wget. Now while installing with pip the command "pip install wget" is fine but to get the "import wget" working in python using conda we need "conda install -c anaconda pywget" instead of wget. As "conda install wget" installs wget for use at the conda prompt alone and not for import in python.