Julian-Hochhaus / LG4X-V2

A graphical user interface of Python lmfit package was developed for standard X-ray photoemission spectroscopy (XPS) curve fitting analysis. The interface streamlines the fitting procedures for validating results and their consistency.
https://julian-hochhaus.github.io/LG4X-V2/
Other
20 stars 9 forks source link

No module named 'lmfitxps' #102

Closed fanth0ny closed 1 day ago

fanth0ny commented 3 days ago

Dear Julian,

Thanks for you contribution with XPS fitting. I was trying to use you software but it seems to be a missing file. I cannot find it anywhere in the sourse. Is this an error.

fanthony@fanthony-Inspiron-3543:~/LG4X-V2-master/Python$ python3 main.py Traceback (most recent call last): File "/home/fanthony/LG4X-V2-master/Python/main.py", line 13, in from lmfitxps.models import TougaardBG, ShirleyBG, SlopeBG ModuleNotFoundError: No module named 'lmfitxps'

Looking forward to using your code,

Best regards,

fanthony

Julian-Hochhaus commented 2 days ago

Hi fanthony,

Probably, you have not installed the software's dependencies yet.

LG4X-V2 depends on the following packages and versions:

asteval>=0.9.28
lmfit>=1.1.0
matplotlib>=3.6
numpy>=1.19
pandas>=2.0
PyQt5>=5.15
scipy>=1.6
uncertainties>=3.1.4
lmfitxps>=2.4.1

These requirements could be installed using pip:

pip install -r requirements.txt

Especially, lmfitxps would be installed by:

pip install lmfitxps

Best regards :)

fanth0ny commented 2 days ago

Thank you very much for your fast reply. I actually read the procedure and tried to install all the packages. All of them where nicely install but lmfitxps. Then I thought that it could be that it was a file module instead of a package but I didn't find any file with that name. This is the error that I found when I reach the lmfitxps:

sudo apt install python3-lmfitxps Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package python3-lmfitxps

I am not using pip, I know, but I think it should work the same. Maybe that's my mistake. But I am not that familiar with virtual environments and I have some troubles trying to install things with pip, because my ubuntu version do not allow me if it is not in an virtual environment, so I use "apt install python3-xyz" instead.

In conclusion, I do not know what to do :,)

Best regards.

Julian-Hochhaus commented 1 day ago

Hi fanthony,

I see where the issue is coming from: lmfitxps isn’t available as a system package in Ubuntu’s default repositories, so the apt install python3-lmfitxps command won’t work. Instead, this package is hosted on PyPI, which requires pip to install. Generally speaking, it makes sense to use virtual environments to test stuff without interfering with your running system. If something does not work as expected, you can just kill the environment without hurting your general setup. There are plenty of tutorials available on how to use them, e.g., in the Python Docs.

If you hesitate to use a venv, you can copy the lmfitxps package to your local folder and change all lmfitxps imports in the source code (there should be maybe 5 lines of code to change). The lmfitxps source code is available on Github. Importing from a local folder or files in Python is described, e.g., here. If you do so, be aware that you have to change the code each time you update the repository from GitHub.

In the future, I might consider making both packages available in the Ubuntu Debian package repositories, but I will need to go through a packaging and submission process. This involves creating a Debian package, submitting it to Ubuntu's repositories, and waiting for approval, which can be complex and may require some time.

Best regards, and much success with the procedure!

fanth0ny commented 1 day ago

Hi Julian,

I think the best thing to do is to learn how to work with virtual environments. It must be something silly. But it's good to understand the origin of the problem. I have options and I have to take some time for both (but maybe working with venvs is going to be faster than changing lines of code and it's not optimal for updates and healthier for my OS).

Thank you very much for all the detail and willingness! :)