SWIFTSIM / emulator

The SWIFT simulation cosmological emulator (swift-emulator)
GNU Lesser General Public License v3.0
5 stars 2 forks source link

[JOSS review] Issues with installation via pip. #32

Closed JDonaldM closed 2 years ago

JDonaldM commented 2 years ago

Installing via pip does not install all the required dependencies.

Looking at setup.py it looks like requirements.txt is not being used.

JDonaldM commented 2 years ago

Forgot to tag the review thread!

JBorrow commented 2 years ago

Hi @JDonaldM, are you having troubles installing the code and running it?

I have noticed that the velociraptor python library (used in the penalty functions) is missing from our setup.py, so that might be causing some issues. For the time being, you can just pip3 install velociraptor. I've remedied this in our latest master, but we'll wait to do another release once the review is complete.

As far as I am aware it's not common practice to use the requirements.txt file in the setup.py. The dependencies specified in setup.py are for 'running' the code, and the ones in requirements.txt are for developing the code (e.g. running tests, formatting, and so on). If I'm incorrect and there is a common way to use the requirements.txt, please let me know.

JDonaldM commented 2 years ago

Running pip3 install swiftemulator (as in the installation instructions) is successful. However trying import swiftemulator as se results in ModuleNotFoundError: No module named 'yaml' which is suggesting not all the dependencies are being installed.

I can't say whether it is common practice for the requirements.txt file to be used in setup.py. I have done this for my own code and have come across many others that do this too. I have also come across others that don't.

The point I was trying to make is that when installing into a bare environment the package is not usable because not all dependencies are being installed.

JBorrow commented 2 years ago

Thanks for clarifying! This should now be fixed. Would you be able to try pip3 install git+https://github.com/swiftsim/emulator.gitplease? I checked this in a clean environment on my laptop, so hopefully everything is working now! This will pull directly from the GitHub repo.

JDonaldM commented 2 years ago

import swiftemulator as se no longer causes ModuleNotFoundError: No module named 'yaml' (or any error like this) so things appear to be fixed.

JDonaldM commented 2 years ago

I'm sorry to bring this up again but I have started running examples you provide in your documentation and there are still missing dependencies.

For example if you try and run the examples as presented in the Analysis tools section of the docs you will get a ModuleNotFoundError: No module named 'tqdm' error when running

from swiftemulator.sensitivity import cross_check

schecter_ccheck = cross_check.CrossCheck()
schecter_ccheck.build_emulators(model_specification=model_specification,
                        model_parameters=model_parameters,
                        model_values=model_values)
JBorrow commented 2 years ago

Thanks for bringing this up! Sorry this was missing, I wasn't aware it was used deep in the code. This should be fixed now.

JDonaldM commented 2 years ago

Running the same cell now throws an error for missing emcee. Sorry to keep bothering you with these I'm bring them up as I go. Is there a faster way for me to check that all dependencies are being installed? The automated testing is passing so it is missing this.

JBorrow commented 2 years ago

I've added an automated test to run the tests without installing all the additional development dependencies.

Now all tests pass with the currently specified dependencies in setup.py. Please let me know if this happens again as then we have an un-tested import which is definitely bad!

Thanks for your patience.