sambit-giri / tools21cm

MIT License
22 stars 18 forks source link

Installation in editable/development mode does not work properly #25

Closed garrelt closed 2 years ago

garrelt commented 2 years ago

The documentation suggests installing the package as pip install -e /path/to/tools21cm [--user] to allow doing development work on it. However, if you do this (or any other type of development install such as python setup.py develop or conda develop /path/to/tools21cm, you cannot run import tools21cm from within python. The reason is that the source directory is called t2c and not tools21cm. If you change the name of the source directory to tools21cm the import command works again. If you do not, you can also run import t2c which does work. However, I am not sure if we want to have a different import command for the development version.

If there are good reasons not to rename the directory we could perhaps add a soft link?

sambit-giri commented 2 years ago

I have made changes in the structure of the package and now using setuptools instead of distutils. This seems to resolve the problem for me. Can you check with the updated version?

garrelt commented 2 years ago

Sorry, I had already changed to setuptools but even then there needs to be a directory tools21cm in tools21cm. It does not work with only t2c.

sambit-giri commented 2 years ago

I have changed a few other things. Did you try the latest version?

garrelt commented 2 years ago

I created a new conda environment, based on python 3.10. I git cloned your distribution: git clone git://github.com/sambit-giri/tools21cm.git I installed it with pip: pip install -e /home/gmell/Science/Codes/tools21cm_new/tools21cm/ I changed directory and ran python and imported tools21cm: python -c 'import tools21cm' All this works without error messages. I then ran the tests which all past successfully. There are some warnings: `============================= test session starts ============================== platform linux -- Python 3.10.0, pytest-7.0.0, pluggy-1.0.0 rootdir: /home/gmell/Science/Codes/tools21cm_new/tools21cm collected 25 items

tests/test_BubbleStatistics.py ... [ 12%] tests/test_CosmoCalc.py . [ 16%] tests/test_IdentifyRegions.py ... [ 28%] tests/test_PointStatistics.py ..... [ 48%] tests/test_PowerSpectrum.py ..... [ 68%] tests/test_Smoothing.py .... [ 84%] tests/test_Temperature.py .... [100%]

=============================== warnings summary =============================== ../../../../anaconda3/envs/latest/lib/python3.10/site-packages/joblib/backports.py:7 /home/gmell/anaconda3/envs/latest/lib/python3.10/site-packages/joblib/backports.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.version import LooseVersion

../../../../anaconda3/envs/latest/lib/python3.10/site-packages/skimage/restoration/inpaint.py:5 /home/gmell/anaconda3/envs/latest/lib/python3.10/site-packages/skimage/restoration/inpaint.py:5: DeprecationWarning: Please use laplace from the scipy.ndimage namespace, the scipy.ndimage.filters namespace is deprecated. from scipy.ndimage.filters import laplace

tests/test_IdentifyRegions.py::test_bubbles_from_slic /home/gmell/anaconda3/envs/latest/lib/python3.10/site-packages/skimage/_shared/utils.py:338: FutureWarning: multichannel is a deprecated argument name for slic. It will be removed in version 1.0.Please use channel_axis instead. return func(*args, **kwargs)

tests/test_IdentifyRegions.py::test_bubbles_from_slic /home/gmell/anaconda3/envs/latest/lib/python3.10/site-packages/skimage/_shared/utils.py:293: FutureWarning: max_iter is a deprecated argument name for slic. It will be removed in version 1.0.Please use max_num_iter instead. return func(*args, **kwargs)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================== 25 passed, 4 warnings in 4.83s ======================== `

garrelt commented 2 years ago

So, it seems to work now. Some of the warnings may be good to keep an eye on.